Skip to content

ui-react: artifact-recovery late-completion runtime cases assert before the late response is handled #3909

Open

Description

@schlessera

Context

Two cases in packages/ui-react/tests/artifact-recovery-runtime.test.ts check right after a late response is released, but nothing in the page waits for that response to be handled first:

  • test("artifact delayed load closes immediately and late completion never reopens it", packages/ui-react/tests/artifact-recovery-runtime.test.ts:161-178. After await hold!() (line 174), it asserts only open === false and path === null (lines 175-176). A late failure goes through failureUpdate (packages/ui-react/src/stores/file-state.ts). That function sets neither open nor path, so both assertions also hold if the late completion is not ignored. Removing the abort in closeFile (packages/ui-react/src/stores/file-state.ts:359) would probably not fail the test.
  • test("SVG Raw abandons a late source response when Preview replaces it", packages/ui-react/tests/artifact-recovery-runtime.test.ts:522-542. The img/pre counts at lines 540-541 run straight after route.fulfill. The page has no barrier, so a late source response that is handled later is never observed.

The page fixture packages/ui-react/tests/fixtures/artifact-recovery-client.tsx (__artifactFixture, line 37) exposes state() but no count of loads that were settled or ignored. A test therefore cannot wait for "the late response was handled, then dropped". Found in the test-health audit of shard e3855-ui-react-01 (#3855). The fixture is outside that audit's cluster, so the fix is filed here.

Scope

  • Add an identities-only counter of settled or ignored file and source loads to the fixture's __artifactFixture.
  • Have both tests await it after releasing the late response. Then assert that failure, loading and the view mode are unchanged, in addition to the current checks.

Out of scope

  • Product changes to file-state.ts or the preview components.
  • Other cases in the file, and any timeout or deadline.

Acceptance criteria

  • With the abort removed from closeFile, the delayed-load test fails on an assertion about the late completion. It passes again once the abort is restored.
  • With Preview's abandonment of a superseded source response removed, the SVG Raw test fails on its post-barrier assertion.
  • No timeout or deadline changes, and the file stays green over 5 shuffled runs.

Verification

BRAIN_REQUIRE_CHROME=1 bun run test ./packages/ui-react/tests/artifact-recovery-runtime.test.ts, plus the two mutation receipts (bun scripts/test-health.ts mutate).

Contract impact

None. This changes test code only.

Activity

  1. added
    type: testCoverage, harness or proof work with no behaviour change.
    area: ui-reactReact chat/files/voice components, stores, WebSocket transport.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-reactReact chat/files/voice components, stores, WebSocket transport.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: testCoverage, harness or proof work with no behaviour change.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions