diff --git a/.github/workflows/free-tests.yml b/.github/workflows/free-tests.yml
index 89c5006ad..a67321452 100644
--- a/.github/workflows/free-tests.yml
+++ b/.github/workflows/free-tests.yml
@@ -590,6 +590,18 @@ jobs:
GSTACK_FLAKE_LEDGER: ${{ runner.temp }}/flake-ledger.jsonl
run: xvfb-run -a bun run test:quick
+ # The quick tier retries a failing file once too, so its flaky passes go
+ # in the same flake-ledger-* series the aggregate summarizes and
+ # test:health counts. Before GST-3303 this ledger was written and lost.
+ - name: Upload the quick tier's flake ledger
+ if: always()
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
+ with:
+ name: flake-ledger-quick
+ path: ${{ runner.temp }}/flake-ledger.jsonl
+ if-no-files-found: ignore
+ retention-days: 90
+
free-suite:
name: free-suite (${{ matrix.shard }})
needs: [free-plan, reuse, docs-scope]
@@ -889,13 +901,15 @@ jobs:
# The CLI version is pinned and use-cache is off, so the binary always comes
# from Trunk's checksummed release, never from an Actions cache entry that a
# pull-request job could have written.
- # Same-repository pull requests and main pushes only; a missing token skips
- # both steps. Fail-open at step and job level. Review:
+ # Same-repository pull requests, main pushes and dispatch runs (the CI runs
+ # lanes dispatch on their own branches, which only someone with write access
+ # can start); a missing token skips both steps. Dispatch runs were left out
+ # until GST-3303 found a retried flake on one that Trunk never saw. Fail-open at step and job level. Review:
# docs/TESTING_INTERNALS.md.
trunk-flaky-tests:
name: Trunk Flaky Tests (detection only)
needs: free-suite
- if: always() && needs.free-suite.result != 'skipped' && ((github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository))
+ if: always() && needs.free-suite.result != 'skipped' && ((github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository))
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: true
diff --git a/changelog.d/ci-flaky-passes-always-recorded.md b/changelog.d/ci-flaky-passes-always-recorded.md
new file mode 100644
index 000000000..281b186ef
--- /dev/null
+++ b/changelog.d/ci-flaky-passes-always-recorded.md
@@ -0,0 +1 @@
+**Every flaky pass in Free Tests is now recorded.** A test that failed and then passed on its one retry in a dispatched Free Tests run (the runs lanes start on their own branches) was never sent to Trunk, and a retry in the quick tier on the install-default Bun wrote a ledger that was thrown away. Dispatch runs now upload to Trunk like pull requests and main pushes, and the quick tier uploads its ledger as `flake-ledger-quick`, so the run summary and `test:health` count it.
diff --git a/docs/TESTING_INTERNALS.md b/docs/TESTING_INTERNALS.md
index f2d5d1095..75a4893d5 100644
--- a/docs/TESTING_INTERNALS.md
+++ b/docs/TESTING_INTERNALS.md
@@ -1540,7 +1540,9 @@ from this file-level ledger.
The aggregate job of `free-tests.yml` downloads every `flake-ledger-*` artifact
of the run and appends `bun run scripts/test-health-report.ts flake-summary
`
-to its job summary. The Windows lane uploads `flake-ledger-windows-`.
+to its job summary. The Windows lane uploads `flake-ledger-windows-`,
+and the quick tier on the install-default Bun (`quick-bun-default`) uploads
+`flake-ledger-quick`.
Free-suite flake rules:
@@ -1783,8 +1785,8 @@ skipping is a separate decision for Garry, made after that review.
Since GST-1859, every free-suite shard keeps bun's JUnit report from each of
its children, the flaky retry included (`--junit-dir`), and the
`trunk-flaky-tests` job uploads them, failures included, to the Trunk test
-collection `7yDVXXE3` ("gstack free suite") on same-repository pull requests
-and main pushes. Trunk flags a test as flaky when it fails and then passes on
+collection `7yDVXXE3` ("gstack free suite") on same-repository pull requests,
+main pushes and dispatch runs (dispatch runs joined in GST-3303). Trunk flags a test as flaky when it fails and then passes on
the same code, or keeps failing on main, and lists it under Flaky Tests at
app.trunk.io/garry-tan. That job is detection only: quarantine is off in the
uploader and in the collection, nothing skips a test, no job needs or reads it,
@@ -1792,7 +1794,10 @@ and an upload failure can't turn a check red. A child killed at its wall
timeout, or one that crashes, writes no report, so Trunk sees none of that
child's results, its passing files included. Such a child also skips the
flaky retry, so the flake ledger has no entry for it; the red shard result is
-the only record. The uploader job is the only one that sees
+the only record. The quick tier on the install-default Bun
+(`quick-bun-default`) retries the same way and uploads its ledger as
+`flake-ledger-quick`, but keeps no JUnit report, so its flaky passes reach the
+ledger and not Trunk. The uploader job is the only one that sees
`TRUNK_ORG_API_TOKEN` (Trunk's v1 organization token, which the uploader
needs), and it checks out and runs nothing of the pull request's. The [flake
ledger](#flake-ledger), its one-rerun rule and the daily flaky pass are
diff --git a/test/free-tests-workflow-wiring.test.ts b/test/free-tests-workflow-wiring.test.ts
index a4c5cdff0..2db791fb4 100644
--- a/test/free-tests-workflow-wiring.test.ts
+++ b/test/free-tests-workflow-wiring.test.ts
@@ -82,9 +82,17 @@ describe('free-tests workflow wiring', () => {
expect(keep.if).toBe('always()');
expect(keep.uses).toMatch(/^actions\/upload-artifact@[0-9a-f]{40}$/);
expect(keep.with).toEqual({ name: 'free-junit-${{ matrix.shard }}', path: '${{ runner.temp }}/free-junit/*.xml', 'if-no-files-found': 'ignore', 'retention-days': 7 });
+ const quick = jobs['quick-bun-default'].steps as any[];
+ const quickRun = quick.findIndex(step => step.name === 'Run the quick free tier on the install-default Bun');
+ expect(quick[quickRun].env).toEqual({ GSTACK_FREE_RETRY_FLAKY: '1', GSTACK_FLAKE_LEDGER: '${{ runner.temp }}/flake-ledger.jsonl' });
+ const quickLedger = quick.find(step => step.with?.name === 'flake-ledger-quick');
+ expect(quick.indexOf(quickLedger)).toBeGreaterThan(quickRun);
+ expect(quickLedger.if).toBe('always()');
+ expect(quickLedger.uses).toMatch(/^actions\/upload-artifact@[0-9a-f]{40}$/);
+ expect(quickLedger.with).toEqual({ name: 'flake-ledger-quick', path: '${{ runner.temp }}/flake-ledger.jsonl', 'if-no-files-found': 'ignore', 'retention-days': 90 });
const flaky = jobs['trunk-flaky-tests'];
expect(flaky.needs).toBe('free-suite');
- expect(flaky.if).toBe("always() && needs.free-suite.result != 'skipped' && ((github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository))");
+ expect(flaky.if).toBe("always() && needs.free-suite.result != 'skipped' && ((github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository))");
expect(flaky['runs-on']).toBe('ubuntu-24.04');
expect(flaky.permissions).toEqual({});
expect(flaky['continue-on-error']).toBe(true);