Skip to content

fix(test): drive the triage clock deterministically in the 3A time-boxed cold pass test - #5806

Closed
Masashi-Ono0611 wants to merge 1 commit into
garrytan:masterfrom
Masashi-Ono0611:fix-3a-flake
Closed

Masashi-Ono0611 wants to merge 1 commit into
garrytan:masterfrom
Masashi-Ono0611:fix-3a-flake

Conversation

@Masashi-Ono0611

Copy link
Copy Markdown
Contributor

What

The 3A: a time-boxed cold pass labels deferred files "not yet triaged" in the headline test in test/e2e/dream-synthesize-pglite.test.ts no longer depends on how fast PGLite answers 25 cache lookups. The phase forwards the triage helper's existing clock seam, and the test advances that clock.

Why

The test set a 1 ms triage budget and assumed 25 uncached PGLite lookups would take longer than that. Triage checks the budget after each cache lookup, so a fast run can finish every lookup inside the budget and mark all 25 files degraded and none deferred. The assertion deferred >= 1 then fails with Expected: >= 1.

It failed in Tier 1 on two unrelated PRs while master and other PRs on the same base passed. On one machine, the unchanged master copy of the file failed 5 of 5 runs.

  • SynthesizePhaseOpts gets an optional triageNow, next to the existing now seam, and it is forwarded to the triage helper as now. When it is undefined the helper keeps its Date.now default, so production behavior does not change.
  • The test injects a clock that advances 2 ms per read, so the first cache miss is past the 1 ms budget. It now asserts exactly 25 deferred and 0 degraded, and that the injected clock was read.

Discrimination test (required for every fix — #3665)

Discrimination test: reverted src/core/cycle/synthesize.ts to upstream/master, ran test/e2e/dream-synthesize-pglite.test.ts → 29 pass / 1 fail. Restored → all pass.

Verification

No user-facing message or command is added.

Tests

  • test/e2e/dream-synthesize-pglite.test.ts: 5 consecutive whole-file runs after the change, all exit 0. The unchanged master copy of the file: 5 runs, all exit 1.
  • bun run typecheck exit 0. bun run verify 66/66 checks pass.
  • Postgres-backed tests were not run.

…xed cold pass test

The test assumed 25 PGLite cache lookups take longer than a 1ms budget, so a fast
run can finish every lookup inside the budget and defer nothing. Forward the
triage helper's existing clock seam through the phase and advance it in the test,
and assert that the injected clock was read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Oct 1, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@Masashi-Ono0611
Masashi-Ono0611 marked this pull request as ready for review October 1, 2026 05:06
@andreineacsu

Copy link
Copy Markdown
Contributor

Independent confirmation that this is the fix for a recurring CI failure.

The same failure in Tier 1 on unrelated branches (3A: a time-boxed cold pass ..., Expected: >= 1, Received: 0 at test/e2e/dream-synthesize-pglite.test.ts:242):

Local reproduction (macOS, Bun 1.4.2, bun test --timeout=120000 test/e2e/dream-synthesize-pglite.test.ts, 5 whole-file runs each):

Tree Result
upstream/master at 3a284aea2 5/5 exit 1, only the 3A test fails, Received: 0
this PR (00d5907) applied on 3a284aea2 5/5 exit 0, 30/30 pass

The PR still applies on current master. #5797 changed the rescue: line two lines below the maxMs: line this PR edits. git apply -3 and git merge-tree resolve it without a conflict.

@capy-ai

capy-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thank you! This fix is now on master. It was absorbed into fix wave 7 (#5908, v0.60.32.0) through the community-PR wave process: the change was reviewed, re-applied with tests, and credited in the CHANGELOG with a Co-Authored-By trailer. Closing as superseded by #5908.

@capy-ai capy-ai Bot closed this Oct 2, 2026
timothybrush pushed a commit to timothybrush/gbrain that referenced this pull request Oct 2, 2026
…boxed cold pass test (garrytan#5806)

The 3A cold-pass test set a 1 ms triage budget and assumed 25 uncached PGLite
lookups would exceed it; on a fast machine every lookup finished inside the
budget, nothing deferred and deferred >= 1 failed. The synthesize phase now
forwards an optional triageNow seam to the triage helper's existing clock
option (production keeps Date.now), and the test advances that clock so it
asserts exactly 25 deferred and 0 degraded.

Absorbs community PR garrytan#5806.

Discrimination test: reverted src/core/cycle/synthesize.ts to master, ran
test/e2e/dream-synthesize-pglite.test.ts -> 29 pass / 1 fail. Restored -> 30 pass.

Co-Authored-By: Masashi-Ono0611 <98894508+Masashi-Ono0611@users.noreply.github.com>
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.

2 participants