Skip to content

Fix #4550: a quarantined test skipped on the final attempt is a quarantined-fail - #4551

Closed
Huyvux12 wants to merge 1 commit into
garrytan:mainfrom
Huyvux12:fix/issue-4550-quarantined-skip
Closed

Huyvux12 wants to merge 1 commit into
garrytan:mainfrom
Huyvux12:fix/issue-4550-quarantined-skip

Conversation

@Huyvux12

@Huyvux12 Huyvux12 commented Nov 20, 2026 •

Copy link
Copy Markdown

A quarantined test that is skipped instead of running is now reported as a failure, so a skipped test can no longer look green.

Why: the quarantine rule is that a quarantined test still runs, but a skipped one was left out of the results entirely and the run stayed green.

Nothing to do.

What changed

gstack-flaky left a quarantined test out of the results when it never ran, so the run exited 0 with quarantined=0 and no written record. The same happened when a whole-command retry skipped it after a first-run pass, and the quarantine report then counted that run toward the clean streak.

The verdict now follows the test's final attempt: a skip on the final attempt is a quarantined-fail, and the run is red. A test that failed every attempt is still a hard break. A test skipped first but passing on the retry still counts as a pass, because it ran and passed on the attempt that decided the run. An ordinary skipped test still follows the runner's verdict.

docs/flaky.md now states the rule in one sentence.

Tests

Four new tests cover the fix, two of which failed on the code before this change. The two affected test files pass (74 tests), the strict type check reports zero errors, and the test-code type check reports no new diagnostics. The full free suite was not run: the change touches only the flaky-run verdict path.

Agent notes

Closes #4550.

Base: main @ 1bd86d9a4547ed8df0c5da37380c838e61a91b9b, Bun 1.4.4.

Repro from #4550, before:

(skip) quarantined case
(pass) ordinary case
FLAKY_RESULT: tests=2 failed=0 flaky=0 quarantined=0 reruns=0 command_exit=0 verdict=pass ledger=none
exit=0

After:

FLAKY: quarantined-fail cases.test.ts::::quarantined case attempts=skip (quarantined, and skipped on the final attempt instead of running)
FLAKY_RESULT: tests=2 failed=1 flaky=0 quarantined=1 reruns=0 command_exit=0 verdict=fail ledger=flaky.jsonl
exit=1

Retry case, after:

FLAKY: flaky-pass cases.test.ts::::ordinary case attempts=fail,pass
FLAKY: quarantined-fail cases.test.ts::::quarantined case attempts=pass,skip (quarantined, and skipped on the final attempt instead of running)
FLAKY_RESULT: tests=2 failed=1 flaky=1 quarantined=1 reruns=1 command_exit=1 verdict=fail ledger=flaky.jsonl
exit=1

The ledger records {"kind":"quarantined-fail","id":"cases.test.ts::::quarantined case","attempts":["pass","skip"]}, so quarantine report shows it as a fail and the clean streak resets.

Checks run: bun test test/quarantine.test.ts test/flaky-run.test.ts (74 pass), bun run typecheck (zero errors), bun run typecheck:test (812 known diagnostics, none new), bun test test/module-size-ratchet.test.ts (6 pass).

Scope: lib/flaky-run.ts, test/quarantine.test.ts, test/flaky-run.test.ts, docs/flaky.md. No change to lib/quarantine.ts: the report already treats a quarantined-fail ledger line as a fail.

… a quarantined-fail

A live quarantined test that never runs was dropped from the outcomes entirely, so gstack-flaky exited 0 with quarantined=0 and no ledger entry. The same happened when a whole-command retry skipped it after a first-run pass, and the quarantine report counted that run toward the clean streak.

quarantinedStatus now requires the final attempt to be a pass, and runFlaky settles every non-failed quarantined test instead of filtering out all-skip reports, so both cases yield quarantined-fail, exit 1 and a ledger entry recording the skip. A test skipped first but passing on the retry still counts as a pass, and an ordinary skip still follows the runner verdict.
@trunk-io

trunk-io Bot commented Nov 20, 2026

Copy link
Copy Markdown

Merging to main 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

@capy-ai

capy-ai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Thank you @Huyvux12. I reproduced #4550 on current main and read your change, and we're picking it up. We take one small outside fix a day, and this one is next in line, so expect it within a couple of days. It will land on main with you credited, and this PR will be closed with a link when it does.

@capy-ai

capy-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Thank you. Your fix pointed the way: #4590 rebuilt the same rule on current main and landed it (we rewrite outside code instead of merging it directly). It also covers the retry case and an ordinary skip. Closing this PR as superseded by #4590.

@capy-ai capy-ai Bot closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working S3 Severity 3: everything else

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gstack-flaky reports green when a quarantined test is skipped

1 participant