test(viewer): the after-settle overlay test waits for its idle request, not one tick

Merged
LO
10d ago
+4-1

Why

useSymbolicAnnotations.afterLoad.test.tsx › "a store first seen after its load settled … parses in an idle period, not at once" fails intermittently under load with 0 !== 1 at line 196. It failed the full viewer suite of #10867 (fleet job baa5bb5f, shard 3/4), a PR that doesn't touch this hook.

Cause (instrumented): the hook hands its overlay-parse job to the after-load queue through a lazily imported module (afterLoad.ts → import('./afterLoadIdle.js')). On a busy host that handoff lands after the single setTimeout(0) tick the test waited. The test then drained an empty idle queue and saw no parse.

  • Failing run: before the drain, {jobs: 0, idle: 0}; after the drain, {jobs: 1, idle: 1}.
  • Passing run: before the drain, {jobs: 1, idle: 1}.

The product behaviour is right (the parse runs in the next idle period); only the test's timing assumption was wrong.

Change

Test only. Wait for the idle request the way the mid-load test in the same file already does (settleLoadWindow(() => idle.length > 0)), assert that there is still no parse, drain, then assert exactly one. The assertions are unchanged, so a parse that runs before the idle period still fails the test.

Evidence

Failures under six parallel copies of the file
Beforeabout 1 in 30 (#10867's head: 3/20 sequential under fleet load)
After0 of 48

Quiet sequential runs pass either way; the flake needs CPU pressure, which is how the four-shard fleet suite runs.

full viewer suite: 4 shards, 25,097 tests, 0 failed, on b127448c12 (fleet job auto-055ec613).

šŸ¤– Generated with Claude Code

Closes #11019 (same flaky test, found independently in the Pop fleet run for #10978).