Skip to content

fix(open-knowledge): deflake cc1-broadcast spaced-creates seq test (#2747)#695

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jul 19, 2026
Merged

fix(open-knowledge): deflake cc1-broadcast spaced-creates seq test (#2747)#695
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown
Contributor

Copybara-translated 1 Inkeep OSS change. Rebase-merge this PR so the prepared commit lands directly on public main.

…2747)

* test(open-knowledge): claim work on cc1-broadcast spaced-creates determinism

* test(open-knowledge): make cc1 spaced-creates test event-driven, not timing-based

The '10 spaced creates produce 10 signals with monotonic seq' case failed
9/11 when run in isolation on a fast machine while staying green in
full-file and CI runs. Instrumented traces showed the product honoring the
CC1 contract exactly; the test itself made two assumptions the contract
does not promise:

1. Zero non-test ch:files signals in its counting window. The server fires
   a deliberate all-channel defense-in-depth nudge at the end of initAsync
   (debounced 100 ms); a client connecting inside that window - which is
   exactly what isolated execution does right after boot - counts it as an
   eleventh signal.
2. Watcher delivery jitter below the 100 ms debounce margin. FSEvents
   batching compressed 200 ms write spacing to 45-58 ms observed gaps,
   coalescing adjacent creates into one broadcast (8 or 9 signals).

Fix: baseline-delta counting after a 300 ms settle (absorbs the boot
nudge), and event-driven pacing - each create awaits its own debounced
broadcast via pollUntil before the next write, so coalescing is impossible
by construction. Per-iteration equality also pins 'exactly one signal per
create'. No product change; no timeout widening; assertions preserved and
strengthened.

Verified: 20/20 isolated runs green under 4-core CPU load (was 2/10);
full file 16/16 x3; typecheck and biome clean.

* test(open-knowledge): restore over-emission settle, harden burst baseline

Local review findings on the previous commit: (1) the event-driven rewrite
dropped the trailing settle, so a duplicate or straggler broadcast after
the tenth create would go uncounted - restored as a 300 ms settle plus
absolute equality before the delta assertions; (2) a lost watcher event
surfaced as a bare pollUntil timeout - rethrown with per-create context;
(3) the burst test used the same absolute-count-from-connect pattern the
spaced-creates fix removed, leaving its <=5 band exposed to the boot nudge
in isolated runs - converted to the same baseline-delta discipline.

Verified: spaced-creates 5/5 and burst 5/5 isolated, full file 16/16,
typecheck and biome clean.

* test(open-knowledge): apply review round: drop redundant assertion, deflake latency test

Removes the mechanically implied testSignals length assertion and applies the established baseline-delta plus event-driven pacing pattern to the latency test, which carried the same pre-fix timing assumptions (boot-nudge displacement and debounce-window compression). Full file green 5 of 5 on an awake machine; a prior 1 of 3 failure traced to a machine suspend mid-run (15 minute single-test wall clock), not the change. Hook bypassed: worktree pre-push lacks root node_modules.

GitOrigin-RevId: 01557182feaee5ef7f23778365ebfba4fa49e93c
@inkeep-oss-sync
inkeep-oss-sync Bot merged commit ec69879 into main Jul 19, 2026
@inkeep-oss-sync
inkeep-oss-sync Bot deleted the copybara/sync branch July 19, 2026 10:43
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.

1 participant