Skip to content

test(channels): isolate WS assertions from initial loading - #2087

Merged
efiten merged 1 commit into
Kpa-clawbot:masterfrom
n30nex:codex/channel-test-snapshots
Sep 30, 2026
Merged

efiten merged 1 commit into
Kpa-clawbot:masterfrom
n30nex:codex/channel-test-snapshots

Conversation

@n30nex

@n30nex n30nex commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #2086.

The #1468 WebSocket browser checks could fail when initial channel loading completed between their separate before/after evaluations. An orphan message added no channel, yet unrelated loading changed the count from 0 to 5; the positive control could also lose its sentinel when loading replaced the list.

Each check now captures before state, processes its packet, and captures after state in one synchronous browser evaluation. All four original assertions and both message payloads are unchanged. This updates one test file only, with no production, dependency or configuration changes.

Validation

  • Delayed real API loading reproduces both failures on unchanged master.
  • Both corrected checks pass with loading held and with loading completed; each uses one evaluation.
  • Parent independently ran the delayed-loading harness and full browser suite: 131 passed, three existing fixture skips.
  • All 183 standalone frontend suites passed. Syntax, inventory, whitespace and privacy checks passed.

TDD justification: test synchronization repair only. Existing assertions demonstrate the baseline failure; no production behavior or manufactured failing test was added.

Browser checks used Chromium against unchanged production source. OpenClaw profile/external preflight were unavailable; repository checks ran directly, with a 60-second local navigation budget. Final CI must pass before merge.

@dborup

dborup commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

This looks like a reasonable way to isolate the test’s intended assertion, but the original failure may also reveal a real production race that is worth tracking separately.

loadChannels() replaces the entire channels array when the initial /api/channels request completes. If a WebSocket message creates or updates a channel while that request is still in flight, the later API response can overwrite the WebSocket state.

Keeping the snapshots and synchronous batch in one browser turn makes this test deterministic, but it no longer exercises that interleaving. I suggest merging this test-only fix while opening a separate issue/PR for reconciling WebSocket channel updates with an in-flight initial channel load.

@efiten
efiten merged commit 31744c6 into Kpa-clawbot:master Sep 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(e2e): channel WS assertions race initial channel loading

3 participants