aglinxinyuan opened a new issue, #7861:
URL: https://github.com/apache/texera/issues/7861

   ### Task Summary
   
   
`amber/src/main/scala/org/apache/texera/web/resource/CollaborationResource.scala`
 is at 77.0% — 4 missed and 16 partial of 87 lines, with only 63.5% of its 74 
branch arms covered. The existing `CollaborationResourceSpec` has 16 tests, and 
the parts left unexercised are the ones that decide who holds the editing lock.
   
   Things worth knowing before writing anything here, because several of them 
are ways to write a test that looks like it pins the lock semantics and does 
not:
   
   1. **A single peer in the bucket cannot pin "grant the lock once".** With 
one candidate, flipping the `!granted` guard only proves the latch *starts* 
false. Pinning once-only granting needs several writable peers and an assertion 
that exactly one of them got it.
   2. **Two sessions authenticated as the same uid make the privilege predicate 
unobservable.** A test named "hand the lock to a remaining *writable* peer" 
pins nothing about writability unless a second, read-only peer is seeded 
alongside and shown *not* to receive it.
   3. **A null-holder-sentinel test can accidentally pin only Scala's null-safe 
`==`.** Asserting that a null holder is left alone passes on the inverted 
branch too, because the interesting part is the `.equals` NPE that `==` avoids. 
The identity test needs an assertion that fails when the branch flips.
   4. **Watch for ScalaMock echoes masquerading as assertions.** `peer.getId 
shouldBe "s2"` against a mock set up with `(() => 
session.getId).expects().returning("s2")` asserts the fixture, not production.
   5. **The fan-out loop bodies earn no coverage at all.** The `CommandRequest` 
/ `RestoreVersionRequest` loops and the hand-off loop compile to 
`ACC_SYNTHETIC` `$anonfun` methods that JaCoCo's `SyntheticFilter` drops — 
`jacoco.xml` has no `<line>` entry for them. Tests there are still worth 
writing for behaviour, but do not plan a coverage number around them.
   6. **13 of the partial lines are structurally unreachable** — logging 
guards, a lazy-val bitmap, `MatchError` arms, dead short-circuit arms, and 
null-`Session.getId` arms. Chasing them is wasted effort.
   
   Two defects are already visible in this file and should be documented rather 
than pinned: the `AcquireLockRequest` null-sentinel handling, and a 
stale-bucket leak.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to