From 6d6c7726ecd9917f92bbf9bcc0f368428785e6db Mon Sep 17 00:00:00 2001 From: garrytan Date: Sun, 4 Oct 2026 17:55:00 +0000 Subject: [PATCH] 0.3: after-a-repair runs the shard file when --case cannot resolve a case A case that several files register (carve-section-loading) cannot be selected by --case; its red line now prints the bun test command for the shard file that went red, so every printed command selects exactly one case. --- scripts/lib/paid-report.ts | 9 ++++++++- test/paid-shards.test.ts | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/lib/paid-report.ts b/scripts/lib/paid-report.ts index 8e2bf6492..4174b3ef1 100644 --- a/scripts/lib/paid-report.ts +++ b/scripts/lib/paid-report.ts @@ -433,13 +433,20 @@ function trialCause(trial: PanelVerdict['trials'][number] & TrialDiagnosis & { t * exact test-name filter, a keyless file (its own case) by file. */ export function afterRepairCommand(tier: PaidTier, id: string, file: string, trials = 1): string { - if (Object.hasOwn(E2E_TIERS, id)) return `bun run scripts/test-paid-shards.ts --tier ${tier} --case ${id}${trials > 1 ? ` --trials ${trials}` : ''}`; + if (Object.hasOwn(E2E_TIERS, id) && resolvesAlone(id)) return `bun run scripts/test-paid-shards.ts --tier ${tier} --case ${id}${trials > 1 ? ` --trials ${trials}` : ''}`; if (Object.hasOwn(LLM_JUDGE_TOUCHFILES, id)) { return `EVALS=1 EVALS_TIER=${tier} EVALS_JUDGE_SELECTION_JSON='${JSON.stringify({ version: 1, selected: [id], reason: 'after a repair' })}' bun test ${file} -t '${caseTestNamePattern([id])}'`; } return `EVALS=1 EVALS_TIER=${tier} bun test ${file}`; } +const resolved = new Map(); +/** Whether --case can select this E2E id (a case several files register runs by its shard file instead). */ +function resolvesAlone(id: string): boolean { + if (!resolved.has(id)) { try { caseSelection(id); resolved.set(id, true); } catch { resolved.set(id, false); } } + return resolved.get(id)!; +} + /** One line per non-PASS or split panel verdict. `artifacts` names each slice's artifact (slice -> name). */ export function formatPanelLine(panel: PanelReport, tier: PaidTier, ctx: { artifacts?: Map; runId?: string } = {}): string { const mark = panel.status === 'PASS' ? '⚠' : panel.failsLane ? '✗' : '◌'; diff --git a/test/paid-shards.test.ts b/test/paid-shards.test.ts index bec8a1f82..6f3f1470c 100644 --- a/test/paid-shards.test.ts +++ b/test/paid-shards.test.ts @@ -58,6 +58,7 @@ import { runCaseDiagnosis, caseFile, caseSelection, + afterRepairCommand, parseCliOptions, loadPaidTestDurations, shardDurationViolations, @@ -795,6 +796,9 @@ console.log("Ran 1 tests across 1 files. [1ms]"); process.exit(${fail ? 1 : 0}); expect(caseSelection('review-coverage-audit')).toMatchObject({ file: 'test/skill-e2e-coverage-audit.test.ts', mode: 'name' }); expect(caseSelection('plan-eng-multi-finding-batching').file).toBe('test/skill-e2e-plan-eng-multi-finding-batching.test.ts'); expect(caseSelection('review-sql-injection')).toMatchObject({ file: 'test/skill-e2e-review.test.ts', mode: 'name' }); + // The report's after-a-repair command selects exactly one case: --case when it resolves, else that shard's file. + expect(afterRepairCommand('gate', 'plan-mode-no-op', 'test/skill-e2e-plan-mode-no-op.test.ts')).toBe('bun run scripts/test-paid-shards.ts --tier gate --case plan-mode-no-op'); + expect(afterRepairCommand('periodic', 'carve-section-loading', 'test/carve-section-loading-qa.test.ts')).toBe('EVALS=1 EVALS_TIER=periodic bun test test/carve-section-loading-qa.test.ts'); }); test('B4: --list prints the selection; an unknown id exits non-zero before any process starts', () => {