fix: Auto-detected flaky tests (merge-group) — review for quarantine (#2660) - #2799
zaxbysauce wants to merge 2 commits into
Conversation
Quarantine tests/unit/telemetry/init-rehome.test.ts in the general ledger (scripts/ci/quarantined-tests.txt) — the merge-group coverage shard reported a passed-on-retry flake on ubuntu-latest only: CI run: 34309871068 (merge_group) Head: 701e628 Detection run: 34311972198 (2026-09-09T04:41:50Z, success) Detection issue: #2660 Shard: ubuntu-latest coverage-shard 1 Pattern: Attempt 1 failed -> Passed on retry 1 Sibling shards: coverage-shards 2/3/4/5/6 green; all six ubuntu/macos/windows unit shards green or did not run the file in the same run. The coverage gate runs ubuntu-only and honors ONLY the general ledger (scripts/ci/run-coverage-gate.sh:98-104 say coverage is ubuntu-only and must never branch on RUNNER_OS) — so this is the only correct ledger target. The ci.yml retry loop discards attempt-1 output when a retry passes, so no assertion text exists to drive a root fix. The test passes locally on this checkout in ~149ms (5/5 cases); the underlying telemetry re-home path (init A then init B produces two telemetry.jsonl files; same-directory re-init is a no-op; fail-open ownership retention on failed new-stream creation; canonical same-root check) is correct per PR #2472 W9 and the follow-up fix 71bad1b. Each entry carries the structured # OWNER: / # EXPIRY: metadata required by scripts/check-invariants.ts Check 7 (issue #2477). EXPIRY 2026-10-15 is 30 days out, well inside the 14-day grace window so the gate warns rather than fails. Files: scripts/ci/quarantined-tests.txt — append path + metadata block docs/releases/pending/issue-2660-init-rehome-quarantine.md — release fragment (sections: What changed / Why / Migration steps / Known caveats) Refs: #2660, #1782 (flake-detection / test-stability sprint), #2472 (telemetry re-home contract), #2477 (OWNER/EXPIRY metadata gate), #1908 (general-ledger retirement precedent).
The previous quarantine commit (c2d48d4) added the ledger entry and release fragment but no test file, so the pipeline's verify gate (require_test_file_changed) rejected it. Add the missing regression pinning test, modeled on the #2730 analogue (tests/unit/scripts/ci/ci-yml-quarantine-2730.test.ts): it reads the real ledger files and asserts the issue #2660 entry for tests/unit/telemetry/init-rehome.test.ts is active in the GENERAL ledger (coverage job is ubuntu-only and run-coverage-gate.sh never branches on RUNNER_OS), absent from the per-OS/integration ledgers, carries OWNER/EXPIRY metadata (Check 7, issue #2477), and that the on-disk path is discovered by the ci.yml find chain. Also correct the release fragment: issue #2730 (a sibling auto-filed flake issue naming the same file) is still OPEN, not closed — its unmerged branch 4199ba6 holds a parallel general-ledger entry, and this is now called out as a merge-conflict caveat rather than a false 'closed' claim. Refs: #2660, #1782 (test-stability sprint), #2477 (OWNER/EXPIRY metadata gate), #2730 (sibling flake issue, OPEN), #1908 (general-ledger retirement precedent).
Drift check reportFound 2 drift finding(s): 0 error, 0 warning, 2 notice. required-check-contract (2)
|
There was a problem hiding this comment.
🟡 Changes recommended
The quarantine mechanics and metadata are correct, but the release fragment inaccurately describes the suppression blast radius and Check 7's grace-window behavior, and the ledger evidence timestamp is internally inconsistent.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR quarantines the flaky test tests/unit/telemetry/init-rehome.test.ts (auto-detected in a merge-group CI run, issue #2660) by adding it to the general quarantine ledger with Check-7-compliant OWNER/EXPIRY metadata. It fits into the repository's test-stability workflow (issue #1782 / #2477), where merge-group flake detection files issues and quarantine ledgers exclude the affected files from the CI gate until a root fix lands. The change is CI/docs-only — no runtime, plugin, or source code is touched.
Changes:
- Adds
tests/unit/telemetry/init-rehome.test.tstoscripts/ci/quarantined-tests.txt(general ledger) with an OWNER/EXPIRY comment block (EXPIRY2026-10-15). - Adds a filesystem-real regression pinning test (
ci-yml-quarantine-2660.test.ts) asserting the entry is active in the general ledger, absent from per-OS/integration ledgers, carries OWNER/EXPIRY, and that the on-disk path exists. - Adds a pending release fragment documenting the quarantine, rationale, and caveats.
File summaries
| File | Description |
|---|---|
scripts/ci/quarantined-tests.txt |
Adds the quarantine entry and OWNER/EXPIRY metadata block; evidence timestamp is inconsistent with the pinning test. |
tests/unit/scripts/ci/ci-yml-quarantine-2660.test.ts |
New pinning test reading the real ledgers; assertions are correct and filesystem-real. |
docs/releases/pending/issue-2660-init-rehome-quarantine.md |
Release fragment; overstates that the test still runs on non-coverage shards and mischaracterizes the Check 7 grace window. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| shards. The test still runs on every other platform/shard; only the | ||
| ubuntu-latest coverage-shard invocation is skipped until a root fix lands. |
| `scripts/check-invariants.ts` Check 7 (issue #2477). EXPIRY is | ||
| `2026-10-15` — 30 days out, well inside the 14-day grace window so the | ||
| gate warns rather than fails. A regression pinning test |
| # the stream destination (canonical same-directory check). Flaky on | ||
| # ubuntu-latest merge-group coverage-shard 1 only: CI run 34309871068 | ||
| # (merge_group, head 701e628206badece23c92fefd941a778973b2c84, | ||
| # 2026-09-09T04:41:50Z) had Attempt 1 fail and Passed on retry 1 |
Closes #2660
Summary
|Scope: Adds
tests/unit/telemetry/init-rehome.test.tsto the general quarantine ledger (scripts/ci/quarantined-tests.txt) with Check-7-compliant OWNER/EXPIRY metadata, a regression pinning test that reads the real ledgers, and a release fragment.|Verdict: APPROVE
|
|### Findings
|
|#### MEDIUM — Blast-radius claim in ledger comment and release fragment is false: general-ledger entries suppress the file on ALL unit-shard OSes, not just coverage
|- Location:
scripts/ci/quarantined-tests.txt:26-31(comment: "Flaky on ubuntu-latest merge-group coverage-shard 1 only") anddocs/releases/pending/issue-2660-init-rehome-quarantine.md:9-11("The test still runs on every other platform/shard")|- Evidence:
.github/workflows/ci.yml:628-638appliesscripts/ci/quarantined-tests.txtviacomm -23on every RUNNER_OS (the per-OS ledgers at ci.yml:632-636 are additive); the in-file comment at ci.yml:631 states merge_group runs the full 3-OS matrix. The file is therefore skipped in all 18 ubuntu/macos/windows unit cells plus the coverage shard, not "every other platform/shard". The green-sibling-shards evidence in the same run shows attempt-level flakiness distribution, but the mechanism does not discriminate coverage from unit.|- Why it matters: Gating behavior is still correct (coverage honors only this ledger, so it is the only effective target), but the misstatement of the mechanism could misdirect the future root-cause attempt the EXPIRY demands (someone may chase a coverage-only harness cause for a failure mode that also fires in plain unit shards), and it contradicts the #2185 precedent test's stated semantics ("the general ledger applies on every RUNNER_OS").
|- Suggested fix: Reword the ledger comment block and fragment to "flake observed on ubuntu-latest coverage-shard 1; the general ledger suppresses the file in all unit/coverage invocations because coverage consumes only this ledger — accepted over-provision until root fix."
|
|#### LOW — Timestamp inconsistency in evidence prose
|- Location:
scripts/ci/quarantined-tests.txt:27vstests/unit/scripts/ci/ci-yml-quarantine-2660.test.ts:11|- Evidence: The ledger attributes
2026-09-09T04:41:50Zto CI run34309871068; the test attributes04:09:35Zto the same run; commit c2d48d4 assigns04:41:50Zto the detection run34311972198.|- Why it matters: Comments only (nothing parses them beyond the OWNER/EXPIRY prefix checks), but one attribution is wrong and this ledger block is the durable evidence record for the quarantine.
|- Suggested fix: Pick one timestamp per run ID consistently across ledger, test comment, and fragment.
|
|#### LOW — "Retry loop discards attempt-1 output" is asserted, not evidenced
|- Location:
scripts/ci/quarantined-tests.txt:31-32,docs/releases/pending/issue-2660-init-rehome-quarantine.md:29|- Evidence: No diff or context line demonstrates the ci.yml retry loop's log-overwrite behavior; the claim is load-bearing for "no assertion text exists to drive a root fix".
|- Why it matters: Weakens the documented justification for quarantining instead of fixing.
|- Suggested fix: Cite the specific ci.yml retry-step lines, or soften to "attempt-1 output was not retained in the run artifacts reviewed".
|
|### What I Checked
|- Target file present in diff: yes (
scripts/ci/quarantined-tests.txt; quarantined pathtests/unit/telemetry/init-rehome.test.tsexists at that exact repo-relative path, found at line 2753 of the replicated all-tests inventory)|- New/updated test exercises the changed code path: yes —
ci-yml-quarantine-2660.test.tsreads the real ledger files withreadFileSync/existsSync(no mocks); independently replicated ci.yml'sgrep -vE | sort | comm -23chain: 3537 total → 1 quarantined → 3536 gated, entry active and excluding exactly that file|- Check 7 (issue #2477) against the real ledger:
bun run check:invariantsexits 0, "All active quarantine entries carry OWNER + EXPIRY metadata" (EXPIRY 2026-10-15 is future-dated; OWNER/EXPIRY grammar matchescheckQuarantineMetadatapatterns atscripts/check-invariants.ts:1103-1105)|- Ledger parse scoping: blank line at ledger line 14 terminates both Check 7's and the pinning test's upward block walks before the stale "# No active global test quarantines" line; no test pins that comment's truth or a ledger entry count for the general ledger
|- Scope creep beyond the issue: no — exactly the ledger entry, one pinning test, one release fragment; ci.yml and run-coverage-gate.sh untouched (both asserted textually by pre-existing
ci-yml-integration.test.ts/ci-coverage-sharding.test.ts, which this diff cannot break)|- Anti-patterns scanned: silent-except (n/a — no code), mock-without-call (none; test is filesystem-real), off-by-one (n/a), signature-break (n/a), scope-creep (none), stale-docs (found: the MEDIUM above), duplicate-entry (single active entry; detector Rule A drops re-detections; #2730 collision disclosed)
|
|### Confidence
|high — the gating mechanics were verified end-to-end (real gate run + replicated comm/gate math); only a verified root-cause demonstrating the flake is not coverage-specific (making the general ledger over-broad) would change the verdict.
Invariant audit
Test plan
See the linked issue and the change summary.