Repository navigation
Description
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. Afterawait hold!()(line 174), it asserts onlyopen === falseandpath === null(lines 175-176). A late failure goes throughfailureUpdate(packages/ui-react/src/stores/file-state.ts). That function sets neitheropennorpath, so both assertions also hold if the late completion is not ignored. Removing the abort incloseFile(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. Theimg/precounts at lines 540-541 run straight afterroute.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,loadingand the view mode are unchanged, in addition to the current checks.
Out of scope
- Product changes to
file-state.tsor 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