Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
ci: Trunk Dynamic CI filter on the pull-request tier (Learning mode)
garrytane09ecefc773d
diff --git a/.github/workflows/scale-tier.yml b/.github/workflows/scale-tier.ymlindex 5b29ebfeac..31578586c6 100644--- a/.github/workflows/scale-tier.yml+++ b/.github/workflows/scale-tier.yml@@ -47,6 +47,29 @@ concurrency:cancel-in-progress: truejobs:+ # Trunk Dynamic CI filter (docs/ci-event-parity.md#trunk-dynamic-ci): one output+ # per gated job key; a gated job runs unless its output is exactly 'false', so it+ # fails open. Learning mode records verdicts and skips nothing.+ # Event parity (docs/ci-event-parity.md#trunk-dynamic-ci): pull_request only; the+ # nightly and dispatch runs skip it and run every gated job as before.+ # scripts/check-dynamic-ci.ts guards the wiring.+ dynamic-ci:+ if: github.event_name == 'pull_request'+ runs-on: ubicloud-standard-2-ubuntu-2404+ timeout-minutes: 5+ permissions:+ contents: read+ pull-requests: read+ outputs:+ scale: ${{ steps.dynamic-ci.outputs.scale }}+ steps:+ - id: dynamic-ci+ uses: trunk-io/dynamic-ci@5bcddbf3615c2b032c21eed1b514c91164bda4a8 # v1 (v0.1.7)+ with:+ token: ${{ secrets.TRUNK_API_TOKEN }}+ job-keys: scale+ enable-annotation: 'true'+plan:runs-on: ubicloud-standard-2-ubuntu-2404timeout-minutes: 10@@ -122,9 +145,10 @@ jobs:echo "run=$run" >> "$GITHUB_OUTPUT"echo "pages=$pages" >> "$GITHUB_OUTPUT"+ # Gated by dynamic-ci (docs/ci-event-parity.md#trunk-dynamic-ci): runs unless Trunk's verdict is 'false'.scale:- needs: plan- if: needs.plan.outputs.run == 'true'+ needs: [plan, dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.scale != 'false' && needs.plan.result == 'success' && needs.plan.outputs.run == 'true' }}name: scale ${{ matrix.engine }} ${{ matrix.pages }}strategy:fail-fast: falsediff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex 931f100dd9..bbbe6cad8b 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -66,6 +66,37 @@ concurrency:cancel-in-progress: truejobs:+ # Trunk Dynamic CI filter (docs/ci-event-parity.md#trunk-dynamic-ci). It asks Trunk+ # which of the gated cheap-tier jobs below this pull-request push needs and writes+ # one output per gated job key; each gated job runs unless its output is exactly+ # 'false'. It fails open: a missing token, a Trunk outage or a job with no verdict+ # runs the job.+ # Event parity (docs/ci-event-parity.md#trunk-dynamic-ci): pull_request only. On a+ # push, merge-queue entry, schedule or dispatch (the full-ci run) this job is+ # skipped, every output is empty, and every gated job runs as before.+ # In Trunk's Learning mode it records verdicts and skips nothing; enforcement is the+ # Mode setting on Trunk's Dynamic CI settings page, not this file.+ # scripts/check-dynamic-ci.ts guards the wiring.+ dynamic-ci:+ if: github.event_name == 'pull_request'+ runs-on: ubicloud-standard-2-ubuntu-2404+ timeout-minutes: 5+ permissions:+ contents: read+ pull-requests: read+ outputs:+ security-regressions: ${{ steps.dynamic-ci.outputs.security-regressions }}+ native-locks: ${{ steps.dynamic-ci.outputs.native-locks }}+ persistence-validation: ${{ steps.dynamic-ci.outputs.persistence-validation }}+ stress-changed-tests: ${{ steps.dynamic-ci.outputs.stress-changed-tests }}+ steps:+ - id: dynamic-ci+ uses: trunk-io/dynamic-ci@5bcddbf3615c2b032c21eed1b514c91164bda4a8 # v1 (v0.1.7)+ with:+ token: ${{ secrets.TRUNK_API_TOKEN }}+ job-keys: security-regressions,native-locks,persistence-validation,stress-changed-tests+ enable-annotation: 'true'+# Planning gate for the native platform matrix. Pull requests that touch# native, lock, IPC, publication, backup, export or sync paths run every# native target on the primary Bun version; other pull requests run the Linux@@ -233,8 +264,10 @@ jobs:echo "Scanning commit range: $RANGE"gitleaks detect --redact --no-banner --log-opts "$RANGE"+ # Gated by dynamic-ci (docs/ci-event-parity.md#trunk-dynamic-ci): runs unless Trunk's verdict is 'false'.security-regressions:- if: ${{ github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base) }}+ needs: [dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.security-regressions != 'false' && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base)) }}runs-on: ${{ matrix.os == 'ubuntu-latest' && 'ubicloud-standard-2-ubuntu-2404' || matrix.os }}timeout-minutes: 10strategy:@@ -1046,9 +1079,10 @@ jobs:# Event parity (docs/ci-event-parity.md#full-ci-on-pull-requests): a pull request (cheap# tier) runs the native cells only when its diff touches native code (scope other# than smoke); the full-ci dispatch, every push and the nightly run them all.+ # Gated by dynamic-ci (docs/ci-event-parity.md#trunk-dynamic-ci): runs unless Trunk's verdict is 'false'.native-locks:- needs: [changes]- if: ${{ needs.changes.outputs.reuse != 'true' && ((github.event_name != 'pull_request' || needs.changes.outputs.native-scope != 'smoke') && (github.event_name != 'workflow_dispatch' || (inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base))) }}+ needs: [changes, dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.native-locks != 'false' && needs.changes.result == 'success' && needs.changes.outputs.reuse != 'true' && ((github.event_name != 'pull_request' || needs.changes.outputs.native-scope != 'smoke') && (github.event_name != 'workflow_dispatch' || (inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base))) }}uses: ./.github/workflows/native-locks.yml# statuses: the darwin-x64 cells' diag/native-heartbeat/<cell> commit statuses (native-locks.yml); actions: read for its# heartbeat-finalize job, which reads the run's job conclusions.@@ -1063,9 +1097,10 @@ jobs:# tier) calls it only when its diff can change persistence or managed sync, and# then runs only the crash robot and convergence; the full-ci dispatch, every# push and the nightly run every lane.+ # Gated by dynamic-ci (docs/ci-event-parity.md#trunk-dynamic-ci): runs unless Trunk's verdict is 'false'.persistence-validation:- needs: [changes]- if: ${{ needs.changes.outputs.reuse != 'true' && ((github.event_name != 'pull_request' || needs.changes.outputs.convergence != 'skip') && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base))) }}+ needs: [changes, dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.persistence-validation != 'false' && needs.changes.result == 'success' && needs.changes.outputs.reuse != 'true' && ((github.event_name != 'pull_request' || needs.changes.outputs.convergence != 'skip') && (github.event_name != 'workflow_dispatch' || (inputs.native_only != true && inputs.race_hunt != true && !inputs.stress_files && !inputs.stress_base))) }}uses: ./.github/workflows/persistence-validation.ymlwith:convergence: ${{ needs.changes.outputs.convergence || 'run' }}@@ -1076,9 +1111,12 @@ jobs:# (docs/TESTING.md#event-parity): outside pull_request and merge_group it# succeeds with "not a PR event", since push and nightly runs execute every# file. Its conclusion is success or failure, never skipped, so test-status- # gates on it.+ # gates on it. Gated by dynamic-ci (docs/ci-event-parity.md#trunk-dynamic-ci):+ # on a pull request it runs unless Trunk's verdict is 'false'; every other event+ # runs it as before.stress-changed-tests:- if: ${{ github.event_name != 'workflow_dispatch' || inputs.native_only != true }}+ needs: [dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.stress-changed-tests != 'false' && (github.event_name != 'workflow_dispatch' || inputs.native_only != true) }}permissions:contents: readissues: read@@ -1349,7 +1387,7 @@ jobs:# every other event runs the full profile and reports full-suite instead.cheap-tier:name: cheap-tier (full suite not run)- needs: [changes, gitleaks, security-regressions, dependency-audit, verify, typecheck, stress-changed-tests, native-locks, persistence-validation]+ needs: [changes, dynamic-ci, gitleaks, security-regressions, dependency-audit, verify, typecheck, stress-changed-tests, native-locks, persistence-validation]if: ${{ always() && github.event_name == 'pull_request' }}runs-on: ubicloud-standard-2-ubuntu-2404timeout-minutes: 5@@ -1371,6 +1409,10 @@ jobs:NATIVE_SCOPE: ${{ needs.changes.outputs.native-scope }}PERSISTENCE: ${{ needs.persistence-validation.result }}CONVERGENCE: ${{ needs.changes.outputs.convergence }}+ DCI_SECURITY: ${{ needs.dynamic-ci.outputs.security-regressions }}+ DCI_STRESS: ${{ needs.dynamic-ci.outputs.stress-changed-tests }}+ DCI_NATIVE: ${{ needs.dynamic-ci.outputs.native-locks }}+ DCI_PERSISTENCE: ${{ needs.dynamic-ci.outputs.persistence-validation }}run: bash scripts/ci-cheap-tier.sh# Master-push reuse marker (scripts/ci-reuse.ts, scripts/release-gate.ts): existsdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex c10b78f628..041b6f76cf 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,17 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**Trunk Dynamic CI on the pull-request tier, in Learning mode. A `dynamic-ci` job asks Trunk which of the slow, nearly always green pull-request jobs a push still needs; every job still runs until enforcement is switched on in Trunk.**++### Pull-request CI++- `test.yml` gates `security-regressions` (with its Windows and macOS cells), `native-locks`, `persistence-validation` and `stress-changed-tests`, and `scale-tier.yml` gates `scale`. Together they used about 39,000 runner-minutes on pull requests in the week to 2026-11-04.+- The filter runs only on pull requests and fails open: no token, a Trunk outage or a job without a verdict runs the job. Pushes to master, the merge queue, schedules and the full-ci dispatch skip the filter and run every job as before, so `full-suite`, `e2e-full-suite` and ci-reuse are unchanged.+- `cheap-tier` accepts a gated lane that skipped only when Trunk's verdict for it was exactly `false`.+- New guard `check:dynamic-ci` (in `bun run verify`) fails when the filter can run on another event or a gated job loses the fail-open `!cancelled() && != 'false'` form. See [docs/ci-event-parity.md](docs/ci-event-parity.md#trunk-dynamic-ci).+## [0.60.575.0] - 2026-11-04**Train R, seven pull requests in one release. Searches that name a page by an identifier (`#412`, `INV-2026-00417`) or a handle (`dan-example`) now find it. New `gbrain find` / `find_pages` finds a page by name, path prefix or glob, and `gbrain stats --by source,type` counts pages by kind. `query --explain-target --json` carries its diagnosis. There's an opt-in keyword phrase factor (off by default), an advisory harness check on pull requests, new docs, and guardrails for the embedded core.**diff --git a/docs/ci-event-parity.md b/docs/ci-event-parity.mdindex 502a98873e..b058839169 100644--- a/docs/ci-event-parity.md+++ b/docs/ci-event-parity.md@@ -49,6 +49,7 @@ checks ([below](#full-ci-on-pull-requests)), never per-cell matrix names.| `fix-wave-gate.yml`, `fix-wave-closeout.yml` | Pull-request action and merge state | Not a test scope: merge-process automation | — || `harness-check.yml` | `pull_request` only; a missing `HARNESS_EVALS_READ_TOKEN` skips the job (succeeds with a notice); a fork head is refused | Named exception: advisory, non-required check ([below](#harness-check)) | None: pushes to master and schedules do not run it; the pin bump runs its steps by hand on master || `full-ci.yml` | `full-ci` label, later pushes to a labeled pull request, same-repository head | Not a test scope: dispatches the full profile on the head | — |+| `test.yml`, `scale-tier.yml` | `dynamic-ci` filter (Trunk Dynamic CI) on pull requests; its gated jobs run unless the verdict is exactly `'false'` | Named exception ([below](#trunk-dynamic-ci)): pull requests only, Learning mode skips nothing | The full-ci dispatch, every push to master, the merge queue and the nightly schedules, which never run the filter |## Full CI on pull requests@@ -338,3 +339,13 @@ a week, the agent on release duty records it on the CI health issue.Measured by hand on 2026-10-26 against master at `b06ac32b` (0.60.465.0) on a 2-core, 7 GB Linux machine (Docker 29.9.2, bun 1.4.4): image build 359 s, check 59 s (30 assertions passed, 0 failed, 0 pin diffs, cross-scope pages 0), 457 s end to end. A CI runner is not measured yet. The pin moved to v0.0.59 on 2026-10-31: v0.0.9 failed to build its image against master once `gbrain setup hermes --instructions-only` began writing the shell-hooks allowlist lock; v0.0.59 against the train R head (`32f1748a`) built and passed (37 assertions, 0 failed, 0 pin diffs, cross-scope pages 0, check 62 s).**Bumping the harness-evals pin.** The pin is one line in the workflow, `HARNESS_EVALS_PIN`, and it must be a commit on harness-evals main. To move it, read the new head with `git ls-remote https://github.com/garrytan/harness-evals refs/heads/main`, run the workflow's steps once by hand against master with the new pin (clone at the pin, `bun install --frozen-lockfile`, `scripts/build-gbrain-image.sh`, `scripts/gbrain-check.ts --no-build`, then the gate step's shell), and read its last lines (`gate passed` and the warning count). Then change the line and open the bump as its own pull request, so the first run under the new pin is on a commit whose gbrain did not change. A pin diff reported as a warning after a deliberate gbrain change is fixed on the harness-evals side (its `gbrain/pin.json`), and the bump that follows picks it up.++## Trunk Dynamic CI++Trunk Dynamic CI (private beta; [docs](https://docs.trunk.io/ci/dynamic-ci)) decides per pull-request push which jobs still need to run, from this repository's own CI history. A `dynamic-ci` job in `test.yml` and in `scale-tier.yml` runs `trunk-io/dynamic-ci` (pinned to v1) with the `TRUNK_API_TOKEN` repository secret and writes one output per gated job.++- **Gated jobs.** `test.yml`: `security-regressions` (including the Windows and macOS cells), `native-locks`, `persistence-validation` and `stress-changed-tests`. `scale-tier.yml`: `scale`. They were chosen from the seven days before 2026-11-04 as the pull-request jobs that take minutes and nearly always pass. `changes`, `gitleaks`, `dependency-audit`, `verify`, `typecheck`, `semgrep`, the scale `plan` and the aggregates are not gated.+- **Form.** A gated job lists `dynamic-ci` in `needs` and its `if` starts `!cancelled() && needs.dynamic-ci.outputs.<job key> != 'false' &&`, followed by `needs.<other>.result == 'success'` for every other job it needs and then its original condition. `!cancelled()` keeps a skipped or failed filter from skipping the job, `!= 'false'` makes an empty output (no token, a Trunk outage, no verdict yet) run it, and the `result == 'success'` checks keep what the implicit `success()` did before.+- **Events.** The filter's `if` is `github.event_name == 'pull_request'`. On a push, merge-queue entry, schedule or dispatch (the full-ci run) it is skipped, every output is empty, and every gated job runs exactly as before, so `full-suite`, `e2e-full-suite` and the ci-reuse evidence are unchanged. `e2e.yml` has no pull-request trigger and no filter.+- **Modes.** A repository starts in Learning mode: Trunk records a verdict for every gated job and skips nothing. Enforcement is the Mode dropdown in the repository's row on the Dynamic CI settings page in the Trunk web app (app.trunk.io), not this file; Learning mode can also enforce only for listed engineers or labels (the Allow list column). Under enforcement `cheap-tier` accepts a gated lane that skipped only when its verdict was exactly `'false'` (`scripts/ci-cheap-tier.sh`). `stress-changed-tests` repeats changed tests only on pull requests (no full run repeats them), so a skip there removes that check for the push.+- **Guard.** `scripts/check-dynamic-ci.ts` (in `bun run verify`) fails when a filter job can run on another event, sits in a workflow without a pull-request trigger, is not SHA-pinned, or exports outputs that differ from its `job-keys`; when a gated job's `if` lacks the form above; and when a merge or release aggregate is gated.diff --git a/package.json b/package.jsonindex 6408b499fd..63c2532752 100644--- a/package.json+++ b/package.json@@ -164,6 +164,7 @@"check:ai-sdk-importers": "bun scripts/check-ai-sdk-importers.ts","check:durable-flush": "bun scripts/check-durable-flush.ts","check:schema-error-predicates": "bun scripts/check-schema-error-predicates.ts",+ "check:dynamic-ci": "bun scripts/check-dynamic-ci.ts","check:windows-hide": "bun scripts/check-windows-hide.ts","check:engine-sql-ratchet": "bun scripts/check-engine-sql-ratchet.ts","check:core-world-reads": "bun scripts/check-core-world-reads.ts",diff --git a/scripts/check-dynamic-ci.ts b/scripts/check-dynamic-ci.tsnew file mode 100644index 0000000000..388da23e38--- /dev/null+++ b/scripts/check-dynamic-ci.ts@@ -0,0 +1,110 @@+#!/usr/bin/env bun+/**+ * Trunk Dynamic CI wiring guard (registered in scripts/guards-manifest.tsv;+ * docs/ci-event-parity.md#trunk-dynamic-ci).+ *+ * A filter job runs trunk-io/dynamic-ci and writes one output per gated job;+ * a gated job runs unless its output is exactly 'false'. Merge and release+ * evidence (the full-ci dispatch, master pushes, the merge queue, schedules)+ * must never be filtered, and a filter outage must never skip a job. So, in+ * every workflow under .github/workflows:+ *+ * - a filter job (any job with a trunk-io/dynamic-ci step) runs only with+ * `if: github.event_name == 'pull_request'`, in a workflow that has a+ * pull_request trigger, with the action pinned to a commit SHA, the token+ * from secrets.TRUNK_API_TOKEN, and `job-keys` naming exactly the jobs+ * its `outputs` re-export as `steps.<id>.outputs.<key>`;+ * - a gated job (one whose key is a filter output and that needs the filter)+ * has an `if` that starts `!cancelled() && needs.<filter>.outputs.<key>+ * != 'false' &&`, requires `needs.<other>.result == 'success'` for each+ * other job it needs (what the implicit success() checked before), and+ * uses no other status function;+ * - every other job that needs a filter only reads its outputs: its `if`+ * starts with always(), and it is not a filter output;+ * - every filter output is a job that needs that filter, and no merge or+ * release aggregate (full-suite, e2e-full-suite, test-status, e2e-status,+ * executed-receipts, reused-full-suite, cheap-tier) is gated.+ *+ * Fix: copy the form of an existing gated job in .github/workflows/test.yml.+ * Seam: GBRAIN_GUARD_ROOT (fixture tree root).+ */+import { existsSync, readdirSync, readFileSync } from 'node:fs';+import { join } from 'node:path';+import { load } from 'js-yaml';++type Step = { id?: string; uses?: string; with?: Record<string, unknown> };+type Job = { if?: unknown; needs?: string | string[]; outputs?: Record<string, unknown>; steps?: Step[] };+type Workflow = { on?: unknown; jobs?: Record<string, Job> };++const ROOT = process.env.GBRAIN_GUARD_ROOT ?? join(import.meta.dir, '..');+const ACTION = 'trunk-io/dynamic-ci@';+const NEVER_GATED = new Set(['full-suite', 'e2e-full-suite', 'test-status', 'e2e-status', 'executed-receipts', 'reused-full-suite', 'cheap-tier']);++const expr = (value: unknown) => String(value ?? '').trim().replace(/^\$\{\{\s*([\s\S]*?)\s*\}\}$/, '$1').replace(/\s+/g, ' ');+const needsOf = (job: Job) => (job.needs === undefined ? [] : Array.isArray(job.needs) ? job.needs : [job.needs]);+const hasPullRequest = (on: unknown) =>+ on === 'pull_request' || (Array.isArray(on) && on.includes('pull_request')) || (typeof on === 'object' && on !== null && 'pull_request' in on);++export function checkWorkflow(file: string, doc: Workflow): string[] {+ const problems: string[] = [];+ const jobs = doc.jobs ?? {};+ const filters = new Map<string, { stepId: string; outputs: string[] }>();+ for (const [key, job] of Object.entries(jobs)) {+ const step = (job.steps ?? []).find(s => typeof s.uses === 'string' && s.uses.startsWith(ACTION));+ if (!step) continue;+ const at = `${file} › ${key}`;+ if (expr(job.if) !== "github.event_name == 'pull_request'") problems.push(`${at}: the filter job must have if: github.event_name == 'pull_request' (got ${JSON.stringify(expr(job.if))}); on any other event it must be skipped so every gated job runs`);+ if (!hasPullRequest(doc.on)) problems.push(`${at}: the workflow has no pull_request trigger, so it carries merge or release evidence and must not filter jobs`);+ if (!/^trunk-io\/dynamic-ci@[0-9a-f]{40}$/.test(step.uses!)) problems.push(`${at}: pin ${step.uses} to a full commit SHA`);+ if (String(step.with?.token ?? '').trim() !== '${{ secrets.TRUNK_API_TOKEN }}') problems.push(`${at}: the token must be \${{ secrets.TRUNK_API_TOKEN }}`);+ if (!step.id) { problems.push(`${at}: the dynamic-ci step needs an id`); continue; }+ const outputs = Object.keys(job.outputs ?? {}).sort();+ const keys = String(step.with?.['job-keys'] ?? '').split(',').map(k => k.trim()).filter(Boolean).sort();+ if (JSON.stringify(keys) !== JSON.stringify(outputs)) problems.push(`${at}: job-keys [${keys.join(', ')}] must name exactly the re-exported outputs [${outputs.join(', ')}]`);+ for (const out of outputs) {+ const want = `\${{ steps.${step.id}.outputs.${out} }}`;+ if (String(job.outputs![out]).trim() !== want) problems.push(`${at}: output ${out} must be ${want}`);+ }+ filters.set(key, { stepId: step.id, outputs });+ }+ for (const [filter, { outputs }] of filters) {+ for (const out of outputs) {+ if (!jobs[out]) problems.push(`${file} › ${filter}: output ${out} names no job`);+ else if (!needsOf(jobs[out]!).includes(filter)) problems.push(`${file} › ${out}: a gated job must list ${filter} in needs`);+ if (NEVER_GATED.has(out)) problems.push(`${file} › ${out}: merge and release aggregates are never gated by Dynamic CI`);+ }+ }+ for (const [key, job] of Object.entries(jobs)) {+ const needs = needsOf(job);+ for (const filter of needs.filter(n => filters.has(n))) {+ const at = `${file} › ${key}`;+ const condition = expr(job.if);+ if (!filters.get(filter)!.outputs.includes(key)) {+ if (!condition.startsWith('always()')) problems.push(`${at}: needs ${filter} but is not one of its outputs; only an aggregate whose if starts with always() may read the verdicts`);+ continue;+ }+ const prefix = `!cancelled() && needs.${filter}.outputs.${key} != 'false' && `;+ if (!condition.startsWith(prefix)) {+ problems.push(`${at}: a gated job's if must start with "${prefix}" (got ${JSON.stringify(condition)}); without !cancelled() a skipped or failed filter skips the job, and only an exact 'false' verdict may skip it`);+ continue;+ }+ const rest = condition.slice(prefix.length);+ if (/\b(?:always|success|failure|cancelled)\(\)/.test(rest)) problems.push(`${at}: no other status function may follow the gate prefix`);+ for (const other of needs.filter(n => n !== filter)) {+ if (!rest.includes(`needs.${other}.result == 'success'`)) problems.push(`${at}: add needs.${other}.result == 'success' after the gate prefix; !cancelled() drops the implicit success() that kept the job from running when ${other} failed`);+ }+ }+ }+ return problems;+}++if (import.meta.main) {+ const dir = join(ROOT, '.github/workflows');+ const files = existsSync(dir) ? readdirSync(dir).filter(f => /\.ya?ml$/.test(f)).sort() : [];+ const problems = files.flatMap(f => checkWorkflow(f, load(readFileSync(join(dir, f), 'utf8')) as Workflow));+ if (problems.length) {+ console.error(`check-dynamic-ci: ${problems.length} problem(s)\n${problems.map(p => ` ✗ ${p}`).join('\n')}\nFix: copy the form of an existing gated job in .github/workflows/test.yml (docs/ci-event-parity.md#trunk-dynamic-ci).`);+ process.exit(1);+ }+ console.log(`check-dynamic-ci: ok (${files.length} workflows)`);+}diff --git a/scripts/ci-cheap-tier.sh b/scripts/ci-cheap-tier.shindex 8e6038616f..433530eba0 100755--- a/scripts/ci-cheap-tier.sh+++ b/scripts/ci-cheap-tier.sh@@ -5,28 +5,37 @@# Every cheap lane must succeed. The native and persistence lanes may be# skipped only when their selector left them out (native scope smoke,# convergence skip); a selected lane that skipped, failed or was cancelled-# fails the tier. The step summary always says the full suite did not run.+# fails the tier. A lane gated by Trunk Dynamic CI (DCI_SECURITY DCI_STRESS+# DCI_NATIVE DCI_PERSISTENCE, docs/ci-event-parity.md#trunk-dynamic-ci) may also+# be skipped when its verdict is exactly 'false'; Learning mode never says+# 'false'. The step summary always says the full suite did not run.set -euo pipefailfail=0-for pair in "gitleaks=${GITLEAKS:-}" "security-regressions=${SECURITY:-}" "dependency-audit=${AUDIT:-}" \- "verify=${VERIFY:-}" "typecheck=${TYPECHECK:-}" "stress-changed-tests=${STRESS:-}"; do- name=${pair%%=*} result=${pair#*=}+trunk_skipped() {+ [ "$1" = skipped ] && [ "$2" = false ] || return 1+ echo " skipped by Trunk Dynamic CI (verdict false)"+}+for row in "gitleaks|${GITLEAKS:-}|" "security-regressions|${SECURITY:-}|${DCI_SECURITY:-}" "dependency-audit|${AUDIT:-}|" \+ "verify|${VERIFY:-}|" "typecheck|${TYPECHECK:-}|" "stress-changed-tests|${STRESS:-}|${DCI_STRESS:-}"; do+ IFS='|' read -r name result verdict <<< "$row"echo "$name=$result"+ if trunk_skipped "$result" "$verdict"; then continue; fiif [ "$result" != success ]; then echo "✗ $name did not succeed (got $result)"; fail=1; fidonelane() {- local name=$1 result=$2 selected=$3+ local name=$1 result=$2 selected=$3 verdict=$4echo "$name=$result (selected=$selected)"if [ "$result" = success ]; then return 0; fiif [ "$result" = skipped ] && [ "$selected" = no ]; then return 0; fi+ if trunk_skipped "$result" "$verdict"; then return 0; fiecho "✗ $name did not succeed (got $result, selected=$selected)"fail=1}[ "${NATIVE_SCOPE:-}" = smoke ] && native_selected=no || native_selected=yes[ "${CONVERGENCE:-}" = skip ] && persistence_selected=no || persistence_selected=yes-lane native-locks "${NATIVE:-}" "$native_selected"-lane persistence-validation "${PERSISTENCE:-}" "$persistence_selected"+lane native-locks "${NATIVE:-}" "$native_selected" "${DCI_NATIVE:-}"+lane persistence-validation "${PERSISTENCE:-}" "$persistence_selected" "${DCI_PERSISTENCE:-}"{echo "## Full suite not run"diff --git a/scripts/guards-manifest.tsv b/scripts/guards-manifest.tsvindex 3921e0c108..b8f6756e90 100644--- a/scripts/guards-manifest.tsv+++ b/scripts/guards-manifest.tsv@@ -105,3 +105,4 @@ check-write-gate-regex.ts scanner yes #5575 ENG-16: write-gate detector patternscheck-chunk-visibility.ts scanner yes Wave B segmented storage (spec 4.2, TS AST): every FROM/JOIN content_chunks statement in src uses chunkVisibleFilter (or its generation siblings) or carries -- chunk-visibility-ok: <reason>; per-file uncovered counts in scripts/chunk-visibility-baseline.tsv only shrink; --prune lowers rowscheck-file-url-pathname.sh scanner yes #6845: a file URL .pathname in test/ keeps %20 escapes; GBRAIN_GUARD_ROOT seam; skips test/fixtures/guards/check-derived-census.ts scanner yes GBRA-161: per-file soft-delete sites (softDeletePage(s), retireDerivedPages(InTransaction), UPDATE pages ... deleted_at =) need a reviewed row with a class in docs/architecture/derived-census.tsv; growth, stale (ceiling above count) and unknown classes fail; --prune lowers ceilings+check-dynamic-ci.ts scanner yes Trunk Dynamic CI (docs/ci-event-parity.md#trunk-dynamic-ci): a trunk-io/dynamic-ci filter job runs only on pull_request in a workflow with that trigger, SHA-pinned, token from secrets.TRUNK_API_TOKEN, job-keys equal to its outputs; a gated job starts its if with !cancelled() && needs.<filter>.outputs.<key> != 'false' and checks each other need succeeded; merge and release aggregates are never gated; GBRAIN_GUARD_ROOT seam; bad-* fixtures cover a filter on every event and a dropped other-needs checkdiff --git a/scripts/run-verify-parallel.sh b/scripts/run-verify-parallel.shindex 8953207dfe..7901b11e86 100755--- a/scripts/run-verify-parallel.sh+++ b/scripts/run-verify-parallel.sh@@ -186,6 +186,9 @@ CHECKS=(# Wave 18b: a missing column/table reads as "pre-migration" only when the# handler names it (isMissingSchemaObject); broad predicates are allowlisted."check:schema-error-predicates"+ # Trunk Dynamic CI: the filter runs only on pull_request and every gated job+ # keeps the fail-open !cancelled() && != 'false' form.+ "check:dynamic-ci"# #4992: subprocess launches go through src/core/spawn.ts (windowsHide# default); NOT_YET_MIGRATED is a ratchet that only shrinks."check:windows-hide"diff --git a/test/fixtures/guards/check-dynamic-ci.ts/bad-every-event/.github/workflows/ci.yml b/test/fixtures/guards/check-dynamic-ci.ts/bad-every-event/.github/workflows/ci.ymlnew file mode 100644index 0000000000..eb9fdb2b84--- /dev/null+++ b/test/fixtures/guards/check-dynamic-ci.ts/bad-every-event/.github/workflows/ci.yml@@ -0,0 +1,26 @@+name: CI+on:+ pull_request: {}+ push:+ branches: [master]+jobs:+ dynamic-ci:+ runs-on: ubuntu-latest+ outputs:+ unit: ${{ steps.dynamic-ci.outputs.unit }}+ steps:+ - id: dynamic-ci+ uses: trunk-io/dynamic-ci@5bcddbf3615c2b032c21eed1b514c91164bda4a8+ with:+ token: ${{ secrets.TRUNK_API_TOKEN }}+ job-keys: unit+ plan:+ runs-on: ubuntu-latest+ steps:+ - run: echo plan+ unit:+ needs: [plan, dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.unit != 'false' && needs.plan.result == 'success' }}+ runs-on: ubuntu-latest+ steps:+ - run: echo unitdiff --git a/test/fixtures/guards/check-dynamic-ci.ts/bad-other-needs/.github/workflows/ci.yml b/test/fixtures/guards/check-dynamic-ci.ts/bad-other-needs/.github/workflows/ci.ymlnew file mode 100644index 0000000000..72e5d89f42--- /dev/null+++ b/test/fixtures/guards/check-dynamic-ci.ts/bad-other-needs/.github/workflows/ci.yml@@ -0,0 +1,27 @@+name: CI+on:+ pull_request: {}+ push:+ branches: [master]+jobs:+ dynamic-ci:+ if: github.event_name == 'pull_request'+ runs-on: ubuntu-latest+ outputs:+ unit: ${{ steps.dynamic-ci.outputs.unit }}+ steps:+ - id: dynamic-ci+ uses: trunk-io/dynamic-ci@5bcddbf3615c2b032c21eed1b514c91164bda4a8+ with:+ token: ${{ secrets.TRUNK_API_TOKEN }}+ job-keys: unit+ plan:+ runs-on: ubuntu-latest+ steps:+ - run: echo plan+ unit:+ needs: [plan, dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.unit != 'false' }}+ runs-on: ubuntu-latest+ steps:+ - run: echo unitdiff --git a/test/fixtures/guards/check-dynamic-ci.ts/bad/.github/workflows/ci.yml b/test/fixtures/guards/check-dynamic-ci.ts/bad/.github/workflows/ci.ymlnew file mode 100644index 0000000000..0ac9edca91--- /dev/null+++ b/test/fixtures/guards/check-dynamic-ci.ts/bad/.github/workflows/ci.yml@@ -0,0 +1,27 @@+name: CI+on:+ pull_request: {}+ push:+ branches: [master]+jobs:+ dynamic-ci:+ if: github.event_name == 'pull_request'+ runs-on: ubuntu-latest+ outputs:+ unit: ${{ steps.dynamic-ci.outputs.unit }}+ steps:+ - id: dynamic-ci+ uses: trunk-io/dynamic-ci@5bcddbf3615c2b032c21eed1b514c91164bda4a8+ with:+ token: ${{ secrets.TRUNK_API_TOKEN }}+ job-keys: unit+ plan:+ runs-on: ubuntu-latest+ steps:+ - run: echo plan+ unit:+ needs: [plan, dynamic-ci]+ if: ${{ needs.dynamic-ci.outputs.unit != 'false' && needs.plan.result == 'success' }}+ runs-on: ubuntu-latest+ steps:+ - run: echo unitdiff --git a/test/fixtures/guards/check-dynamic-ci.ts/good/.github/workflows/ci.yml b/test/fixtures/guards/check-dynamic-ci.ts/good/.github/workflows/ci.ymlnew file mode 100644index 0000000000..8980d3724f--- /dev/null+++ b/test/fixtures/guards/check-dynamic-ci.ts/good/.github/workflows/ci.yml@@ -0,0 +1,27 @@+name: CI+on:+ pull_request: {}+ push:+ branches: [master]+jobs:+ dynamic-ci:+ if: github.event_name == 'pull_request'+ runs-on: ubuntu-latest+ outputs:+ unit: ${{ steps.dynamic-ci.outputs.unit }}+ steps:+ - id: dynamic-ci+ uses: trunk-io/dynamic-ci@5bcddbf3615c2b032c21eed1b514c91164bda4a8+ with:+ token: ${{ secrets.TRUNK_API_TOKEN }}+ job-keys: unit+ plan:+ runs-on: ubuntu-latest+ steps:+ - run: echo plan+ unit:+ needs: [plan, dynamic-ci]+ if: ${{ !cancelled() && needs.dynamic-ci.outputs.unit != 'false' && needs.plan.result == 'success' }}+ runs-on: ubuntu-latest+ steps:+ - run: echo unitdiff --git a/test/scripts/check-dynamic-ci.test.ts b/test/scripts/check-dynamic-ci.test.tsnew file mode 100644index 0000000000..c8b07ecc68--- /dev/null+++ b/test/scripts/check-dynamic-ci.test.ts@@ -0,0 +1,47 @@+/**+ * scripts/check-dynamic-ci.ts (docs/ci-event-parity.md#trunk-dynamic-ci): the+ * Trunk Dynamic CI filter runs only on pull_request, fails open, and gates only+ * jobs whose if keeps the !cancelled() && != 'false' form. Each case breaks the+ * real test.yml one way and expects the guard to name it; the real tree passes.+ */+import { describe, expect, test } from 'bun:test';+import { spawnSync } from 'node:child_process';+import { readFileSync } from 'node:fs';+import { join, resolve } from 'node:path';+import { load } from 'js-yaml';+import { checkWorkflow } from '../../scripts/check-dynamic-ci.ts';++const REPO = resolve(import.meta.dir, '..', '..');+type Doc = { on: Record<string, unknown>; jobs: Record<string, Record<string, any>> };+const real = (name: string) => load(readFileSync(join(REPO, '.github/workflows', name), 'utf8')) as Doc;+const broken = (mutate: (doc: Doc) => void, name = 'test.yml') => { const doc = structuredClone(real(name)); mutate(doc); return checkWorkflow(name, doc); };+const filterStep = (doc: Doc) => doc.jobs['dynamic-ci']!.steps.find((s: { uses?: string }) => s.uses?.startsWith('trunk-io/dynamic-ci@'));++describe('check-dynamic-ci.ts', () => {+ test('the real workflows pass', () => {+ const r = spawnSync(process.execPath, [join(REPO, 'scripts/check-dynamic-ci.ts')], { encoding: 'utf8', env: { ...process.env, GBRAIN_GUARD_ROOT: '' } });+ expect(r.status, r.stderr).toBe(0);+ expect(checkWorkflow('test.yml', real('test.yml'))).toEqual([]);+ expect(checkWorkflow('scale-tier.yml', real('scale-tier.yml'))).toEqual([]);+ });++ test.each<[string, (doc: Doc) => void, RegExp]>([+ ['the filter runs on every event', doc => { delete doc.jobs['dynamic-ci']!.if; }, /must have if: github.event_name == 'pull_request'/],+ ['the filter also runs on pushes', doc => { doc.jobs['dynamic-ci']!.if = "github.event_name == 'pull_request' || github.event_name == 'push'"; }, /must have if: github.event_name == 'pull_request'/],+ ['the filter is in a workflow without a pull_request trigger', doc => { delete doc.on.pull_request; }, /no pull_request trigger/],+ ['the action is not pinned to a SHA', doc => { filterStep(doc).uses = 'trunk-io/dynamic-ci@v1'; }, /full commit SHA/],+ ['the token is not the repo secret', doc => { filterStep(doc).with.token = 'abc'; }, /secrets\.TRUNK_API_TOKEN/],+ ['job-keys and outputs disagree', doc => { filterStep(doc).with['job-keys'] = 'native-locks'; }, /job-keys \[native-locks\] must name exactly/],+ ['an output reads the wrong step output', doc => { doc.jobs['dynamic-ci']!.outputs['native-locks'] = '${{ steps.dynamic-ci.outputs.verify }}'; }, /output native-locks must be/],+ ['a gated job drops !cancelled()', doc => { doc.jobs['stress-changed-tests']!.if = doc.jobs['stress-changed-tests']!.if.replace('!cancelled() && ', ''); }, /stress-changed-tests: a gated job's if must start with/],+ ['a gated job tests == true instead of != false', doc => { doc.jobs['native-locks']!.if = doc.jobs['native-locks']!.if.replace("!= 'false'", "== 'true'"); }, /native-locks: a gated job's if must start with/],+ ['a gated job drops its other needs check', doc => { doc.jobs['persistence-validation']!.if = doc.jobs['persistence-validation']!.if.replace("needs.changes.result == 'success' && ", ''); }, /add needs\.changes\.result == 'success'/],+ ['a gated job adds always()', doc => { doc.jobs['security-regressions']!.if = doc.jobs['security-regressions']!.if.replace("!= 'false' && ", "!= 'false' && always() && "); }, /no other status function/],+ ['a gated job forgets to need the filter', doc => { doc.jobs['security-regressions']!.needs = []; }, /security-regressions: a gated job must list dynamic-ci in needs/],+ ['an aggregate is gated', doc => { doc.jobs['dynamic-ci']!.outputs['full-suite'] = '${{ steps.dynamic-ci.outputs.full-suite }}'; filterStep(doc).with['job-keys'] += ',full-suite'; }, /full-suite: merge and release aggregates are never gated/],+ ['a non-aggregate job reads the verdicts', doc => { doc.jobs.verify!.needs = ['dynamic-ci']; }, /verify: needs dynamic-ci but is not one of its outputs/],+ ])('fails when %s', (_, mutate, message) => {+ const problems = broken(mutate);+ expect(problems.join('\n')).toMatch(message);+ });+});diff --git a/test/scripts/ci-pr-scope.test.ts b/test/scripts/ci-pr-scope.test.tsindex 03dd2089af..71870fa31d 100644--- a/test/scripts/ci-pr-scope.test.ts+++ b/test/scripts/ci-pr-scope.test.ts@@ -11,8 +11,10 @@ type Matrix = Record<string, unknown> & { exclude?: string };type Job = { if?: string; 'runs-on'?: string; strategy?: { matrix: Matrix }; steps?: Array<{ id?: string; run?: string; env?: Record<string, string> }> };const root = join(import.meta.dir, '../..');const load = (name: string) => loadYaml(readFileSync(join(root, '.github/workflows', name), 'utf8')) as { jobs: Record<string, Job> };+// A job gated by Trunk Dynamic CI reads needs['dynamic-ci']: no verdict (the filter skipped off pull requests) runs it.const evaluate = (expression: string, context: Record<string, unknown>) =>- runInNewContext(expression.replace(/^\$\{\{\s*|\s*\}\}$/g, ''), { fromJSON: JSON.parse, ...context }, { timeout: 100 });+ runInNewContext(expression.replace(/^\$\{\{\s*|\s*\}\}$/g, '').replace(/needs\.dynamic-ci\.outputs\.([\w-]+)/g, "needs['dynamic-ci'].outputs['$1']"),+ { fromJSON: JSON.parse, cancelled: () => false, needs: { 'dynamic-ci': { outputs: {} } }, ...context }, { timeout: 100 });function cells(job: Job, context: Record<string, unknown>): string[] {if (job.if && !evaluate(job.if, context)) return [];diff --git a/test/scripts/full-ci-workflow.test.ts b/test/scripts/full-ci-workflow.test.tsindex d8ea751816..290c23066a 100644--- a/test/scripts/full-ci-workflow.test.ts+++ b/test/scripts/full-ci-workflow.test.ts@@ -10,7 +10,7 @@ import { load } from 'js-yaml';// a pull request runs the cheap tier, the full-ci dispatch runs the full suite// on its head, and a master push may reuse a passed full-suite run of its tree.type Step = { name?: string; id?: string; if?: string; run?: string; uses?: string; 'continue-on-error'?: boolean; env?: Record<string, string>; with?: Record<string, string> };-type Job = { if?: string; name?: string; needs?: string[] | string; permissions?: Record<string, string>; steps?: Step[] };+type Job = { if?: string; name?: string; needs?: string[] | string; outputs?: Record<string, string>; permissions?: Record<string, string>; steps?: Step[] };type Workflow = { on: Record<string, { types?: string[]; branches?: string[] } | null>; permissions?: unknown; jobs: Record<string, Job> };const root = join(import.meta.dir, '../..');const workflow = (name: string) => load(readFileSync(join(root, '.github/workflows', name), 'utf8')) as Workflow;@@ -18,22 +18,24 @@ const unit = workflow('test.yml');const e2e = workflow('e2e.yml');const dispatcher = workflow('full-ci.yml');-type Context = { event: string; inputs?: Record<string, unknown>; outputs?: Record<string, string>; action?: string; label?: string; pr?: Record<string, unknown> };+type Context = { event: string; inputs?: Record<string, unknown>; outputs?: Record<string, string>; action?: string; label?: string; pr?: Record<string, unknown>;+ verdicts?: Record<string, string>; changes?: string };function evaluate(expression: string, context: Context): unknown {const js = expression.replace(/^\$\{\{\s*|\s*\}\}$/g, '')- .replace(/needs\.prepare-e2e\./g, "needs['prepare-e2e'].")+ .replace(/needs\.(\w+(?:-\w+)+)\./g, (_, job) => `needs['${job}'].`).replace(/outputs\.(\w+(?:-\w+)+)/g, (_, key) => `outputs['${key}']`).replace(/labels\.\*\.name/g, 'labels.map(label => label.name)');const outputs = { 'native-scope': 'full', convergence: 'run', reuse: '', ...context.outputs };return runInNewContext(js, {always: () => true,+ cancelled: () => false,contains: (list: unknown[], item: unknown) => list.includes(item),format: (f: string, ...a: unknown[]) => f.replace(/\{(\d+)\}/g, (_, i) => String(a[Number(i)])),vars: { GBRAIN_PAID_LANES: '' },github: { event_name: context.event, repository: 'acme-example/gbrain',event: { action: context.action, label: { name: context.label }, pull_request: context.pr ?? {} } },inputs: context.inputs ?? {},- needs: { changes: { outputs }, 'prepare-e2e': { outputs } },+ needs: { changes: { outputs, result: context.changes ?? 'success' }, 'prepare-e2e': { outputs }, 'dynamic-ci': { outputs: context.verdicts ?? {} } },}, { timeout: 100 });}const template = (value: string, context: Context) => value.replace(/\$\{\{(.*?)\}\}/g, (_, expression) => String(evaluate(expression.trim(), context)));@@ -49,13 +51,38 @@ const FULL_ONLY = ['serial-tests', 'slow-brainbench-e2e', 'brainbench', 'slow-endescribe('full CI on pull requests', () => {test('a pull request runs exactly the cheap tier, plus the persistence and native lanes its diff selects', () => {- expect(runs(unit, { event: 'pull_request', outputs: { 'native-scope': 'smoke', convergence: 'skip' } })).toEqual(CHEAP);+ expect(runs(unit, { event: 'pull_request', outputs: { 'native-scope': 'smoke', convergence: 'skip' } })).toEqual([...CHEAP, 'dynamic-ci'].sort());expect(runs(unit, { event: 'pull_request', outputs: { 'native-scope': 'primary', convergence: 'run' } }))- .toEqual([...CHEAP, 'native-locks', 'persistence-validation'].sort());+ .toEqual([...CHEAP, 'dynamic-ci', 'native-locks', 'persistence-validation'].sort());for (const event of ['push', 'merge_group', 'schedule', 'workflow_dispatch']) {const full = runs(unit, { event });for (const job of [...FULL_ONLY, 'native-locks', 'persistence-validation']) expect(full, `${event}: ${job}`).toContain(job);expect(full).not.toContain('cheap-tier');+ expect(full).not.toContain('dynamic-ci');+ }+ });++ // Trunk Dynamic CI (docs/ci-event-parity.md#trunk-dynamic-ci): the filter runs only on pull requests, so every other event+ // sees empty verdicts and runs every gated job; on a pull request only an exact 'false' skips a job, and a gated job still+ // waits for its other needs to succeed.+ test('Dynamic CI skips a gated pull-request lane only on an exact false verdict and never filters another event', () => {+ const gated = Object.keys(unit.jobs['dynamic-ci']!.outputs!).sort();+ expect(gated).toEqual(['native-locks', 'persistence-validation', 'security-regressions', 'stress-changed-tests']);+ const selected = { 'native-scope': 'primary', convergence: 'run' };+ const all = runs(unit, { event: 'pull_request', outputs: selected });+ for (const verdict of ['', 'true']) {+ expect(runs(unit, { event: 'pull_request', outputs: selected, verdicts: Object.fromEntries(gated.map(job => [job, verdict])) }), verdict).toEqual(all);+ }+ for (const job of gated) {+ expect(runs(unit, { event: 'pull_request', outputs: selected, verdicts: { [job]: 'false' } }), job).toEqual(all.filter(name => name !== job));+ }+ for (const event of ['push', 'merge_group', 'schedule', 'workflow_dispatch']) {+ expect(Boolean(evaluate(unit.jobs['dynamic-ci']!.if!, { event })), event).toBe(false);+ for (const job of gated) expect(runs(unit, { event }), `${event}: ${job}`).toContain(job);+ }+ for (const job of ['native-locks', 'persistence-validation']) {+ expect(runs(unit, { event: 'push', changes: 'failure' }), job).not.toContain(job);+ expect(runs(unit, { event: 'pull_request', outputs: selected, changes: 'failure' }), job).not.toContain(job);}});@@ -228,6 +255,13 @@ describe('full CI on pull requests', () => {expect(aggregate({ ...green, NATIVE: 'failure' }).status).toBe(1);expect(aggregate({ ...green, PERSISTENCE: 'cancelled' }).status).toBe(1);});++ test.each([['SECURITY', 'DCI_SECURITY', {}], ['STRESS', 'DCI_STRESS', {}], ['NATIVE', 'DCI_NATIVE', { NATIVE_SCOPE: 'primary' }],+ ['PERSISTENCE', 'DCI_PERSISTENCE', { CONVERGENCE: 'run' }]] as const)('%s may skip only when Trunk Dynamic CI said false', (lane, verdict, selected) => {+ expect(aggregate({ ...green, ...selected, [lane]: 'skipped', [verdict]: 'false' }).status).toBe(0);+ for (const other of ['', 'true']) expect(aggregate({ ...green, ...selected, [lane]: 'skipped', [verdict]: other }).status, other).toBe(1);+ expect(aggregate({ ...green, ...selected, [lane]: 'failure', [verdict]: 'false' }).status).toBe(1);+ });});});