Skip to content

test(ci): edit only after the first watch run finishes in the watch-rerun case (#4081) - #4082

Merged
schlessera merged 1 commit into
mainfrom
fix/4081-watch-rerun-after-first-run
Nov 16, 2026
Merged

schlessera merged 1 commit into
mainfrom
fix/4081-watch-rerun-after-first-run

Conversation

@schlessera

Copy link
Copy Markdown
Owner

Refs #4081

Declared red-main fix for incident #4081 (main run 43858822733, first bad SHA 132505f0bdac). The incident stays open until a green main run that includes the failing set clears the record.

What changed

In tests/test-invocation-lifetime.test.ts, the watch-rerun cases now edit the watched files only after the first watch run has printed its own summary (Ran 1 test across 1 file). Before, they edited as soon as the run printed its WATCH_CONSUMER 1 marker line, while that run was still finishing. On main run 43858822733 no rerun then followed within ten seconds (SECOND_WATCH_CONSUMER). The claim under test is unchanged: the rerun must rebuild and consume cargo = 2 without borrowing the outer authority. Waits whose labels report output now build the label when the wait ends. Before, the label was built when the wait began, so the CI annotation showed only the output that had arrived before the ten seconds started. The same bug class at the survivor-fallback wait is fixed too.

Why this shape

#4064 cannot reach this test. Its fixture copies a fixed list of scripts/* files and three test helpers (invocationFixture, tests/helpers/test-invocation-fixture.ts:6-37), and #4064 changes none of them. Its only scripts/ changes are in scripts/native-proof/. A revert would remove unrelated good work and would not touch the failing file. This failure is a timing flake, so under the maintainer's flake ruling this takes the cheapest fix that removes the race, the edit landing inside the first run. Bun's watch-reload root cause is not established, and the deeper investigation is filed separately with no milestone.

The expedited --fixes-main-run route needs the failing file shown red at the exact base (scripts/red-main-expedite.ts:59), which a flake that does not reproduce cannot supply. So this lands as a declared fix through ordinary candidate confirmation.

Proof

  • Failing log: run 43858822733, job unit (3): (fail) wrapper watch reruns rebuild instead of borrowing live outer authority [12750.82ms] at SECOND_WATCH_CONSUMER. The same case passed in 2.4–3.8 s on main runs 43849565555, 43844647238, 43840844397 and 43836699141.
  • Not reproducible locally before the change: 3 runs with Bun 1.4.4, 8 under a 20-loop CPU burn, and 5 with CI's Bun 1.4.2 all passed. A minimal bun test --watch probe reran 40/40 on Bun 1.4.2 after an edit made right after the test's last statement.
  • After the change: bun run test tests/test-invocation-lifetime.test.ts passed 15/15, three times on Bun 1.4.4. The watch cases passed 2/2, five times on Bun 1.4.2.
  • Mutation A (drop the packages/ithaca source edit, so the rerun consumes a stale build): fails with WATCH_RERUN_FRESH_CONSUMER inside the rerun and SECOND_WATCH_CONSUMER outside. The lazy label now carries the rerun's real output. Restored.
  • Mutation B (expect Ran 2 tests across 1 file): fails with FIRST_WATCH_RUN_COMPLETE, and the label shows the first run's full output. Restored.
  • Lazy label: a local run on Bun 1.4.2 with a broken node shim now reports the real cause (mise ERROR node is not a valid shim) where the old eager label reported empty output.
bun run check:pr --base origin/main
{"version":1,"kind":"brain-check-pr-receipt","head":"9b6ca0d718bdedfa3528f228ae6124f04ec4fe52","base":"origin/main","mode":"focused","startedAt":"2026-11-16T12:15:34.217Z","finishedAt":"2026-11-16T12:17:00.362Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12433.523254},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":115.94341400000121},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":80.7015050000009},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":18.269476999999824},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":73480.35318199999}]}

Checklist

  • Focused local preflight/behavioral receipts and complete selected hosted proof passed; actual head/base/job checkout evidence is in Proof.
  • Acceptance criteria from the issue are all met, or the gap is named below.
  • The PR and completed/advanced issues have verified release milestones under docs/process/github.md.
  • A changeset is included, or this changes nothing a consumer can see.
  • No personal data anywhere in the diff — the leakage gate covers the whole tree.
  • The integration contract index or relevant component is updated in this same commit, or nothing in the machine surface moved.
  • Docs under docs/ reflect the change, or nothing documented moved.
  • A fail-closed guard added or changed answers the proportionate-containment checklist in this body, or no guard changed.
  • Provider history stays append-only: the provider-history guard passes, or nothing on a turn's path changed.

Anything left open

The root cause inside Bun's watch reload is not established. The follow-up issue is linked in a comment below.

🤖 Generated with Claude Code

…erun case (#4081)

The watch-rerun case edited the watched files as soon as the first run
printed its marker line, while that run was still finishing. On main run
43858822733 no rerun followed within ten seconds. Wait for the run's own
summary before editing, so the edit cannot land inside it.

Failure labels that report output were built when the wait began, so the
annotation showed only what had arrived before it. Build them when the
wait ends.

Refs #4081

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schlessera schlessera added this to the 0.45.0 milestone Nov 16, 2026
@schlessera schlessera added type: fix Something is broken and must behave the way it is documented. area: ci CI workflows, the gates they run, release scripts, packaging. type: test Coverage, harness or proof work with no behaviour change. and removed type: fix Something is broken and must behave the way it is documented. labels Nov 16, 2026
@schlessera

Copy link
Copy Markdown
Owner Author

Root-cause follow-up: #4083 (no milestone).

@schlessera
schlessera marked this pull request as draft November 16, 2026 12:19
@schlessera
schlessera marked this pull request as ready for review November 16, 2026 12:19
@schlessera
schlessera merged commit 3b10489 into main Nov 16, 2026
37 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, the gates they run, release scripts, packaging. type: test Coverage, harness or proof work with no behaviour change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant