The GitHub Actions job "Required Checks" on texera.git/main has failed. Run started by GitHub user github-merge-queue[bot] (triggered by github-merge-queue[bot]).
Head commit for run: 49f9e2c414b116bf328bdb9154cc97dc4d1e7e9e / Meng Wang <[email protected]> test(workflow-execution-service): add CollaborationResource unit tests (#6904) ### What changes were proposed in this PR? `CollaborationResource` had no spec and sat at 0% — all 87 tracked lines unhit. It reads as websocket-bound but the only collaborator is the `javax.websocket.Session` interface, which mocks cleanly with the ScalaMock already on amber's test classpath, so the session bookkeeping and message fan-out are ordinary unit-testable logic. Adds `CollaborationResourceSpec` with 13 tests covering the session lifecycle (`myOnOpen`, `myOnClose`), `WIdRequest` bookkeeping on both the authenticated and anonymous paths, `CommandRequest` and `RestoreVersionRequest` fan-out, `HeartBeatRequest`, and the locking branches that do not touch the database. A `mockSession` helper returns a `Session` with a fixed id whose outgoing messages are collected into a buffer; requests are built by serializing the real request case classes, so the `"type"` discriminator cannot drift out of sync with the production `@JsonTypeInfo` config. Three behaviors are worth calling out because they are subtle rather than obvious: - The multi-session `WIdRequest` test pins the `set.union(Set(senderSessId))` line, which returns a fresh set instead of mutating and only works because the result is reassigned into the map. - The fan-out tests assert the sender receives nothing, the same-workflow peer receives exactly one message, and a session on another workflow is untouched. - `wIdLockHolderSessionIdMap` stores a `null` sentinel for "no holder", which is a distinct state from an absent key. With the sentinel in place, `AcquireLockRequest` cannot resolve the holder session and rethrows — the spec pins that current behavior. The five bookkeeping maps live on the companion object and are therefore JVM-wide mutable state, so `beforeEach` clears all five; that is what keeps the suite order-independent. There are no clocks, threads, temp files or network calls in the spec. ### Any related issues, documentation, discussions? Closes #6900. The read-only `TryLockRequest` rejection and the lock hand-off inside `myOnClose` both reach `WorkflowAccessResource.hasWriteAccess` and therefore `SqlServer`; they are left uncovered rather than pulling `MockTexeraDB` (and an embedded Postgres process) in for two branches. ### How was this PR tested? `sbt "WorkflowExecutionService/testOnly *CollaborationResourceSpec"` passes with 13 tests; `Test/scalafmtCheck` and `Test/scalafix --check` are clean. For the failure path, the self-exclusion guard in the `CommandRequest` fan-out was temporarily removed from the production code, which reddened the fan-out test and exited non-zero, and the guard was then restored — so the assertions genuinely constrain the behavior. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-5) --------- Signed-off-by: Meng Wang <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]> Report URL: https://github.com/apache/texera/actions/runs/30236101301 With regards, GitHub Actions via GitBox
