Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
v1.91.84.0 fix(cso-eval): score real paid producer receipts — unique-path inventories, platform catalog equivalence, deterministic evaluation catalogs (#3127)
Garry Tanf4d8c7130dd4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cd8f4e1ca..32f13e9dc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,36 @@# Changelog+## [1.91.84.0] - 2026-10-11++**A paid CSO baseline can be scored, and it measures what audits found. Three producer/scorer mismatches made gstack's own collect reject every real producer receipt from the first full baseline. Collect and score now accept real receipts of every kind, a test feeds them through, and findings count from every finished report, with completeness kept as its own measured rate.**++The first full paid v2 baseline produced 64 receipts and 64 judge records, then scored `unmeasured` with `INVALID_PRODUCER_RECEIPT`. Run against that run's retained artifacts, collect failed on three separate mismatches in turn:++1. **Artifact order.** The producer sorted its artifact inventory with `localeCompare`, so `package.json` came before `README.md`. Collect required strict code-unit order, and 62 of 64 receipts failed.+2. **Per-platform catalog bytes.** Next came `UNMATCHED_PRODUCER_INSTALLATIONS`. Each platform's producer unit generated its own evaluation catalog, and `evaluation-candidate` stamps `qualifiedAt` with the current time. The two embedded catalogs differed only in that timestamp and the evidence digest over it.+3. **Case-id namespace.** The last mismatch is in the private evaluator: judges named matched cases by their private id instead of the matrix's opaque id. The evaluator fixes it at its own boundary.++### What this means for you++- **Findings count from every finished report.** Before this, the scorer counted a cell's findings and runtime outcomes only when the helper report was `complete`, meaning no gap and every domain assessed. Real audits nearly always record some gap, such as no web advisory lookup or credential liveness left untested, so all 64 paid cells scored `partial` and the baseline found 0 of 32 seeded issues. `EvalResult` now carries a required `reportFinished` (helper status `finished`). Precision, recall, found seeded issues, runtime outcomes and tested repairs count from finished reports. A running or missing report still counts nothing, and neither does a report behind a failed producer receipt (a timeout, a failed post-run check, or output withheld for a credential), whatever the judge read there; that report also counts as not complete for the two gates below. Completeness is still measured on its own: each group reports `reports` (complete) and `finishedReports`, and the existing `mandatoryReports` and `matchedCompleteMatrix` gates still require complete reports. No threshold changed.+- **Inventories are checked for unique paths, not order.** The order stays bound by the inventory's identity hash. New producers sort by code unit, so the identity no longer depends on locale.+- **`evaluation-candidate --created-at <ISO time>`** pins every runtime's `qualifiedAt`. Builds given the same value write identical catalog bytes, so per-platform units embed the same catalog.+- **`collectProducerReceipts(…, embeddedCatalogs)`** handles units that already embedded different catalogs. When the platforms' catalog hashes differ, it accepts them only if the supplied catalog bodies hash to each platform's `runtimeSha256`, validate, share revision and scanner identity, and are identical apart from `qualifiedAt` and the evidence digest. The batch then carries those bodies, and scoring re-checks them. Without bodies, or with any other difference, the result is still `UNMATCHED_PRODUCER_INSTALLATIONS`.++### Itemized changes++#### Changed+- `scripts/cso-eval.ts`: `EvalResult.reportFinished` (required, implied by `reportComplete`, implies `reportPresent`) gates counted findings and outcomes. Groups add `finishedReports`. Collected scoring and `createEvalBaseline` count a failed receipt's result as neither finished nor complete.+- `scripts/cso-eval-producer.ts`: artifact inventory sorted by code unit.+- `scripts/cso-eval.ts`: `validateArtifactInventory` requires unique paths. `assertPlatformIdentities` accepts the catalog-equivalence proof. `ProducerBatch.embeddedCatalogs` is optional.+- `scripts/cso-runtime-promotion.ts`: `evaluation-candidate` takes an optional `--created-at`. Documented in `docs/cso-release-qualification.md`.++#### For contributors+- `test/cso-eval.test.ts`: finished partial reports count findings while the completeness gates still fail. Running and missing reports count nothing. A baseline finds a seeded issue in a finished partial report and never in a running or missing one.+- `test/cso-eval.test.ts`: in the real-receipt baseline, a seeded issue is found exactly where the vulnerable cell's receipt succeeded.+- `test/cso-eval.test.ts`: real producer receipts, one per kind (succeeded, span-redacted, credential-withheld, timeout, post-run check failure), with mixed-case helper artifacts, go through collect, `createEvalBaseline` and `scoreCollectedEval`. Locale-ordered inventories are accepted and duplicate paths rejected. Catalog equivalence passes with the bodies and fails without them, with a body missing, duplicated, or with a moved image.+- `test/cso-runtime-promotion.test.ts`: two `evaluation-candidate --created-at` builds write identical bytes.+## [1.91.83.0] - 2026-10-11**gstack ships itself under `stamp-at-merge`.** `.gstack/ship-policy.json` flips `queue_mode` to `stamp-at-merge`, `bump` to `patch` and names `garrytan` under `maintainers`. The version is now allocated once, when the PR is next in the queue (`gstack-restamp --next --expect-base --expect-order`), instead of claimed at open and re-slotted on every reorder; every bump is PATCH, so unattended ships never meet the MINOR/MAJOR prompt; and `/review` contributor mode reads the maintainer set from the file instead of calling the collaborators API. `docs/ship-policy.md` gains the queue-side procedure: what a PR carries before its stamp, who runs the restamp and when, and what the merging thread verifies on the exact SHA instead of "VERSION above main".diff --git a/VERSION b/VERSIONindex 4033bad18..2118139f9 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.91.83.0+1.91.84.0diff --git a/agents-digest/gstack-AGENTS.md b/agents-digest/gstack-AGENTS.mdindex 6912dbebc..9611a81e5 100644--- a/agents-digest/gstack-AGENTS.md+++ b/agents-digest/gstack-AGENTS.md@@ -1,4 +1,4 @@-# gstack digest v1.91.83.0 — regenerate/re-copy after upgrading gstack+# gstack digest v1.91.84.0 — regenerate/re-copy after upgrading gstackBehavioral rules from gstack (https://github.com/garrytan/gstack), compressedfor agent hosts without a full skill install. The full skills add workflows,diff --git a/docs/cso-release-qualification.md b/docs/cso-release-qualification.mdindex 32c81b98f..dc7786f86 100644--- a/docs/cso-release-qualification.md+++ b/docs/cso-release-qualification.md@@ -312,7 +312,10 @@ any gate is measured. It never edits the committed catalog. Instead,into an evaluation-only catalog. Its revision is `cso-eval-<runId>-<sha12>`, itcarries an `evaluation` record instead of `promotion`, and every runtime is an`evaluation_candidate` whose qualification has `kind: "evaluation"` and no-release-gate field. Then+release-gate field. Each runtime's `qualifiedAt` is the current time unless+`--created-at <ISO time>` names it. An evaluation that builds one unit per+platform must pass the same `--created-at` to every build: the scorer requires+both platforms' producers to embed identical catalog bytes. Then```bashbun run build:cso -- --evaluation-candidate <catalog.json> --output <new-directory>diff --git a/package.json b/package.jsonindex 7310de30c..26421cedb 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "gstack",- "version": "1.91.83",+ "version": "1.91.84","description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.","license": "MIT","type": "module",diff --git a/scripts/cso-eval-producer.ts b/scripts/cso-eval-producer.tsindex 922616405..908951ad2 100644--- a/scripts/cso-eval-producer.ts+++ b/scripts/cso-eval-producer.ts@@ -219,7 +219,7 @@ export function inventoryProducerArtifacts(helperHome: string): ProducerArtifactlet totalBytes = 0, visited = 0;const visit = (directory: string, depth: number): void => {if (depth > 32 || ++visited > ARTIFACT_COUNT_LIMIT * 2) throw new Error('INVALID_PRODUCER_ARTIFACTS');- for (const entry of fs.readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {const full = join(directory, entry.name);if (++visited > ARTIFACT_COUNT_LIMIT * 2) throw new Error('INVALID_PRODUCER_ARTIFACTS');if (entry.isSymbolicLink()) throw new Error('INVALID_PRODUCER_ARTIFACTS');@@ -234,7 +234,7 @@ export function inventoryProducerArtifacts(helperHome: string): ProducerArtifact}};visit(artifactRoot, 0);- entries.sort((left, right) => left.path.localeCompare(right.path));+ entries.sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0);const base = { schemaVersion: 1 as const, root: 'security/cso' as const, entries, totalBytes };return { ...base, identityHash: producerArtifactInventoryHash(base) };}diff --git a/scripts/cso-eval.ts b/scripts/cso-eval.tsindex 69e475a61..67f6e7b1a 100644--- a/scripts/cso-eval.ts+++ b/scripts/cso-eval.ts@@ -5,6 +5,8 @@ import { execFileSync } from 'node:child_process';import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync } from 'node:fs';import { dirname, join, resolve } from 'node:path';import { readBoundedStable } from '../lib/cso/bounded-file';+import { canonical } from '../lib/cso/contracts';+import { validateRuntimeCatalog, type RuntimeCatalog } from '../lib/cso/runtime-catalog';import { executable } from '../lib/cso/process';import { atomicWriteSync } from '../lib/fs-atomic';import { loadCorpusManifest, materializeCase, publicCorpus, STACKS, validateCorpusManifest, type CorpusManifest, type EvalCorpus, type EvalStack, type EvalVariant } from '../test/fixtures/cso-eval/materialize';@@ -112,7 +114,11 @@ export interface EvalFinding {}export interface EvalResult {cellId: string; sourceHash: string; skillHash: string; model: string; host: string; budgetSeconds: number;- reportPresent: boolean; reportComplete: boolean; findings: EvalFinding[];+ /**+ * `reportFinished`: the helper report's status is `finished`; its findings and runtime outcomes count whatever its+ * completeness. `reportComplete`: it is also `complete` (no gap, every domain assessed), measured as its own rate.+ */+ reportPresent: boolean; reportFinished: boolean; reportComplete: boolean; findings: EvalFinding[];setup: Outcome; reproduction: Outcome; repair: Outcome; recheck: Outcome;/** Hash of trusted private observations; never a producer's claimed verification status. */oracleEvidenceHash?: string;@@ -168,6 +174,8 @@ export interface ProducerBatch {groups: ProducerGroupSummary[];note: string;};+ /** Present only when platforms embedded catalogs that differ in qualification time alone; see assertPlatformIdentities. */+ embeddedCatalogs?: RuntimeCatalog[];batchHash: string;}export const REQUIRED_CONTAINMENT = [@@ -410,14 +418,16 @@ function validateProviderIdentity(identity: ProducerProviderIdentity, family: 'cif (producerProviderIdentityHash(withoutHash) !== identityHash) throw new Error(error);}+/** Paths are unique; their order is whatever the producer bound into identityHash (1.91.75 producers sorted by locale). */function validateArtifactInventory(inventory: ProducerArtifactInventory, error: string): void {if (!inventory || inventory.schemaVersion !== 1 || inventory.root !== 'security/cso' || !Array.isArray(inventory.entries) || inventory.entries.length > 4096 ||!Number.isSafeInteger(inventory.totalBytes) || inventory.totalBytes < 0 || inventory.totalBytes > 128 * 1024 * 1024 || !HEX.test(inventory.identityHash)) throw new Error(error);- let previous = '', total = 0;+ const paths = new Set<string>();+ let total = 0;for (const entry of inventory.entries) {if (!entry || typeof entry.path !== 'string' || entry.path.length > 1024 || !/^[A-Za-z0-9._/-]+$/.test(entry.path) || entry.path.split('/').some(part => !part || part === '.' || part === '..') ||- entry.path <= previous || !HEX.test(entry.sha256) || !Number.isSafeInteger(entry.bytes) || entry.bytes < 0 || entry.bytes > 32 * 1024 * 1024) throw new Error(error);- previous = entry.path; total += entry.bytes;+ paths.has(entry.path) || !HEX.test(entry.sha256) || !Number.isSafeInteger(entry.bytes) || entry.bytes < 0 || entry.bytes > 32 * 1024 * 1024) throw new Error(error);+ paths.add(entry.path); total += entry.bytes;}if (total !== inventory.totalBytes) throw new Error(error);const { identityHash, ...withoutHash } = inventory;@@ -446,9 +456,12 @@ type IdentityBearing = Pick<ProducerReceiptIndex, 'cell' | 'installationIdentity/*** Each platform has exactly one producer installation and provider binary.* Platforms differ only in native binaries: the embedded catalogs and the- * reviewed provider policy must be identical across them.+ * reviewed provider policy must be identical across them. Evaluation units that+ * generated their catalog once per platform embed copies differing only in each+ * runtime's `qualifiedAt` and the evidence digest over it; `bodies`, the catalogs+ * as embedded, prove that, each hashing to its platform's runtimeSha256.*/-function assertPlatformIdentities(receipts: IdentityBearing[]): void {+function assertPlatformIdentities(receipts: IdentityBearing[], bodies: RuntimeCatalog[] = []): void {const byPlatform = new Map<string, IdentityBearing[]>();for (const receipt of receipts) {const key = receipt.cell.platform ?? 'unpinned', list = byPlatform.get(key) ?? [];@@ -463,11 +476,23 @@ function assertPlatformIdentities(receipts: IdentityBearing[]): void {if (new Set(representatives.map(receipt => receipt.installationIdentity.identityHash)).size !== representatives.length) throw new Error('UNMATCHED_PRODUCER_PLATFORMS');const catalogs = (receipt: IdentityBearing) => JSON.stringify(receipt.installationIdentity.embeddedCatalogs);const policy = ({ providerIdentity: { family, policyRevision, version, argsPrefix } }: IdentityBearing) => JSON.stringify({ family, policyRevision, version, argsPrefix });- if (new Set(representatives.map(catalogs)).size !== 1) throw new Error('UNMATCHED_PRODUCER_INSTALLATIONS');+ if (new Set(representatives.map(catalogs)).size !== 1 && !catalogsDifferOnlyInQualificationTime(representatives, bodies)) throw new Error('UNMATCHED_PRODUCER_INSTALLATIONS');if (new Set(representatives.map(policy)).size !== 1) throw new Error('UNMATCHED_PRODUCER_PROVIDERS');}-export function collectProducerReceipts(matrix: EvalMatrix, schedule: PreparedEvalSchedule, receipts: ProducerReceipt[], corpus: EvalCorpusManifest = loadCorpusManifest()): ProducerBatch {+function catalogsDifferOnlyInQualificationTime(representatives: IdentityBearing[], bodies: RuntimeCatalog[]): boolean {+ if (!Array.isArray(bodies) || bodies.length !== representatives.length) return false;+ const timeless = (body: RuntimeCatalog) => canonical({ ...body, evaluation: { ...body.evaluation, evidenceDigest: null }, runtimes: body.runtimes.map(({ qualifiedAt: _qualifiedAt, ...runtime }) => runtime) });+ const shared = ({ runtimeSha256: _runtimeSha256, ...rest }: ProducerInstallationIdentity['embeddedCatalogs']) => JSON.stringify(rest);+ const matched = representatives.map(receipt => bodies.find(body => sha256(JSON.stringify(body)) === receipt.installationIdentity.embeddedCatalogs.runtimeSha256));+ if (matched.some(body => !body) || new Set(matched).size !== bodies.length) return false;+ try { for (const body of bodies) validateRuntimeCatalog(body); } catch { return false; }+ return new Set(representatives.map(receipt => shared(receipt.installationIdentity.embeddedCatalogs))).size === 1 && new Set(bodies.map(timeless)).size === 1 &&+ bodies.every(body => body.revision === representatives[0].installationIdentity.embeddedCatalogs.runtimeRevision && body.evaluation);+}++/** `embeddedCatalogs`: the runtime catalog each platform's producer unit embedded, required only when those differ (see assertPlatformIdentities). */+export function collectProducerReceipts(matrix: EvalMatrix, schedule: PreparedEvalSchedule, receipts: ProducerReceipt[], corpus: EvalCorpusManifest = loadCorpusManifest(), embeddedCatalogs: RuntimeCatalog[] = []): ProducerBatch {validateMatrix(matrix, corpus); validateSchedule(matrix, schedule);if (!Array.isArray(receipts)) throw new Error('INVALID_PRODUCER_RECEIPTS');const cells = new Map(matrix.cells.map(cell => [cell.id, cell]));@@ -480,7 +505,8 @@ export function collectProducerReceipts(matrix: EvalMatrix, schedule: PreparedEv}// Receipts name only the opaque cellRef; the trusted matrix supplies the cell.const bound = receipts.map(receipt => ({ ...receipt, cell: cells.get(receipt.cellRef)! }));- assertPlatformIdentities(bound);+ assertPlatformIdentities(bound, embeddedCatalogs);+ const platformCatalogs = new Set(bound.map(receipt => receipt.installationIdentity.embeddedCatalogs.runtimeSha256)).size > 1 ? embeddedCatalogs : undefined;const pairs = new Map<string, Partial<Record<EvalVersion, (typeof bound)[number]>>>();if (profileOf(matrix) === 'full') for (const receipt of bound) {const key = matchedPairKey(receipt.cell as EvalCell);@@ -508,7 +534,7 @@ export function collectProducerReceipts(matrix: EvalMatrix, schedule: PreparedEvscheduled: matrix.cells.length, prepared: schedule.preparedCells, submitted: bound.length, missing: matrix.cells.length - bound.length,matchedPairsExpected: expectedMatchedPairs(matrix), matchedPairsSubmitted: completePairs.length, modelMismatches, groups,note: 'Costs are pricing-table estimates. First-useful timing is unmeasured because the reused provider adapters return completed runs. Trusted findings and runtime outcomes require separate oracle adjudication.',- } };+ }, ...(platformCatalogs ? { embeddedCatalogs: platformCatalogs } : {}) };return { ...base, batchHash: digest(JSON.stringify(base)) };}@@ -601,9 +627,9 @@ export function validateMatrix(matrix: EvalMatrix, corpus: EvalCorpusManifest =function validateResult(result: EvalResult, cell: EvalCell, corpus: EvalCorpusManifest): void {if (result.sourceHash !== cell.sourceHash || result.skillHash !== cell.skillHash || result.model !== cell.model || result.host !== cell.host || result.budgetSeconds !== cell.budgetSeconds) throw new Error('UNMATCHED_EVAL_RESULT');for (const field of ['setup', 'reproduction', 'repair', 'recheck'] as const) if (!['passed', 'failed', 'blocked', 'not_attempted'].includes(result[field])) throw new Error('INVALID_EVAL_OUTCOME');- for (const field of ['reportPresent', 'reportComplete', 'heldOutAssertionsPassed', 'freshRecheck'] as const) if (typeof result[field] !== 'boolean') throw new Error('INVALID_EVAL_RESULT');+ for (const field of ['reportPresent', 'reportFinished', 'reportComplete', 'heldOutAssertionsPassed', 'freshRecheck'] as const) if (typeof result[field] !== 'boolean') throw new Error('INVALID_EVAL_RESULT');if (!Array.isArray(result.findings) || !validNumber(result.latencyMs) || (result.firstUsefulResultMs !== null && (!validNumber(result.firstUsefulResultMs) || result.firstUsefulResultMs > result.latencyMs))) throw new Error('INVALID_EVAL_RESULT');- if (result.reportComplete && !result.reportPresent) throw new Error('MISSING_EVAL_REPORT');+ if ((result.reportComplete && !result.reportFinished) || (result.reportFinished && !result.reportPresent)) throw new Error('MISSING_EVAL_REPORT');if (!result.reportPresent && result.findings.length) throw new Error('FINDINGS_WITHOUT_REPORT');if (result.setup === 'blocked' && !result.prerequisite?.trim()) throw new Error('MISSING_SETUP_PREREQUISITE');if (result.oracleEvidenceHash !== undefined && (!HEX.test(result.oracleEvidenceHash) || result.oracleVersion !== corpus.version)) throw new Error('INVALID_ORACLE_PROVENANCE');@@ -648,7 +674,7 @@ function quantile(values: number[], fraction: number): number | null {function measuredRate(cells: EvalCell[], results: Map<string, EvalResult>, field: 'setup' | 'reproduction' | 'repair' | 'recheck', corpus: EvalCorpusManifest): Rate {return rate(cells.filter(cell => {const result = results.get(cell.id);- if (!result?.reportPresent || !result.reportComplete || result[field] !== 'passed') return false;+ if (!result?.reportFinished || result[field] !== 'passed') return false;if (field === 'setup') return true;if (!result.oracleEvidenceHash || result.oracleVersion !== corpus.version || result.setup !== 'passed') return false;if (field === 'reproduction') return true;@@ -665,7 +691,7 @@ function measuredRate(cells: EvalCell[], results: Map<string, EvalResult>, fieldfunction trustedFindingVerification(cell: EvalCell, result: EvalResult, finding: EvalFinding, stage: 'repair' | 'recheck', corpus: EvalCorpusManifest): boolean {const verification = finding.trustedVerification;- if (!result.reportPresent || !result.reportComplete || cell.version !== 'v3' || cell.mode !== 'comprehensive' || cell.variant !== 'vulnerable' || finding.evidence !== 'supported' ||+ if (!result.reportFinished || cell.version !== 'v3' || cell.mode !== 'comprehensive' || cell.variant !== 'vulnerable' || finding.evidence !== 'supported' ||finding.judgment !== 'correct' || finding.matchedCaseId !== cell.caseId || !finding.claimedTested || !verification ||result.setup !== 'passed' || result.reproduction !== 'passed' || result.repair !== 'passed' || !result.heldOutAssertionsPassed ||verification.repair !== 'passed' || verification.repairEvidenceHash !== result.oracleEvidenceHash || result.oracleVersion !== corpus.version)@@ -688,7 +714,7 @@ function validatedResults(matrix: EvalMatrix, observations: EvalResult[], corpusreturn results;}const eligibleFinding = (cell: EvalCell, finding: EvalFinding) => finding.evidence === 'supported' || (cell.version === 'v2' && finding.evidence === 'legacy_review');-const foundSeededIssue = (cell: EvalCell, result: EvalResult | undefined) => result?.reportPresent === true && result.reportComplete === true &&+const foundSeededIssue = (cell: EvalCell, result: EvalResult | undefined) => result?.reportFinished === true &&result.findings.some(finding => eligibleFinding(cell, finding) && finding.judgment === 'correct');const isHighCritical = (corpus: EvalCorpusManifest, caseId: string) => ['critical', 'high'].includes(corpus.cases.find(fixture => fixture.id === caseId)!.severity);@@ -716,7 +742,7 @@ export function scoreEval(matrix: EvalMatrix, observations: EvalResult[], qualiflet correct = 0, reported = 0, unadjudicated = 0;for (const cell of selected) {const result = results.get(cell.id);- const findings = result?.reportPresent && result.reportComplete ? result.findings.filter(finding => finding.evidence !== 'hypothesis') : [];+ const findings = result?.reportFinished ? result.findings.filter(finding => finding.evidence !== 'hypothesis') : [];reported += findings.length;unadjudicated += findings.filter(finding => finding.judgment === 'unadjudicated').length;correct += Number(findings.some(finding => eligibleFinding(cell, finding) && finding.judgment === 'correct')); // Duplicate reports do not increase true positives.@@ -729,7 +755,7 @@ export function scoreEval(matrix: EvalMatrix, observations: EvalResult[], qualifreturn count + result.findings.filter(finding => finding.claimedTested && !trustedFindingVerification(cell, result, finding, 'repair', corpus)).length;}, 0);groups.push({ version, mode, cells: selected.length, submitted: completed.length, missing: selected.length - completed.length,- reports: rate(completed.filter(result => result.reportPresent && result.reportComplete).length, selected.length), precision: rate(correct, reported), recall: rate(expected.filter(found).length, expected.length), highCriticalRecall: rate(highCritical.filter(found).length, highCritical.length),+ reports: rate(completed.filter(result => result.reportPresent && result.reportComplete).length, selected.length), finishedReports: rate(completed.filter(result => result.reportFinished).length, selected.length), precision: rate(correct, reported), recall: rate(expected.filter(found).length, expected.length), highCriticalRecall: rate(highCritical.filter(found).length, highCritical.length),unadjudicated, falseTested, setup: mode === 'comprehensive' ? measuredRate(selected, results, 'setup', corpus) : null,reproduction: mode === 'comprehensive' ? measuredRate(expected, results, 'reproduction', corpus) : null,repair: mode === 'comprehensive' ? measuredRate(expected, results, 'repair', corpus) : null,@@ -779,7 +805,8 @@ export function scoreEval(matrix: EvalMatrix, observations: EvalResult[], qualif}/** Bind a complete collected batch and every trusted judgment to the matrix's producer receipts. */-function validateCollectedBatch(matrix: EvalMatrix, batch: ProducerBatch, observations: EvalResult[]): Map<string, ProducerReceiptIndex> {+/** Validate the batch against its judgments; a failed producer receipt's report counts nothing, whatever the judge read. */+function validateCollectedBatch(matrix: EvalMatrix, batch: ProducerBatch, observations: EvalResult[]): EvalResult[] {if (!Array.isArray(observations)) throw new Error('INVALID_EVAL_RESULTS');if (!batch || batch.schemaVersion !== 1 || batch.matrixHash !== matrixHash(matrix) || !HEX.test(batch.scheduleHash) || !HEX.test(batch.batchHash)) throw new Error('INVALID_PRODUCER_BATCH');const { batchHash, ...withoutHash } = batch;@@ -792,7 +819,7 @@ function validateCollectedBatch(matrix: EvalMatrix, batch: ProducerBatch, observif (!cell || receipts.has(cell.id)) throw new Error('INVALID_PRODUCER_BATCH');validateReceiptIndex(receipt, cell); receipts.set(cell.id, receipt);}- assertPlatformIdentities(batch.receipts);+ assertPlatformIdentities(batch.receipts, batch.embeddedCatalogs);if (profileOf(matrix) === 'full') {const actualModels = new Map<string, Partial<Record<EvalVersion, string>>>();for (const receipt of batch.receipts) {@@ -805,33 +832,32 @@ function validateCollectedBatch(matrix: EvalMatrix, batch: ProducerBatch, observconst receipt = receipts.get(result.cellId);if (!receipt || result.producerReceiptHash !== receipt.receiptHash) throw new Error('UNBOUND_EVAL_RESULT');}- return receipts;+ return observations.map(result => receipts.get(result.cellId)!.status === 'failed' ? { ...result, reportFinished: false, reportComplete: false } : result);}/** Release scoring path: every trusted judgment must bind to a collected producer receipt. */export function scoreCollectedEval(matrix: EvalMatrix, batch: ProducerBatch, observations: EvalResult[], qualification: ReleaseQualification = { containment: {} }, corpus: EvalCorpusManifest = loadCorpusManifest(), baseline?: EvalBaseline) {validateMatrix(matrix, corpus);if (profileOf(matrix) === 'baseline') throw new Error('BASELINE_PROFILE_NOT_QUALIFIABLE: use createEvalBaseline');- validateCollectedBatch(matrix, batch, observations);+ const counted = validateCollectedBatch(matrix, batch, observations);if (baseline !== undefined) {const { modelUsed, providerIdentity: { family, policyRevision, version } } = batch.receipts[0];if (baseline?.modelUsed !== modelUsed || JSON.stringify(baseline?.provider) !== JSON.stringify({ family, policyRevision, version })) throw new Error('UNBOUND_EVAL_BASELINE');}- const score = scoreEval(matrix, observations, qualification, corpus, baseline);+ const score = scoreEval(matrix, counted, qualification, corpus, baseline);return { ...score, producerBatchHash: batch.batchHash };}/*** Turn a complete, fully adjudicated v2 baseline run into a reusable record.- * Missing reports count as misses; an incomplete or unadjudicated run is refused.+ * Missing reports, and reports behind a failed producer receipt, count as misses; an incomplete or unadjudicated run is refused.*/export function createEvalBaseline(matrix: BaselineEvalMatrix, batch: ProducerBatch, observations: EvalResult[], corpus: EvalCorpusManifest = loadCorpusManifest()): EvalBaseline {if (matrix?.profile !== 'baseline') throw new Error('INVALID_EVAL_BASELINE_MATRIX');validateMatrix(matrix, corpus);- validateCollectedBatch(matrix, batch, observations);- const results = validatedResults(matrix, observations, corpus);+ const results = validatedResults(matrix, validateCollectedBatch(matrix, batch, observations), corpus);if (results.size !== matrix.cells.length) throw new Error('INCOMPLETE_EVAL_BASELINE');- if ([...results.values()].some(result => result.reportPresent && result.reportComplete && result.findings.some(finding => finding.evidence !== 'hypothesis' && finding.judgment === 'unadjudicated'))) throw new Error('UNADJUDICATED_EVAL_BASELINE');+ if ([...results.values()].some(result => result.reportFinished && result.findings.some(finding => finding.evidence !== 'hypothesis' && finding.judgment === 'unadjudicated'))) throw new Error('UNADJUDICATED_EVAL_BASELINE');const vulnerable = new Map(matrix.cells.filter(cell => cell.variant === 'vulnerable').map(cell => [cell.caseId, cell]));const { modelUsed, providerIdentity: { family, policyRevision, version } } = batch.receipts[0];const record: Omit<EvalBaseline, 'baselineHash'> = {diff --git a/scripts/cso-runtime-promotion.ts b/scripts/cso-runtime-promotion.tsindex 4ba5c2e7d..d7779dbbf 100644--- a/scripts/cso-runtime-promotion.ts+++ b/scripts/cso-runtime-promotion.ts@@ -339,10 +339,10 @@ if (import.meta.main) {const catalog = validateEvaluationCandidate(readCatalogArtifact(args[1]), buildInputs);process.stdout.write(`EVALUATION-ONLY ${catalog.revision}\n`);} else if (args[0] === 'evaluation-candidate') {- if (args.length !== 5 || args[1] !== '--staged-root' || args[3] !== '--output') {- throw new Error('Usage: cso-runtime-promotion.ts evaluation-candidate --staged-root <directory> --output <new-file>');+ if (![5, 7].includes(args.length) || args[1] !== '--staged-root' || args[3] !== '--output' || (args.length === 7 && args[5] !== '--created-at')) {+ throw new Error('Usage: cso-runtime-promotion.ts evaluation-candidate --staged-root <directory> --output <new-file> [--created-at <ISO time>]');}- const candidate = evaluationCandidateCatalog(committedCatalog, buildInputs, collectEvidence(args[2], 'staged-image.json'), new Date().toISOString());+ const candidate = evaluationCandidateCatalog(committedCatalog, buildInputs, collectEvidence(args[2], 'staged-image.json'), args[6] ?? new Date().toISOString());const output = path.resolve(args[4]);fs.writeFileSync(output, JSON.stringify(candidate, null, 2) + '\n', { flag: 'wx', mode: 0o600 });process.stdout.write(`${output}\n`);diff --git a/test/cso-eval.test.ts b/test/cso-eval.test.tsindex 9fe40e5a6..e75ef38f3 100644--- a/test/cso-eval.test.ts+++ b/test/cso-eval.test.ts@@ -11,9 +11,13 @@ import type { Family, ProviderAdapter, RunOpts, RunResult } from './helpers/provimport { CORPUS_VERSION, FAMILIES, STACKS, defineEvalCorpus, loadCorpusManifest, materializeCase, sourceFiles, sourceHash, validateCorpusManifest, type CorpusManifest, type EvalVariant } from './fixtures/cso-eval/materialize';import { judgeRepair, oracleFor, type PrivateEvidence } from './helpers/cso-eval-oracles';import { inspectPreparation } from '../lib/cso/preparation';-import { assertRuntimeCompatible, RUNTIME_CATALOG } from '../lib/cso/runtime-catalog';+import { assertRuntimeCompatible, CSO_HELPER_ABI, RUNTIME_CATALOG, type RuntimeCatalog } from '../lib/cso/runtime-catalog';import { canonicalStartPlan, canonicalTestPlan } from '../lib/cso/verification';-import { CsoError } from '../lib/cso/contracts';+import { canonical, CsoError } from '../lib/cso/contracts';+import committedRuntimeCatalog from '../lib/cso/runtime-catalog.json';+import buildInputs from '../lib/cso/images/build-inputs.json';+import { imageBuildMatrix } from '../scripts/cso-image-matrix';+import { evaluationCandidateCatalog } from '../scripts/cso-runtime-promotion';import { scan } from '../lib/redact-engine';import { redactProducerText, sourceCredentialValues } from '../scripts/cso-eval-output-redaction';import { geminiProducerPaths, geminiProducerSystemSettings } from './helpers/providers/gemini';@@ -50,7 +54,7 @@ function syntheticResultFor(cell: EvalCell, manifest: CorpusManifest<string>): Econst positive = cell.variant === 'vulnerable';const repairEvidenceHash = 'c'.repeat(64), recheckEvidenceHash = 'd'.repeat(64);return { cellId: cell.id, sourceHash: cell.sourceHash, skillHash: cell.skillHash, model: cell.model, host: cell.host, budgetSeconds: cell.budgetSeconds,- reportPresent: true, reportComplete: true,+ reportPresent: true, reportFinished: true, reportComplete: true,findings: positive ? [{ id: 'finding-1', evidence: cell.version === 'v2' ? 'legacy_review' : 'supported', claimedTested: runtime && cell.version === 'v3', judgment: 'correct', matchedCaseId: cell.caseId,...(runtime && cell.version === 'v3' ? { trustedVerification: { repair: 'passed' as const, repairEvidenceHash, recheck: 'passed' as const, recheckEvidenceHash } } : {}) }] : [],setup: runtime ? 'passed' : 'not_attempted', reproduction: runtime && positive ? 'passed' : 'not_attempted', repair: runtime && positive ? 'passed' : 'not_attempted', recheck: runtime && positive ? 'passed' : 'not_attempted',@@ -202,14 +206,33 @@ describe('CSO matched evaluation accounting', () => {expect(group(score, 'v3', 'comprehensive').highCriticalRecall).toEqual({ numerator: 96, denominator: 96, value: 1 });expect(score.perStack.rails).toEqual({ correctHeldOutRepairs: 10, denominator: 10 });});- test('incomplete mandatory reports cannot contribute security evidence or qualify a complete matrix', () => {+ test('finished partial reports count their findings and outcomes; completeness stays its own measured, gated rate', () => {const results = matrix.cells.map(syntheticResult);for (const result of results) result.reportComplete = false;const score = scoreEval(matrix, results, qualification), daily = group(score, 'v3', 'daily'), comprehensive = group(score, 'v3', 'comprehensive');+ expect(daily.reports).toEqual({ numerator: 0, denominator: 240, value: 0 });+ expect(daily.finishedReports).toEqual({ numerator: 240, denominator: 240, value: 1 });+ expect(daily.precision).toEqual({ numerator: 120, denominator: 120, value: 1 });+ expect(comprehensive.highCriticalRecall).toEqual({ numerator: 96, denominator: 96, value: 1 });+ expect(comprehensive.repair.numerator).toBe(comprehensive.repair.denominator);+ expect(score.perStack.rails).toEqual({ correctHeldOutRepairs: 10, denominator: 10 });+ expect(score.gates).toMatchObject({ comprehensiveHighCriticalRecall80: 'pass', dailyPrecision95: 'pass', mandatoryReports: 'fail', matchedCompleteMatrix: 'fail' });+ expect(score.status).toBe('partial');+ });+ test('running or missing reports contribute no security evidence and cannot qualify a complete matrix', () => {+ const results = matrix.cells.map(syntheticResult);+ results.forEach((result, index) => {+ result.reportComplete = false; result.reportFinished = false;+ if (index % 2) { result.reportPresent = false; result.findings = []; }+ });+ expect(() => scoreEval(matrix, [{ ...syntheticResult(matrix.cells[0]), reportFinished: false }], qualification)).toThrow('MISSING_EVAL_REPORT');+ expect(() => scoreEval(matrix, [{ ...syntheticResult(matrix.cells[0]), reportPresent: false, reportComplete: false, findings: [] }], qualification)).toThrow('MISSING_EVAL_REPORT');+ const score = scoreEval(matrix, results, qualification), daily = group(score, 'v3', 'daily'), comprehensive = group(score, 'v3', 'comprehensive');expect(score.status).toBe('partial');expect(score.gates.matchedCompleteMatrix).toBe('fail');expect(score.gates.mandatoryReports).toBe('fail');expect(daily.reports).toEqual({ numerator: 0, denominator: 240, value: 0 });+ expect(daily.finishedReports).toEqual({ numerator: 0, denominator: 240, value: 0 });expect(daily.precision).toEqual({ numerator: 0, denominator: 0, value: null });expect(daily.recall.numerator).toBe(0);expect(comprehensive.setup.numerator).toBe(0);@@ -431,6 +454,52 @@ describe('CSO release profile on an injected corpus', () => {expect(() => scoreCollectedEval(release, syntheticBatch(), results, qualification, privateManifest)).toThrow('INVALID_PRODUCER_BATCH');expect(() => scoreEval(release, [syntheticResult(publicCell)], qualification, privateManifest)).toThrow('UNKNOWN_OR_DUPLICATE_EVAL_RESULT');});+ test('artifact inventories need unique paths in the order their identity hash binds, including 1.91.75 locale order', () => {+ const release = createEvalMatrix(releaseOptions, privateManifest), schedule = syntheticSchedule(release), cell = release.cells[0];+ const withEntries = (paths: string[]) => {+ const receipt = syntheticReceipt(cell), entries = paths.map(path => ({ path: `${'e'.repeat(24)}/1791702612575-${'a'.repeat(16)}/${path}`, sha256: sha256(path), bytes: 1 }));+ const base = { schemaVersion: 1 as const, root: 'security/cso' as const, entries, totalBytes: entries.length };+ receipt.artifacts = { ...base, identityHash: producerArtifactInventoryHash(base) };+ return rehashReceipt(receipt);+ };+ for (const order of [['README.md', 'package.json', 'snapshot.json', 'snapshot/x'], ['package.json', 'README.md', 'snapshot.json', 'snapshot/x']]) {+ expect(collectProducerReceipts(release, schedule, [withEntries(order)], privateManifest).summary.submitted).toBe(1);+ }+ expect(() => collectProducerReceipts(release, schedule, [withEntries(['README.md', 'package.json', 'README.md'])], privateManifest)).toThrow('INVALID_PRODUCER_RECEIPT');+ });+ test('platforms whose evaluation catalogs differ only in qualification time match when the embedded bodies prove it', () => {+ const staged = imageBuildMatrix(buildInputs).include.map(row => ({+ schemaVersion: 1, helperAbi: CSO_HELPER_ABI, state: 'staged', verifiedProvenance: true, buildRevision: row.inputRevision, runtimeId: row.runtimeId, stack: row.stack, platform: row.platform,+ image: `ghcr.io/garrytan/gstack/cso-staging/${row.stack}-${row.arch}@sha256:${sha256(row.runtimeId)}`, versions: row.versions, sourceCommit: 'a'.repeat(40),+ workflow: 'https://github.com/garrytan/gstack/actions/runs/123456', sbomDigest: `sha256:${sha256(`sbom:${row.runtimeId}`)}`, provenanceDigest: `sha256:${sha256(`provenance:${row.runtimeId}`)}`,+ qualification: 'pending native and private release gates; no automatic promotion',+ }));+ const [amdCatalog, armCatalog] = ['2026-10-11T07:05:29.256Z', '2026-10-11T07:05:32.067Z'].map(at => evaluationCandidateCatalog(committedRuntimeCatalog, buildInputs, staged, at));+ const release = createEvalMatrix(releaseOptions, privateManifest), schedule = syntheticSchedule(release);+ const amd = release.cells.find(cell => cell.platform === 'linux/amd64')!, arm = release.cells.find(cell => cell.platform === 'linux/arm64')!;+ const embedding = (cell: EvalCell, catalog: RuntimeCatalog) => {+ const receipt = syntheticReceipt(cell), { identityHash: _hash, ...identity } = receipt.installationIdentity;+ identity.embeddedCatalogs = { ...identity.embeddedCatalogs, runtimeRevision: catalog.revision, runtimeSha256: sha256(JSON.stringify(catalog)) };+ receipt.installationIdentity = { ...identity, identityHash: producerInstallationIdentityHash(identity) };+ return rehashReceipt(receipt);+ };+ const receipts = [embedding(amd, amdCatalog), embedding(arm, armCatalog)];+ expect(() => collectProducerReceipts(release, schedule, receipts, privateManifest)).toThrow('UNMATCHED_PRODUCER_INSTALLATIONS');+ const batch = collectProducerReceipts(release, schedule, receipts, privateManifest, [armCatalog, amdCatalog]);+ expect(batch.embeddedCatalogs).toEqual([armCatalog, amdCatalog]);+ expect(collectProducerReceipts(release, schedule, [embedding(amd, amdCatalog), embedding(arm, amdCatalog)], privateManifest).embeddedCatalogs).toBeUndefined();+ const complete = collectProducerReceipts(release, schedule, release.cells.map(cell => embedding(cell, cell.platform === 'linux/amd64' ? amdCatalog : armCatalog)), privateManifest, [amdCatalog, armCatalog]);+ const results = release.cells.map(cell => ({ ...syntheticResultFor(cell, privateManifest), producerReceiptHash: complete.receipts.find(receipt => receipt.cell.id === cell.id)!.receiptHash }));+ expect(scoreCollectedEval(release, complete, results, qualification, privateManifest).groups.every(item => item.submitted === item.cells)).toBe(true);+ const { batchHash: _batchHash, embeddedCatalogs: _catalogs, ...stripped } = complete;+ expect(() => scoreCollectedEval(release, { ...stripped, batchHash: sha256(JSON.stringify(stripped)) }, results, qualification, privateManifest)).toThrow('UNMATCHED_PRODUCER_INSTALLATIONS');+ const movedImage = structuredClone(armCatalog); movedImage.runtimes[0].image = movedImage.runtimes[0].image.replace(/@sha256:.{8}/, '@sha256:00000000');+ movedImage.evaluation!.evidenceDigest = `sha256:${sha256(canonical(movedImage.runtimes))}`;+ for (const bodies of [[amdCatalog], [amdCatalog, amdCatalog], [amdCatalog, movedImage]]) {+ const tampered = bodies.includes(movedImage) ? [embedding(amd, amdCatalog), embedding(arm, movedImage)] : receipts;+ expect(() => collectProducerReceipts(release, schedule, tampered, privateManifest, bodies)).toThrow('UNMATCHED_PRODUCER_INSTALLATIONS');+ }+ });test('identity checks hold per platform and require shared catalogs and provider policy across platforms', () => {const release = createEvalMatrix(releaseOptions, privateManifest), schedule = syntheticSchedule(release);const amd = release.cells.filter(cell => cell.platform === 'linux/amd64'), arm = release.cells.find(cell => cell.platform === 'linux/arm64')!;@@ -468,6 +537,17 @@ describe('CSO release profile on an injected corpus', () => {const regressed = scoreCollectedEval(release, batch, results, qualification, privateManifest, baseline);expect(regressed.gates.noHighCriticalRecallRegression).toBe('fail'); expect(regressed.baseline!.highCriticalRecall.value).toBe(1);});+ test('a baseline finds a seeded issue in a finished partial report, never in a running or missing one', () => {+ const vulnerable: string[] = [];+ const baseline = privateBaseline((results, cells) => {+ const indexes = cells.flatMap((cell, index) => cell.variant === 'vulnerable' ? [index] : []).slice(0, 3);+ vulnerable.push(...indexes.map(index => cells[index].caseId));+ results[indexes[0]].reportComplete = false;+ Object.assign(results[indexes[1]], { reportComplete: false, reportFinished: false });+ Object.assign(results[indexes[2]], { reportComplete: false, reportFinished: false, reportPresent: false, findings: [] });+ });+ expect(vulnerable.map(caseId => baseline.cases.find(entry => entry.caseId === caseId)!.found)).toEqual([true, false, false]);+ });test('baseline records refuse incomplete or unadjudicated runs and baseline matrices never qualify', () => {expect(() => privateBaseline(results => { results.pop(); })).toThrow('INCOMPLETE_EVAL_BASELINE');expect(() => privateBaseline((results, cells) => { results[cells.findIndex(cell => cell.variant === 'vulnerable')].findings[0].judgment = 'unadjudicated'; })).toThrow('UNADJUDICATED_EVAL_BASELINE');@@ -949,6 +1029,54 @@ describe('CSO matched producer orchestration', () => {}});+ test('collects and scores real receipts of every kind: succeeded, span-redacted, credential-withheld, timeout and post-run check failure', async () => {+ const platform = producerHostPlatform();+ if (!platform) return;+ const launcher = helperBundle(), runId = `${Date.now()}-${randomHex(8)}`, run = `${'e'.repeat(24)}/${runId}`;+ const helperFiles = ['readable/.env', 'readable/README.md', 'report.json', 'report.md', `scanner-outcomes/gitleaks-${randomHex(8)}-${randomHex(8)}.json`, 'snapshot.json', 'snapshot/README.md', 'snapshot/package.json'];+ const kinds: Array<[string, Partial<RunResult>, ((source: string) => void)?]> = [+ ['succeeded', {}],+ ['span-redacted', { output: `complete — run ${runId}; /health-hooks reaches 169.254.169.254:80` }],+ ['credential-withheld', { output: `complete — quoted sk-ant-api03-${randomHex(40)}` }],+ ['timeout', { output: 'last assistant text before the kill', error: { code: 'timeout', reason: 'exceeded 2100000ms' } }],+ ['post-run-check-failed', {}, source => { const file = join(source, 'src', 'app.txt'); chmodSync(file, 0o644); writeFileSync(file, 'changed by producer\n'); chmodSync(file, 0o444); }],+ ];+ const produce = async (target: EvalMatrix, payloads: Partial<Record<'v2' | 'v3', string>>) => {+ const prepared = join(root(), 'prepared'), schedule = prepareEvalJobs(target, payloads, prepared, undefined, privateCorpus);+ const receipts: ProducerReceipt[] = [];+ for (const [index, cell] of target.cells.entries()) {+ const [, outcome, mutate] = kinds[index % kinds.length], isolated = isolate(prepared, cell);+ const adapter = new FakeAdapter(opts => {+ for (const file of helperFiles) { const path = join(process.env.GSTACK_HOME!, 'security', 'cso', run, file); mkdirSync(dirname(path), { recursive: true }); writeFileSync(path, `${file}\n`); }+ mutate?.(opts.csoProducer!.sourceDirectory);+ }, 'gpt-5.4', 'gpt', outcome);+ receipts.push(await runProducerCell(isolated.input, join(root(), `${cell.id}.json`), withHelper({ adapter, paidExecutionAuthorized: true }, launcher)));+ }+ return { schedule, receipts, results: target.cells.map(cell => ({ ...syntheticResultFor(cell, privateManifest), producerReceiptHash: receipts.find(receipt => receipt.cellRef === cell.id)!.receiptHash })) };+ };+ const platforms = Object.fromEntries(privateManifest.cases.map(fixture => [fixture.id, platform]));+ const baselineMatrix = createEvalMatrix({ profile: 'baseline', model: 'exact-eval-model', host: 'codex', skillHashes: { v2: sha256(skills.v2) }, platforms: { comprehensive: platforms } }, privateManifest);+ const baseline = await produce(baselineMatrix, { v2: skills.v2 });+ expect(baseline.receipts.slice(0, kinds.length).map(receipt => [receipt.status, receipt.error?.code ?? null, receipt.artifacts.entries.length])).toEqual([+ ['succeeded', null, 8], ['succeeded', null, 8], ['failed', 'unknown', 8], ['failed', 'timeout', 8], ['failed', 'INVALID_PRODUCER_SOURCE', 0],+ ]);+ expect(baseline.receipts[0].artifacts.entries.map(entry => entry.path)).toEqual(helperFiles.map(file => `${run}/${file}`));+ expect(baseline.receipts[1].output).toBe(`complete — run ${runId}; /health-hooks reaches <REDACTED-pii.phone.e164>:80`);+ expect(baseline.receipts[2]).toMatchObject({ output: '[sensitive producer output redacted]', error: { reason: 'Sensitive producer output or error withheld: credential-class rule anthropic.key×1' } });+ const baselineBatch = collectProducerReceipts(baselineMatrix, baseline.schedule, baseline.receipts, privateManifest);+ expect(baselineBatch.summary.groups).toMatchObject([{ version: 'v2', mode: 'comprehensive', scheduled: 16, submitted: 16, succeeded: 7, failed: 9 }]);+ const recorded = createEvalBaseline(baselineMatrix, baselineBatch, baseline.results, privateManifest);+ expect(recorded.baselineHash).toMatch(/^[a-f0-9]{64}$/);+ const succeeded = new Set(baseline.receipts.filter(receipt => receipt.status === 'succeeded').map(receipt => receipt.cellRef));+ const vulnerableCell = (caseId: string) => baselineMatrix.cells.find(cell => cell.caseId === caseId && cell.variant === 'vulnerable')!.id;+ expect(recorded.cases.map(item => item.found)).toEqual(recorded.cases.map(item => succeeded.has(vulnerableCell(item.caseId))));+ expect(recorded.cases.some(item => item.found) && recorded.cases.some(item => !item.found)).toBe(true);+ const releaseMatrix = createEvalMatrix({ profile: 'release', model: 'exact-eval-model', host: 'codex', skillHashes: { v3: sha256(skills.v3) }, platforms: { daily: platform, comprehensive: platforms } }, privateManifest);+ const release = await produce(releaseMatrix, { v3: skills.v3 });+ const scored = scoreCollectedEval(releaseMatrix, collectProducerReceipts(releaseMatrix, release.schedule, release.receipts, privateManifest), release.results, { containment: {} }, privateManifest);+ expect(scored.groups.map(item => [item.version, item.mode, item.submitted])).toEqual([['v3', 'daily', 16], ['v3', 'comprehensive', 16]]);+ }, 120_000);+const expectIntegrityReceipt = (receipt: ProducerReceipt, receiptPath: string, error: { code: string; reason: string }) => {expect(receipt).toMatchObject({ status: 'failed', error, output: '', outputHash: sha256(''), durationMs: 1234, toolCalls: 4, usage: { inputTokens: 120, outputTokens: 30, cachedTokens: 10, estimatedCostUSD: 0.0042 } });expect(receipt.artifacts.entries).toEqual([]);diff --git a/test/cso-runtime-promotion.test.ts b/test/cso-runtime-promotion.test.tsindex 5725762aa..ba0745f22 100644--- a/test/cso-runtime-promotion.test.ts+++ b/test/cso-runtime-promotion.test.ts@@ -1,5 +1,9 @@import { describe, expect, test } from 'bun:test';+import { spawnSync } from 'node:child_process';import { createHash } from 'node:crypto';+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';import committedCatalog from '../lib/cso/runtime-catalog.json';import buildInputs from '../lib/cso/images/build-inputs.json';import { isEvaluationRuntimeCatalog, validateRuntimeCatalog } from '../lib/cso/runtime-catalog';@@ -169,6 +173,22 @@ describe('CSO evaluation-only runtime catalogs', () => {expect(validateEvaluationCandidate(candidate, buildInputs)).toBe(candidate);expect(() => validateEvaluationCandidate(committedCatalog, buildInputs)).toThrow('NOT_AN_EVALUATION_CATALOG');});+ test('evaluation-candidate --created-at writes identical catalog bytes on every platform build', () => {+ const staged = mkdtempSync(join(tmpdir(), 'cso-staged-'));+ try {+ stagedRecords().forEach((record, index) => { mkdirSync(join(staged, `row-${index}`)); writeFileSync(join(staged, `row-${index}`, 'staged-image.json'), JSON.stringify(record)); });+ const build = (name: string, ...extra: string[]) => {+ const output = join(staged, name);+ const result = spawnSync('bun', ['scripts/cso-runtime-promotion.ts', 'evaluation-candidate', '--staged-root', staged, '--output', output, ...extra], { cwd: join(import.meta.dir, '..'), encoding: 'utf8', timeout: 30_000 });+ expect(result.status).toBe(0);+ return readFileSync(output, 'utf8');+ };+ const [amd64, arm64] = ['amd64.json', 'arm64.json'].map(name => build(name, '--created-at', '2026-10-11T07:05:00.000Z'));+ expect(arm64).toBe(amd64);+ expect(JSON.parse(amd64).runtimes.every((runtime: { qualifiedAt: string }) => runtime.qualifiedAt === '2026-10-11T07:05:00.000Z')).toBe(true);+ expect(JSON.parse(build('now.json')).runtimes[0].qualifiedAt).not.toBe('2026-10-11T07:05:00.000Z');+ } finally { rmSync(staged, { recursive: true, force: true }); }+ });test('staging records must come from one run and match the reviewed build rows', () => {const split = stagedRecords(); split[1].workflow = 'https://github.com/garrytan/gstack/actions/runs/999';expect(() => evaluationCandidateCatalog(committedCatalog, buildInputs, split, '2026-10-05T00:00:00.000Z')).toThrow('SPLIT_STAGING_RUN');