Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(nightly-watch): judge a push run that reused a full-suite run by its source run
garrytan214773734789
diff --git a/docs/architecture/key-files/ci-health-and-test-guards.md b/docs/architecture/key-files/ci-health-and-test-guards.mdindex 7bbd5d511d..84a65ff431 100644--- a/docs/architecture/key-files/ci-health-and-test-guards.md+++ b/docs/architecture/key-files/ci-health-and-test-guards.md@@ -7,7 +7,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL- `scripts/lib/gh-issue.ts` — the GitHub seam shared by the CI watchers. `inert()` makes run-derived text (job, step and test names, error text) safe to show an agent: control characters stripped, length capped, backticks and pipes replaced, mentions and links neutralized; `redactCredentials()` strips user:password from database URLs. `GitHubClient` is the one interface the watchers call (`restClient()` uses `GH_TOKEN`/`GITHUB_TOKEN` in Actions or the authenticated `gh api` locally; `download()` reads artifact archives without forwarding the token to blob storage). `findIssueByTitle` finds an issue by label and exact title, open first, else the most recently updated closed one; `listLabeled`, `getIssue` and `linkedPulls` (PRs cross-referencing an issue) back master-red and CI health; `fetchArtifactJson` + `readZipEntry` read one JSON file from a run artifact and return a reason instead of throwing.- `.github/workflows/ci-health.yml` + `scripts/ci-health-report.ts` — CI health report. Reads one window (`--days`, default 7, or `--since/--until`, also dispatch inputs) of same-repository pull-request and push-to-master runs of test.yml and e2e.yml (runs, jobs, check-run annotations, issues; never logs, fork runs or fork artifacts), paging the whole window (`listRuns` splits a query over the 1000-result search cap). It reports first-attempt pass rates (`firstAttempt()`), the exit criteria (master >= 95%, PR >= 90%; met, missed or indeterminate when the window cannot be read in full), stress-gate failures, failure classes, cancellation and completion coverage, master-red time to first response, the nightly-watch residual, the test files with the most failure annotations, shard spread and the count of fork runs it did not read; an explicit window with a missed target opens a follow-up issue. Tests: `test/scripts/ci-health-report.test.ts`. Docs: `docs/ci-red-runbook.md#ci-health-report`.- `scripts/lib/master-red.ts` — master-red reconciliation for push-to-master runs of Test and E2E Tests (`PUSH_ALLOWLIST`). Each watch evaluates every completed push run above the high-water mark (`evaluated`: run number, then attempt) stored in the newest `Master red: <workflow>` issue's `master-red:json` block (`applyRun` folds runs; cancelled runs change nothing); a missing or malformed block is rebuilt from the actions API (`pendingRuns`). It opens on red with the suspect range (`suspectRange`: compare plus commit-to-PR lookups), updates while red, closes when every previously failing job (E2E Tests: every failing file, from the manifest) ran and passed with complete evidence, records an incident that opened and closed between watches, and keeps a not-run-since failure open with the manual-close step. A newest issue closed by hand while its block is red ends that incident (`closed_by_hand`): later runs are recorded on it as green, and only a new red run opens a new issue. `externalPass` lets a scheduled run or an issue-bound E2E replay clear failures. Closing without a merged linked repair PR opens `flake` issues (`flakeFor`, `flake:json`); `closeFlakes` closes one after its repair PR merged and a later complete run passed its file and arm. Writes re-read the issue first and re-plan when it moved; a create race closes the newer duplicate. Tests: `test/scripts/nightly-issue.test.ts`. Docs: `docs/ci-red-runbook.md`.-- `scripts/lib/ci-run.ts` — one run's failure evidence (`collectEvidence`): jobs, failing jobs' annotations and, for test.yml and e2e.yml, the `ci-manifest` artifact, returned as structured records (job, step, every failing test file and identity) apart from sanitized excerpts; a cancelled job is not run (listed in `cancelled`) unless its annotation says it timed out, and a red run whose only failures are aggregators of cancelled jobs is `ignored`; with `complete`/`problems` (an unreadable page, annotation or manifest is incomplete evidence, never zero failures). `reproduceCommand` builds `bun run test:stress <file> --iterations 10 [--postgres]` from a validated test path only. `exemptionRows` turns failing identities with an exact test name and signature into the stress gate's `<!-- gbrain-stress-exemption -->` records (backend per `stressBackend`, owner `agent on release duty`), written into master-red, flake and nightly-red bodies; `test/fixtures/nightly-watch/stress-exemption-contract.ts` vendors the gate's parser so the tests prove it accepts them.+- `scripts/lib/ci-run.ts` — one run's failure evidence (`collectEvidence`): jobs, failing jobs' annotations and, for test.yml and e2e.yml, the `ci-manifest` artifact, returned as structured records (job, step, every failing test file and identity) apart from sanitized excerpts; a cancelled job is not run (listed in `cancelled`) unless its annotation says it timed out, and a red run whose only failures are aggregators of cancelled jobs is `ignored`; with `complete`/`problems` (an unreadable page, annotation or manifest is incomplete evidence, never zero failures). A push run with a succeeded `reused-full-suite` job is judged by the run its `reuse.json` names (`checkRecord` from `scripts/ci-reuse.ts`, recorded attempt, identical commit tree): that run's succeeded jobs and complete `ci-manifest` stand in for the push, and any gap is incomplete. `reproduceCommand` builds `bun run test:stress <file> --iterations 10 [--postgres]` from a validated test path only. `exemptionRows` turns failing identities with an exact test name and signature into the stress gate's `<!-- gbrain-stress-exemption -->` records (backend per `stressBackend`, owner `agent on release duty`), written into master-red, flake and nightly-red bodies; `test/fixtures/nightly-watch/stress-exemption-contract.ts` vendors the gate's parser so the tests prove it accepts them.- `scripts/ci-manifest.ts` — the versioned failure and execution manifest (`gbrain-ci-manifest/v1`). The `executed-receipts` job of test.yml and e2e.yml builds it from every lane's receipts (via `scripts/ci-executed-counts.ts`, declared skips from the expected-deltas TSV), binds it to the workflow, event, SHA, run id and attempt, and uploads it as `ci-manifest`; each failure carries the JUnit message (credentials redacted) and the stress gate's `failureSignature` (omitted when the message holds a credential); `checkManifest` refuses a manifest for another run or attempt; `passedFiles` lists files that executed tests and failed none. Docs: `docs/ci-red-runbook.md#ci-failure-manifest`.- `scripts/release-gate.ts` — release.yml's `ci-gate` job. Polls the push-to-master runs of Test and E2E Tests on the release commit and writes `publish`/`sha`: both green publishes; a failed run publishes nothing and fails with the next step; a run cancelled by a newer push is followed to the next master commit with the same VERSION (published there) or marks the version superseded; non-master refs are refused; it fails with the backfill command after 110 minutes. Build, release, `latest-stable` and the publish jobs use the gated commit. Tests: `test/scripts/release-gate.test.ts`. Docs: `docs/RELEASING.md#release-ci-gate`.- `scripts/regen-all.ts` — one entry point for every generated artifact (`ARTIFACTS`: regen and check command per artifact). `bun run regen:all` regenerates offline and keyless (provider keys and database URLs removed) and lists what changed; a second run changes nothing. `--check` is read-only and runs in `verify` as `check:regen-all`; `--goldens` also regenerates the offline contract goldens. Postgres goldens are named with their own commands, and `llms.txt` regenerates last because it inlines other generated docs. Every `bun test` it spawns (two checks and the goldens) carries `--timeout=60000` through one `BUN_TEST` prefix, because Bun does not apply bunfig.toml's `[test] timeout`. Tests: `test/scripts/regen-all.test.ts`.diff --git a/docs/ci-red-runbook.md b/docs/ci-red-runbook.mdindex e41f785f28..fdac6139c7 100644--- a/docs/ci-red-runbook.md+++ b/docs/ci-red-runbook.md@@ -48,6 +48,12 @@ response: a repair PR whose body says `Fixes #<issue>`.by hand with a comment naming the replacement, or replay E2E files:`gh workflow run e2e.yml --ref master -f full_corpus=true`, then`gh workflow run nightly-watch.yml -f run_id=<that run id> -f replay_issue=<issue>`.+- **Reused full-suite runs:** a push run that reused an identical-tree full+ run (a succeeded `reused-full-suite` job) is judged by the run its+ `reuse.json` names, at the recorded attempt: its jobs and its complete+ `ci-manifest` clear or confirm failures as if the push had run them. An+ unreadable or mismatched record, a different tree, or a missing or+ incomplete source manifest is incomplete evidence and clears nothing.- **Closed by hand:** a closed issue whose JSON block is still red ends thatincident. The watch records later runs on it as green (its body says it wasclosed by hand) and never reopens it or opens a new issue for its failures;diff --git a/scripts/lib/ci-run.ts b/scripts/lib/ci-run.tsindex d66c7c01b0..08bef2b1f4 100644--- a/scripts/lib/ci-run.ts+++ b/scripts/lib/ci-run.ts@@ -10,12 +10,16 @@* every failing test file and test identity) kept apart from sanitized error* excerpts, plus `complete` and `problems`: a jobs page, annotation or* manifest that could not be read is incomplete evidence, never zero- * failures, and incomplete evidence never clears a failure.+ * failures, and incomplete evidence never clears a failure. A push run whose+ * `reused-full-suite` job succeeded is judged by the run its reuse.json names+ * (scripts/ci-reuse.ts): that attempt's jobs and complete ci-manifest stand in+ * for the push when the trees match; any gap is incomplete evidence.** `reproduceCommand` builds the one reproduce line every issue prints from* validated fields only (a strict test-path pattern), never from run text.*/import { checkManifest, MANIFEST_ARTIFACT, MANIFEST_FILE, passedFiles, type CiManifest } from '../ci-manifest.ts';+import { checkRecord, REUSE_ARTIFACT, REUSE_FILE, REUSE_JOB } from '../ci-reuse.ts';import { fetchArtifactJson, inert, redactCredentials, type GitHubClient } from './gh-issue.ts';export interface RunInfo {@@ -160,6 +164,26 @@ export function failedJobRecord(job: JobInfo, annotations: Annotation[]): Failedexport interface EvidenceOptions { manifest?: (run: RunInfo) => Promise<{ value?: unknown; reason?: string }> }+/** The full-suite run a push run reused (the attempt its reuse.json names, same workflow, identical tree), or why it cannot stand in for the push. */+async function reusedSource(client: GitHubClient, run: RunInfo, marker: JobInfo[]): Promise<RunInfo | string> {+ if (marker.length > 1 || marker[0]!.conclusion !== 'success') return `run ${run.id}'s ${REUSE_JOB} job concluded ${marker.map(j => j.conclusion).join(', ')}`;+ const got = await fetchArtifactJson(client, run.id, REUSE_ARTIFACT, REUSE_FILE);+ if (got.reason) return got.reason;+ const rec = checkRecord(got.value, run.name, run.head_sha);+ if (typeof rec === 'string') return rec;+ try {+ const source = await client.request<RunInfo>('GET', `repos/{repo}/actions/runs/${rec.run_id}/attempts/${rec.run_attempt}`);+ if (source.name !== run.name || source.head_sha !== rec.sha || source.run_attempt !== rec.run_attempt) return `reused run ${rec.run_id} attempt ${rec.run_attempt} is not the ${inert(run.name)} run on ${rec.sha.slice(0, 12)} its ${REUSE_FILE} names`;+ if (source.conclusion !== 'success') return `reused run ${source.id} attempt ${source.run_attempt} concluded ${source.conclusion}`;+ const tree = async (sha: string) => (await client.request<{ tree: { sha: string } }>('GET', `repos/{repo}/git/commits/${sha}`)).tree.sha;+ const [pushTree, sourceTree] = [await tree(run.head_sha), await tree(source.head_sha)];+ if (pushTree !== sourceTree) return `reused run ${source.id} tested tree ${sourceTree}, but push ${run.head_sha.slice(0, 12)} has tree ${pushTree}`;+ return source;+ } catch (e) {+ return `reused run ${rec.run_id} attempt ${rec.run_attempt} could not be read (${inert(e instanceof Error ? e.message : String(e), 120)})`;+ }+}+export async function collectEvidence(client: GitHubClient, run: RunInfo, opts: EvidenceOptions = {}): Promise<RunEvidence> {const problems: string[] = [];const listed = await pagedJobs(client, run);@@ -191,9 +215,20 @@ export async function collectEvidence(client: GitHubClient, run: RunInfo, opts:const tests: FailedTest[] = [];let passed: string[] = [];let manifestState: RunEvidence['manifest'] = 'not-expected';- if (MANIFEST_WORKFLOWS.has(workflowFile(run))) {- const got = await (opts.manifest ?? (r => fetchArtifactJson(client, r.id, MANIFEST_ARTIFACT, MANIFEST_FILE)))(run);- const checked = got.value === undefined ? { problem: got.reason ?? 'the manifest could not be read' } : checkManifest(got.value, { sha: run.head_sha, run_id: run.id, run_attempt: run.run_attempt });+ const succeeded = jobs.filter(j => j.conclusion === 'success').map(j => inert(j.name));+ const marker = jobs.filter(j => j.name === REUSE_JOB && j.conclusion !== 'skipped');+ const source = MANIFEST_WORKFLOWS.has(workflowFile(run)) && marker.length ? await reusedSource(client, run, marker) : run;+ if (typeof source === 'string') {+ manifestState = 'unreadable';+ problems.push(`run ${run.id} reused a full-suite run that cannot stand in for it: ${source}`);+ } else if (source !== run) {+ const reused = await pagedJobs(client, source);+ if (!reused.complete) problems.push(`the jobs list of reused run ${source.id} was truncated`);+ succeeded.push(...reused.jobs.filter(j => j.conclusion === 'success').map(j => inert(j.name)).filter(n => !succeeded.includes(n)));+ }+ if (typeof source !== 'string' && MANIFEST_WORKFLOWS.has(workflowFile(run))) {+ const got = await (opts.manifest ?? (r => fetchArtifactJson(client, r.id, MANIFEST_ARTIFACT, MANIFEST_FILE)))(source);+ const checked = got.value === undefined ? { problem: got.reason ?? 'the manifest could not be read' } : checkManifest(got.value, { sha: source.head_sha, run_id: source.id, run_attempt: source.run_attempt });if (checked.manifest) {manifestState = 'read';const m: CiManifest = checked.manifest;@@ -222,7 +257,7 @@ export async function collectEvidence(client: GitHubClient, run: RunInfo, opts:cancelled,annotations: byJob,failed,- succeeded: jobs.filter(j => j.conclusion === 'success').map(j => inert(j.name)),+ succeeded,tests,files,passed,diff --git a/scripts/structural-suites.tsv b/scripts/structural-suites.tsvindex b4ce08f573..f974745c9b 100644--- a/scripts/structural-suites.tsv+++ b/scripts/structural-suites.tsv@@ -318,7 +318,7 @@ test/scripts/native-setup-toolchain.test.ts scripts/native/setup-toolchain.ts dotest/scripts/nightly-e2e.test.ts full E2E shard classification (#6040) 2 readFileSynctest/scripts/nightly-e2e.test.ts nightly E2E scheduling 4 readFileSynctest/scripts/nightly-issue.test.ts .github/nightly-known-red.tsv 2 readFileSync-test/scripts/nightly-issue.test.ts master-red: push-to-master runs 26 readFileSync+test/scripts/nightly-issue.test.ts master-red: push-to-master runs 28 readFileSynctest/scripts/nightly-issue.test.ts nightly-watch coverage ratchet 1 readFileSynctest/scripts/nightly-issue.test.ts nightly-watch incidents 9 readFileSynctest/scripts/nightly-issue.test.ts nightly-watch routing and guard 9 readFileSyncdiff --git a/test/fixtures/nightly-watch/master-red/ci-manifest-39170735990.json b/test/fixtures/nightly-watch/master-red/ci-manifest-39170735990.jsonnew file mode 100644index 0000000000..74faa2b2d6--- /dev/null+++ b/test/fixtures/nightly-watch/master-red/ci-manifest-39170735990.json@@ -0,0 +1,37 @@+{+ "schema": "gbrain-ci-manifest/v1",+ "workflow": "Test",+ "event": "workflow_dispatch",+ "sha": "13366cdef9f0c62eb62fd5e2e06be513eb4d39c4",+ "run_id": 39170735990,+ "run_attempt": 1,+ "complete": true,+ "problems": [],+ "files": [+ {+ "file": "test/large-pages/segmented-prior-view.test.ts",+ "lane": "pg-arms-bun-1.4.0",+ "arm": "postgres",+ "executed": 4,+ "failed": 0,+ "skipped": 0+ },+ {+ "file": "test/large-pages/segmented-prior-view.test.ts",+ "lane": "pg-arms-bun-1.4.3",+ "arm": "postgres",+ "executed": 4,+ "failed": 0,+ "skipped": 0+ },+ {+ "file": "test/large-pages/segmented-prior-view.test.ts",+ "lane": "unit",+ "arm": "",+ "executed": 2,+ "failed": 0,+ "skipped": 0+ }+ ],+ "failures": []+}diff --git a/test/fixtures/nightly-watch/master-red/jobs-39170735990.json b/test/fixtures/nightly-watch/master-red/jobs-39170735990.jsonnew file mode 100644index 0000000000..18fa1a290e--- /dev/null+++ b/test/fixtures/nightly-watch/master-red/jobs-39170735990.json@@ -0,0 +1,797 @@+{+ "total_count": 132,+ "jobs": [+ {+ "id": 117803097221,+ "name": "typecheck",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097355,+ "name": "security-regressions (macos-26, 1.4.3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097388,+ "name": "security-regressions (ubuntu-latest, 1.4.3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097420,+ "name": "dependency-audit",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097429,+ "name": "changes",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097454,+ "name": "security-regressions (windows-latest, 1.4.0)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097456,+ "name": "verify",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097507,+ "name": "gitleaks",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097519,+ "name": "stress-changed-tests / Stress plan",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097542,+ "name": "security-regressions (windows-latest, 1.4.3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097546,+ "name": "security-regressions (ubuntu-latest, 1.4.0)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097563,+ "name": "security-regressions (macos-26, 1.4.0)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803097948,+ "name": "race-hunt",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117803227529,+ "name": "slow-entity-resolve-perf",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227545,+ "name": "admin-browser",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227558,+ "name": "brainbench",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227578,+ "name": "serial-tests (1)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227583,+ "name": "slow-brainbench-e2e",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227601,+ "name": "shared-skills-compatibility",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227616,+ "name": "native-locks / OpenClaw 2026.9.4 native context-engine startup",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227620,+ "name": "serial-tests (2)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227621,+ "name": "serial-tests (3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227627,+ "name": "serial-tests (4)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227678,+ "name": "native-locks / Windows PowerShell console probe / windows-11-arm / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227690,+ "name": "native-locks / linux-x64-musl / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227703,+ "name": "native-locks / Windows PowerShell console probe / windows-2022 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227713,+ "name": "native-locks / Windows PowerShell console probe / windows-2022 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227735,+ "name": "native-locks / linux-arm64-musl / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227795,+ "name": "native-locks / Windows ACL API probe / windows-2022 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227812,+ "name": "native-locks / linux-arm64-musl / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227822,+ "name": "native-locks / Windows ACL API probe / windows-11-arm / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227826,+ "name": "native-locks / Windows ACL API probe / windows-2022 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227853,+ "name": "native-locks / linux-x64-musl / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227856,+ "name": "persistence-validation / Read latency / postgres / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227867,+ "name": "persistence-validation / Read latency / pglite / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227882,+ "name": "native-locks / Windows PowerShell console probe / windows-11-arm / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227886,+ "name": "persistence-validation / PgBouncer, RLS and pool capacity / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227887,+ "name": "test (3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227896,+ "name": "test (4)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227898,+ "name": "test (5)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227921,+ "name": "test (2)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227928,+ "name": "persistence-validation / PgBouncer, RLS and pool capacity / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227941,+ "name": "test (18)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227943,+ "name": "persistence-validation / Managed-sync convergence / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227952,+ "name": "persistence-validation / Read latency / pglite / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227955,+ "name": "persistence-validation / Reconciliation crashes / postgres / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227956,+ "name": "test (7)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227960,+ "name": "test (14)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227967,+ "name": "test (1)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227972,+ "name": "persistence-validation / Crash robot / postgres / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227974,+ "name": "test (15)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227981,+ "name": "persistence-validation / Crash robot / pglite / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227982,+ "name": "persistence-validation / postgres / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227989,+ "name": "test (10)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227990,+ "name": "test (6)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227993,+ "name": "native-locks / linux-x64-glibc / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227997,+ "name": "test (13)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803227998,+ "name": "native-locks / darwin-arm64 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228000,+ "name": "persistence-validation / Read latency / postgres / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228004,+ "name": "persistence-validation / pglite / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228007,+ "name": "native-locks / win32-arm64 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228008,+ "name": "test (16)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228010,+ "name": "test (9)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228017,+ "name": "persistence-validation / postgres / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228018,+ "name": "native-locks / darwin-x64 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228020,+ "name": "native-locks / darwin-arm64 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228026,+ "name": "native-locks / darwin-x64 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228029,+ "name": "test (8)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228032,+ "name": "persistence-validation / Reconciliation crashes / postgres / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228041,+ "name": "test (12)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228044,+ "name": "persistence-validation / pglite / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228049,+ "name": "persistence-validation / Crash robot / pglite / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228055,+ "name": "persistence-validation / Crash robot / postgres / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228063,+ "name": "persistence-validation / Reconciliation crashes / pglite / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228066,+ "name": "native-locks / linux-x64-glibc / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228068,+ "name": "test (17)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228070,+ "name": "native-locks / win32-arm64 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228073,+ "name": "persistence-validation / Reconciliation crashes / pglite / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228076,+ "name": "persistence-validation / Managed-sync convergence / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228087,+ "name": "test (11)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228101,+ "name": "native-locks / linux-arm64-glibc / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228116,+ "name": "native-locks / linux-arm64-glibc / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228167,+ "name": "native-locks / win32-x64 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228185,+ "name": "native-locks / win32-x64 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228410,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 3/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228412,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 1/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228416,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 10/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228420,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 3/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228438,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 6/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228448,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 1/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228449,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 2/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228459,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 7/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228461,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 4/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228462,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 10/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228464,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 9/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228475,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 6/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228478,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 8/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228483,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 7/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228487,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 5/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228491,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 4/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228496,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 5/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228504,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 14/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228507,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 11/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228514,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 17/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228517,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 2/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228532,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 19/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228547,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 18/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228552,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 8/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228554,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 12/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228555,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 15/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228560,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 12/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228570,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 16/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228575,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 18/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228584,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 17/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228596,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 15/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228607,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 13/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228608,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 13/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228614,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 19/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228619,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 11/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228687,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 9/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228694,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 14/19 / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228709,+ "name": "persistence-validation / Unit-lane PostgreSQL arms 16/19 / Bun 1.4.3",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803228969,+ "name": "native-locks / Windows ACL API probe / windows-11-arm / Bun 1.4.0",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803229439,+ "name": "reused-full-suite",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117803341877,+ "name": "stress-changed-tests / stress-changed-tests result",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117803342905,+ "name": "stress-changed-tests / ${{ (((inputs.mode == 'gate') && 'Stress shard') || 'Race hunt shard') }} ${{ matrix.shard }}",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117805747058,+ "name": "coverage-report",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117806010272,+ "name": "Native-only result (full CI not run)",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117808077752,+ "name": "test-status",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117808077762,+ "name": "executed-receipts",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117808078591,+ "name": "cheap-tier (full suite not run)",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117808158333,+ "name": "full-suite",+ "conclusion": "success",+ "steps": []+ }+ ]+}diff --git a/test/fixtures/nightly-watch/master-red/jobs-39174731800.json b/test/fixtures/nightly-watch/master-red/jobs-39174731800.jsonnew file mode 100644index 0000000000..c00c20e734--- /dev/null+++ b/test/fixtures/nightly-watch/master-red/jobs-39174731800.json@@ -0,0 +1,191 @@+{+ "total_count": 31,+ "jobs": [+ {+ "id": 117814962203,+ "name": "typecheck",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962429,+ "name": "dependency-audit",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962455,+ "name": "changes",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962474,+ "name": "gitleaks",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962485,+ "name": "security-regressions (ubuntu-latest, 1.4.3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962503,+ "name": "verify",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962506,+ "name": "security-regressions (ubuntu-latest, 1.4.0)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962523,+ "name": "security-regressions (windows-latest, 1.4.0)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962534,+ "name": "security-regressions (windows-latest, 1.4.3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962555,+ "name": "security-regressions (macos-26, 1.4.3)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962567,+ "name": "security-regressions (macos-26, 1.4.0)",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814962586,+ "name": "stress-changed-tests / Stress plan",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117814963204,+ "name": "race-hunt",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815057756,+ "name": "reused-full-suite",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117815058668,+ "name": "brainbench",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815058671,+ "name": "test",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815058813,+ "name": "persistence-validation",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815058826,+ "name": "slow-brainbench-e2e",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815059023,+ "name": "shared-skills-compatibility",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815059050,+ "name": "serial-tests",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815059093,+ "name": "slow-entity-resolve-perf",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815059248,+ "name": "native-locks",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815059351,+ "name": "coverage-report",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815059393,+ "name": "Native-only result (full CI not run)",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815060055,+ "name": "admin-browser",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815200374,+ "name": "stress-changed-tests / stress-changed-tests result",+ "conclusion": "success",+ "steps": []+ },+ {+ "id": 117815201054,+ "name": "stress-changed-tests / ${{ (((inputs.mode == 'gate') && 'Stress shard') || 'Race hunt shard') }} ${{ matrix.shard }}",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815322108,+ "name": "executed-receipts",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815439464,+ "name": "cheap-tier (full suite not run)",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815439811,+ "name": "(github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && (inputs.native_only == true || inputs.race_hunt == true || inputs.stress_files != '' || inputs.stress_base != ''))) && 'full-suite-not-run' || 'test-status'",+ "conclusion": "skipped",+ "steps": []+ },+ {+ "id": 117815440109,+ "name": "(github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && (inputs.native_only == true || inputs.race_hunt == true || inputs.stress_files != '' || inputs.stress_base != ''))) && 'full-suite-not-run' || 'full-suite'",+ "conclusion": "skipped",+ "steps": []+ }+ ]+}diff --git a/test/fixtures/nightly-watch/master-red/reuse-39174731800.json b/test/fixtures/nightly-watch/master-red/reuse-39174731800.jsonnew file mode 100644index 0000000000..2e137e6c0b--- /dev/null+++ b/test/fixtures/nightly-watch/master-red/reuse-39174731800.json@@ -0,0 +1,11 @@+{+ "reuse": true,+ "workflow": "Test",+ "push_sha": "f1d9093164aae6e861646dc51a9a00b16d357988",+ "tree": "5d6ec794768a1d240bfc0b79deb74b938b8894f2",+ "reason": "identical_tree_full_run",+ "source_run_id": 39170735990,+ "source_run_attempt": 1,+ "source_sha": "13366cdef9f0c62eb62fd5e2e06be513eb4d39c4",+ "source_url": "https://github.com/garrytan/gbrain/actions/runs/39170735990/attempts/1"+}diff --git a/test/fixtures/nightly-watch/master-red/runs-test-reuse.json b/test/fixtures/nightly-watch/master-red/runs-test-reuse.jsonnew file mode 100644index 0000000000..ac08aaa9a3--- /dev/null+++ b/test/fixtures/nightly-watch/master-red/runs-test-reuse.json@@ -0,0 +1,46 @@+{+ "workflow_runs": [+ {+ "conclusion": "success",+ "created_at": "2026-10-18T23:01:27Z",+ "event": "push",+ "head_branch": "master",+ "head_repository": {+ "full_name": "garrytan/gbrain"+ },+ "head_sha": "f1d9093164aae6e861646dc51a9a00b16d357988",+ "html_url": "https://github.com/garrytan/gbrain/actions/runs/39174731800",+ "id": 39174731800,+ "name": "Test",+ "path": ".github/workflows/test.yml",+ "repository": {+ "full_name": "garrytan/gbrain"+ },+ "run_attempt": 1,+ "run_number": 10229,+ "status": "completed",+ "workflow_id": 258320022+ },+ {+ "conclusion": "success",+ "created_at": "2026-10-18T22:05:57Z",+ "event": "workflow_dispatch",+ "head_branch": "capy/gbra135-ci-cost",+ "head_repository": {+ "full_name": "garrytan/gbrain"+ },+ "head_sha": "13366cdef9f0c62eb62fd5e2e06be513eb4d39c4",+ "html_url": "https://github.com/garrytan/gbrain/actions/runs/39170735990",+ "id": 39170735990,+ "name": "Test",+ "path": ".github/workflows/test.yml",+ "repository": {+ "full_name": "garrytan/gbrain"+ },+ "run_attempt": 1,+ "run_number": 10224,+ "status": "completed",+ "workflow_id": 258320022+ }+ ]+}diff --git a/test/scripts/nightly-issue.test.ts b/test/scripts/nightly-issue.test.tsindex a3df8a0107..d71668656e 100644--- a/test/scripts/nightly-issue.test.ts+++ b/test/scripts/nightly-issue.test.ts@@ -283,6 +283,10 @@ class World {jobs = new Map<string, { jobs: JobInfo[]; total_count: number }>();annotations = new Map<number, unknown[]>();manifests = new Map<string, unknown>();+ /** Raw reuse.json text of a push run's `reused-full-suite` artifact, by run id. */+ reuse = new Map<number, string>();+ attempts = new Map<string, RunInfo>();+ trees = new Map<string, string>();issues: WorldIssue[] = [];timeline = new Map<number, unknown[]>();compares = new Map<string, unknown>();@@ -294,6 +298,7 @@ class World {addRun(run: RunInfo, jobsFile?: string, manifest: unknown | null = completeManifest(run)) {this.runs.set(run.id, run);+ this.attempts.set(`${run.id}/${run.run_attempt}`, run);const jobs = jobsFile ? mr<{ jobs: JobInfo[]; total_count: number }>(jobsFile) : { total_count: 1, jobs: [{ id: run.id + 1, name: 'test (1)', conclusion: run.conclusion === 'success' ? 'success' : 'failure', steps: [] }] };this.jobs.set(`${run.id}/${run.run_attempt}`, jobs);for (const j of jobs.jobs) {@@ -338,6 +343,12 @@ class World {return world.issues.filter(i => labelNames(i).includes(label) && (m![2] === 'all' || i.state === m![2])).sort((x, y) => y.number - x.number).map(i => ({ ...i })) as R;}if ((m = /^repos\/\{repo\}\/actions\/runs\/(\d+)$/.exec(path))) { const r = world.runs.get(Number(m[1])); if (!r) throw Object.assign(new Error('404'), { status: 404 }); return r as R; }+ if ((m = /^repos\/\{repo\}\/actions\/runs\/(\d+)\/attempts\/(\d+)$/.exec(path))) { const r = world.attempts.get(`${m[1]}/${m[2]}`); if (!r) throw Object.assign(new Error('404'), { status: 404 }); return r as R; }+ if ((m = /^repos\/\{repo\}\/git\/commits\/(\w+)$/.exec(path))) return { tree: { sha: world.trees.get(m[1]!) ?? `tree-of-${m[1]}` } } as R;+ if ((m = /^repos\/\{repo\}\/actions\/runs\/(\d+)\/artifacts\?name=reused-full-suite/.exec(path))) {+ const id = Number(m[1]);+ return { artifacts: world.reuse.has(id) ? [{ id: id * 10, name: 'reused-full-suite', expired: false }] : [] } as R;+ }if ((m = /^repos\/\{repo\}\/actions\/runs\/(\d+)\/attempts\/(\d+)\/jobs/.exec(path))) return (world.jobs.get(`${m[1]}/${m[2]}`) ?? { jobs: [], total_count: 0 }) as R;if ((m = /^repos\/\{repo\}\/check-runs\/(\d+)\/annotations/.exec(path))) return (world.annotations.get(Number(m[1])) ?? []) as R;if ((m = /^repos\/\{repo\}\/actions\/runs\/(\d+)\/artifacts\?name=ci-manifest/.exec(path))) {@@ -360,6 +371,7 @@ class World {async download(path: string): Promise<Uint8Array> {world.calls.push({ method: 'DOWNLOAD', path });const id = Number(/artifacts\/(\d+)\/zip/.exec(path)![1]);+ if (id % 10 === 0) return zipOf('reuse.json', world.reuse.get(id / 10)!);const run = world.runs.get(Math.floor(id / 10))!;return zipOf('ci-manifest.json', JSON.stringify(world.manifests.get(`${run.id}/${id % 10}`)));},@@ -571,6 +583,55 @@ describe('master-red: push-to-master runs', () => {expect(mrState(blind.issue(90))).toMatchObject({ status: 'green', first_red: null, open_jobs: [], evaluated: { run_id: RR.g10289.id } });});+ // Recorded API JSON: push run 10229 (39174731800, f1d90931) reused the Test full suite of the+ // workflow_dispatch 39170735990 (13366cde, the merged PR head; same tree 5d6ec794). Its jobs are the cheap+ // tier plus a succeeded `reused-full-suite` job, it has no ci-manifest, and its reuse.json is verbatim.+ // The dispatch's ci-manifest is complete (trimmed to the segmented-prior-view rows of 5034 files).+ const reuseRuns = mr<{ workflow_runs: RunInfo[] }>('runs-test-reuse.json').workflow_runs;+ const RU = { push10229: reuseRuns.find(r => r.run_number === 10229)!, dispatch10224: reuseRuns.find(r => r.run_number === 10224)! };+ const REUSED_TREE = '5d6ec794768a1d240bfc0b79deb74b938b8894f2';+ const reuseWatch = async (tweak: (w: World) => void = () => {}) => {+ const w = new World();+ w.addRun(RR.g10213).addRun(RR.r10222, `jobs-${RR.r10222.id}.json`, redManifest(RR.r10222));+ expect((await go(w, RR.r10222)).masterRed!.action).toBe('create');+ w.addRun(RU.dispatch10224, `jobs-${RU.dispatch10224.id}.json`, mr('ci-manifest-39170735990.json'));+ w.addRun(RU.push10229, `jobs-${RU.push10229.id}.json`, null);+ w.reuse.set(RU.push10229.id, readFileSync(join(MR, 'reuse-39174731800.json'), 'utf8'));+ w.trees.set(RU.push10229.head_sha, REUSED_TREE).set(RU.dispatch10224.head_sha, REUSED_TREE);+ tweak(w);+ const incident = masterIssue(w)!;+ return { incident, r: await go(w, RU.push10229) };+ };++ test('a push run that reused a full-suite run is judged by that run: run 10229 reused complete green dispatch 39170735990 (same tree) and closes the incident', async () => {+ const { incident, r } = await reuseWatch();+ expect(r.masterRed!.evaluated).toEqual([RU.push10229.id]);+ expect(r.masterRed!.action).toBe('close');+ expect(incident.state).toBe('closed');+ expect(mrState(incident)).toMatchObject({ status: 'green', open_jobs: [], blocked: [], last_green: { run_id: RU.push10229.id }, evidence: { run_id: RU.push10229.id, complete: true, problems: [] } });+ expect(incident.comments.at(-1)).toContain('Green:');+ });++ test('a reused run that cannot prove its source keeps the incident open: tree mismatch, incomplete or missing source manifest, unreadable or missing reuse.json', async () => {+ const cases: Array<[string, (w: World) => void, string]> = [+ ['tree mismatch', w => { w.trees.set(RU.dispatch10224.head_sha, 'f'.repeat(40)); }, `but push ${RU.push10229.head_sha.slice(0, 12)} has tree ${REUSED_TREE}`],+ ['incomplete source manifest', w => { w.manifests.set(`${RU.dispatch10224.id}/1`, { ...mr<CiManifest>('ci-manifest-39170735990.json'), complete: false, problems: ['receipts-unit-3 is missing'] }); }, 'the ci-manifest artifact is incomplete: receipts-unit-3 is missing'],+ ['source without a manifest', w => { w.manifests.delete(`${RU.dispatch10224.id}/1`); }, `run ${RU.dispatch10224.id} has no 'ci-manifest' artifact`],+ ['unreadable reuse.json', w => { w.reuse.set(RU.push10229.id, '{"reuse": true, "workflow"'); }, `reading run ${RU.push10229.id}'s 'reused-full-suite' artifact failed`],+ ['missing reuse artifact', w => { w.reuse.delete(RU.push10229.id); }, `run ${RU.push10229.id} has no 'reused-full-suite' artifact`],+ ['record for another push', w => { w.reuse.set(RU.push10229.id, JSON.stringify({ ...mr<Record<string, unknown>>('reuse-39174731800.json'), push_sha: 'e'.repeat(40) })); }, `reuse.json is for push ${'e'.repeat(40)}`],+ ];+ for (const [name, tweak, problem] of cases) {+ const { incident, r } = await reuseWatch(tweak);+ expect([name, r.masterRed!.action]).toEqual([name, 'update']);+ expect([name, incident.state]).toEqual([name, 'open']);+ const state = mrState(incident);+ expect([name, state.status, state.blocked]).toEqual([name, 'red', [PG_JOB]]);+ expect([name, state.evidence!.complete]).toEqual([name, false]);+ expect([name, state.evidence!.problems.join(' | ')]).toEqual([name, expect.stringContaining(problem)]);+ }+ });+test('a green run where a previously failing job did not run keeps the issue open and names the manual-close step', async () => {const w = testWorld(T.g8315, T.r8320);await go(w, T.r8320);