Skip to content

ci: Trunk Dynamic CI observes free-suite and macOS regressions, learning only (GST-1400) - #4012

Merged
capy-ai[bot] merged 6 commits into
mainfrom
garrytan/gst-1400-trunk-dynamic-ci-learning
Nov 5, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
garrytan/gst-1400-trunk-dynamic-ci-learning

Conversation

@garrytan

@garrytan garrytan commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 4012,
  "head": "a3d6a08aab5828f643f18a2cfcb1a33f7d00d4cf",
  "version": "1.95.5.0",
  "base": "main",
  "session_kind": "unattended",
  "head_tree": "d31db60a45ae1a0786a4bc48b2301df6febe6279",
  "product_patch_id": "35a1095026b57a4e68a35c04b966a5c7ca484586",
  "gstack_version": "1.95.5.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 37,
    "rules": "0d7af83f8b45e574",
    "base": "6bdafb2cf5acf05e6e9ab23a74e682e155d1fdde",
    "registry": "6bdafb2cf5acf05e6e9ab23a74e682e155d1fdde",
    "gate_scan": {
      "tagged": 2,
      "head": "a3d6a08aab5828f643f18a2cfcb1a33f7d00d4cf"
    },
    "reasons": [
      "gate-class",
      "runtime=37"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @d31db60a45ae (7 checks, current for a3d6a08aab58)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/41954621587/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41954621587/attempts/1",
    "free-tests.yml/cso-windows-launcher: https://github.com/garrytan/gstack/actions/runs/41954621587/attempts/1"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ (136 files) plus the changelog.d fragment and free-tests.yml, base 6bdafb2..a3d6a08"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "fix_checks": 2,
    "rounds": 3,
    "ledgers_read": 5,
    "unbound": 2
  },
  "review_targeted": {
    "classes": [
      "gate"
    ],
    "rules": "30e6bce187be0d59",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "35a1095026b57a4e68a35c04b966a5c7ca484586",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

What changed

Before, free-tests.yml had no Trunk integration. After, a new trunk-dynamic-ci job ("Trunk Dynamic CI (learning only)") runs Trunk's pinned trunk-io/dynamic-ci action on every same-repository pull request. Trunk records whether it would have run or skipped free-suite and macos-named-regressions, and why. Nothing reads those verdicts, so every job still runs.

The first run at f948a10, job 126989004305, and the run at 9f107c0, job 126989903665, logged:

Changed files: not sent; Trunk will fetch the diff.
##[warning]Every job will run: Dynamic CI is in shadow mode for this repository, so recommendations are recorded but never gate a job. [REPO_IN_SHADOW_MODE]
  macos-named-regressions: RUN — Would skip (learning mode, so this job still runs) ... 98.7% pass rate over 446 runs
  free-suite: RUN — Would skip (learning mode, so this job still runs) ... 93.0% pass rate over 446 runs

Why

Garry approved A1 on 2026-11-04: learn what Trunk Dynamic CI would skip on gstack's PR CI before turning any skipping on. The free suite costs about 95 machine-hours a day, and macos-named-regressions costs about $35 a day.

Blast radius

  • No job can be skipped. No job needs the observer, no if: reads it, and it exports no outputs, so switching Trunk to enforcement in its dashboard still skips nothing. Every required check keeps its name and its result.
  • Merge evidence is untouched. The free-tests aggregate, the ci-reuse/free-tests profile, ci-carry, pregate, evals.yml (the train gate), the main backstop, the release gate and windows-smoke are unchanged, and none of them read Trunk.
  • Trunk failures don't turn checks red. The action never fails its step. The step continues on error and has a 3-minute timeout, and the job continues on error, so the run's conclusion and every required check keep their own results. The job's own check can still show red if the job can't start or finish, for example when GitHub can't fetch the pinned action or a runner is lost. gstack-ship-queue ready counts that check, so rerun it once, and if it fails again, delete the job.
  • Fork PRs, pushes and dispatches skip the job. A missing token skips only the step.

Security read (CI workflow change)

  • Pin: trunk-io/dynamic-ci@5bcddbf3615c2b032c21eed1b514c91164bda4a8 (v0.1.7, also v1). It is the default-branch HEAD of the upstream repository, not a fork commit. test/workflow-action-pins.test.ts covers it.
  • Permissions: permissions: {}. The run log shows the GITHUB_TOKEN with Metadata: read only. The job passes github-token: '', so the action makes no GitHub API call.
  • Secret exposure: TRUNK_API_TOKEN sits in this one job's env. The job has no checkout and no run step, so no pull request code executes beside the token. It only runs on pull_request events from this repository (head.repo.full_name == github.repository), so fork PRs never get it. No pull_request_target was added.
  • Network calls the step makes (checked against the pinned source, src/config.ts, src/api.ts, src/changed-files.ts and src/telemetry/index.ts):
    1. The runner downloads the action tarball at the pinned SHA from GitHub.
    2. POST https://api.trunk.io/v2/dynamic-ci/generate-plan with Authorization: Bearer TRUNK_API_TOKEN. The body holds the repo, head and base SHAs, branch, PR number, run id and attempt, triggering actor, event name, workflow path and the two job keys. It makes at most 3 attempts, each with a 30-second budget.
    3. Telemetry to telemetry.api.trunk.io is off (TRUNK_DISABLE_TELEMETRY: 'true').
    4. No GitHub API call, because github-token is empty. No local git call does anything, because there is no checkout. Trunk fetches the diff through its own GitHub App.
  • Guards: free-tests.yml was deliberately secretless. The three guards that pinned that (free-tests-workflow-wiring, ci-reuse-workflow-wiring, cso-distribution) now allow exactly one reference, secrets.TRUNK_API_TOKEN, in the observer. They are also stricter than before: they catch lowercase, bracket and toJSON(secrets) forms. A new test pins the observer's whole shape.

Review date

Review the learning data one week after merge (2026-11-12 if this merges on 2026-11-05). docs/TESTING_INTERNALS.md § Trunk Dynamic CI (learning only) lists what to look for: discount Trunk's required-check vote, because the free-tests aggregate needs both jobs, and leave out runs where reuse skipped the suite.

Pre-Landing Review

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen unbound=2 ledgers_read=5 fix_checks=2

The panel ran a specialist, the Red Team, the targeted gate reader, a native adversarial reader and an outside voice (openai/gpt-6.1-sol). It found 0 CRITICAL issues. It found 13 INFORMATIONAL or Low findings, all below the blocking floor:

  • Fixed (8):
    • The docs overstated "never red".
    • Trunk's required-check vote needed a caveat.
    • The docs said a missing token skips the job, when it only skips the step.
    • The windows-free-tests secret guard had become case-sensitive (targeted gate reader).
    • The guards missed bracket and toJSON(secrets) references.
    • The docs didn't say to leave reused runs out of the review.
    • The docs didn't cite the pinned source for the action's network behavior.
    • The changelog wording failed prose lint.
  • Resolved by evidence (4):
    • The github-token input exists at 5bcddbf.
    • Verdicts are recorded.
    • Trunk fetches the diff itself.
    • Annotations go through workflow commands.
  • Open note (1): a job-level infrastructure failure (lost runner, the 5-minute timeout) can show the observer's own check red. The recovery is the same: rerun once, then delete the job.

Gate edits: .github/workflows/free-tests.yml adds the trunk-dynamic-ci job. test/free-tests-workflow-wiring.test.ts, test/ci-reuse-workflow-wiring.test.ts and test/cso-distribution.test.ts replace "no secrets." with an exact one-secret allowlist and add the observer-shape test. The cases these guards still fail on:

  • the token in any other job
  • any other secret
  • a checkout or run step in the observer
  • a job that needs the observer or reads it
  • a dropped continue-on-error
  • a removed fork guard
  • pull_request_target

Documentation

Documentation: current. The audit covered docs/ (136 files), the changelog.d fragment and free-tests.yml, base 6bdafb2..a3d6a08. docs/TESTING_INTERNALS.md gains a "Trunk Dynamic CI (learning only)" section.

Approvals

Approved: yes (record r-5091fa61aa1d). The full approval record stays private: this repository is public or its visibility is unknown.

… learning only (GST-1400)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 5, 2026 01:34
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…veat (GST-1400 review)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@garrytan
garrytan force-pushed the garrytan/gst-1400-trunk-dynamic-ci-learning branch from d5f428e to 7e2628b Compare November 5, 2026 01:50
garrytan and others added 3 commits November 5, 2026 01:54
…-check)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ocs cite the pinned source (GST-1400 voices)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot marked this pull request as ready for review November 5, 2026 02:28
@capy-ai
capy-ai Bot merged commit 796ccea into main Nov 5, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant