Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
Every flaky pass in Free Tests is now recorded in Trunk or the flaky-test log (GST-3303) (#4572)
Garry Tan6a64c49213a0
diff --git a/.github/workflows/free-tests.yml b/.github/workflows/free-tests.ymlindex 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.jsonlrun: 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.04timeout-minutes: 10continue-on-error: truediff --git a/changelog.d/ci-flaky-passes-always-recorded.md b/changelog.d/ci-flaky-passes-always-recorded.mdnew file mode 100644index 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.mdindex 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-*` artifactof the run and appends `bun run scripts/test-health-report.ts flake-summary <dir>`-to its job summary. The Windows lane uploads `flake-ledger-windows-<shard>`.+to its job summary. The Windows lane uploads `flake-ledger-windows-<shard>`,+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 ofits 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 onthe same code, or keeps failing on main, and lists it under Flaky Tests atapp.trunk.io/garry-tan. That job is detection only: quarantine is off in theuploader 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 walltimeout, or one that crashes, writes no report, so Trunk sees none of thatchild's results, its passing files included. Such a child also skips theflaky 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 uploaderneeds), and it checks out and runs nothing of the pull request's. The [flakeledger](#flake-ledger), its one-rerun rule and the daily flaky pass arediff --git a/test/free-tests-workflow-wiring.test.ts b/test/free-tests-workflow-wiring.test.tsindex 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);