From b27c77c8bc2f375efad03546e75fede89db16824 Mon Sep 17 00:00:00 2001 From: garrytan Date: Sat, 3 Oct 2026 01:49:29 +0000 Subject: [PATCH] test(W7h): delete incompleteFirstFileView, which no paid case uses W7h retirement (task scope: "incompleteFirstFileView + its free test in test/shared-libs-fixture.test.ts if no paid case uses it"). `grep -rn incompleteFirstFileView test scripts` showed only the export in test/helpers/shared-libs-eval-fixture.ts and its own free describe block; no paid case or grader calls it, so the helper and the two tests that pinned it are dead code. Retirement card: - test: shared-libs-fixture.test.ts 'incompleteFirstFileView (census 36641820398 shared-libs-pr-coverage)' (2 tests). - detects: regressions in a page-1 recovery classifier nothing consumes. - non_test_callers: none. - replacement: none needed; the shared-libs page budgets that a recovery read is charged to stay enforced by the kept budget function and its tests. - validation: bun test test/shared-libs-fixture.test.ts (241 pass); bun run typecheck. --- test/helpers/shared-libs-eval-fixture.ts | 15 --------------- test/shared-libs-fixture.test.ts | 19 +------------------ 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/test/helpers/shared-libs-eval-fixture.ts b/test/helpers/shared-libs-eval-fixture.ts index 68678e97b..d54b70425 100644 --- a/test/helpers/shared-libs-eval-fixture.ts +++ b/test/helpers/shared-libs-eval-fixture.ts @@ -1049,21 +1049,6 @@ export function prCoverageRequestViolations(endpoints: string[]): string[] { return violations; } -/** Whether the first read of a PR's file-list page 1 left no usable file set: - * truncated by `head -c`, or a failed filter (e.g. a jq error) that printed no - * file entries. One recovery read of page 1 is then legitimate, still charged - * to the page budget. */ -export function incompleteFirstFileView(result: { toolCalls: Array<{ tool: string; input: any; output?: string }> }, pr: number): boolean { - const page1 = new RegExp(String.raw`\b(?:gh\s+api|curl)\b[^;\n]*\/pulls\/${pr}\/files(?![^;\n]*[?&]page=(?!1\b)\d)`); - const first = result.toolCalls.find(call => call.tool === 'Bash' && page1.test(String(call.input?.command || ''))); - if (!first) return false; - const command = String(first.input?.command || ''); - if (new RegExp(String.raw`\b(?:gh\s+api|curl)\b[^;\n]*\/pulls\/${pr}\/files[^;\n]*\|\s*head\s+-c\s*\d+`).test(command)) return true; - const output = String(first.output ?? ''); - const view = output.slice(Math.max(0, output.search(new RegExp(String.raw`\/pulls\/${pr}\/files|files page 1`)))); - return /^jq: error\b/m.test(view) && !/"filename"\s*:/.test(view); -} - /** A raw-byte change hidden by Git normalization, reproducing a real snapshot blind spot. */ export function installNormalizingFilter(f: SharedLibsFixture): void { // Fixture instrumentation is local: do not introduce a distributed attribute diff --git a/test/shared-libs-fixture.test.ts b/test/shared-libs-fixture.test.ts index 2bbbff13e..5da5616c7 100644 --- a/test/shared-libs-fixture.test.ts +++ b/test/shared-libs-fixture.test.ts @@ -7,7 +7,7 @@ import { execFileSync, spawnSync } from 'node:child_process'; import { createSharedInteractiveToolHandler, createSharedLibsFixture, fixtureGit, fixtureWrite, installSourceShims, installHostileGitConfig, isGuardedGitRequest, reviewLifecycleInstructions, standaloneInstructions, SHARED_LIBS_ROOT, readRequests, seedOpportunitySources, sharedReadOnlyViolations, shellQuote, snapshotFixture, type SharedLibsFixture, - SharedCaptureAccumulator, type SharedCaptureAttempt, isInternalClaudeGitRequest, SHARED_LIBS_OLDER_OPEN_PRS, incompleteFirstFileView, prCoverageRequestViolations, + SharedCaptureAccumulator, type SharedCaptureAttempt, isInternalClaudeGitRequest, SHARED_LIBS_OLDER_OPEN_PRS, prCoverageRequestViolations, } from './helpers/shared-libs-eval-fixture'; import { EvalCollector, type EvalTestEntry } from './helpers/eval-store'; import { collectorOutcomeCounts } from '../scripts/test-paid-shards'; @@ -1716,23 +1716,6 @@ describe('retained native runtime callback failures', () => { }); }); -describe('incompleteFirstFileView (census 36641820398 shared-libs-pr-coverage)', () => { - const call = (command: string, output: string) => ({ tool: 'Bash', input: { command }, output }); - const page1 = 'gh api --method GET "/repos/fixture/shared-libs/pulls/42/files?per_page=100&page=1" 2>&1 | jq -c \'if type=="array" then (length, .[] | {filename,status}) else . end\''; - test('a first page-1 view whose jq filter failed without printing files is incomplete', () => { - const failed = call(`echo "--- PR 42 metadata"; gh api --method GET /repos/fixture/shared-libs/pulls/42 | jq -c .number; echo "--- PR 42 files page 1"; ${page1}`, - 'Exit code 5\n--- PR 42 metadata\n42\n--- PR 42 files page 1 [file-list unit 1]\njq: error (at :1): Cannot index number with string "filename"'); - expect(incompleteFirstFileView({ toolCalls: [failed, call(page1, '{"count":100,"files":[{"filename":"docs/coordination-0.md"}]}')] }, 42)).toBe(true); - }); - test('head truncation still counts; a complete first view or a later-page error does not', () => { - expect(incompleteFirstFileView({ toolCalls: [call(`${page1} | head -c 4000`, '{"filename":"a"')] }, 42)).toBe(true); - expect(incompleteFirstFileView({ toolCalls: [call(page1, '{"count":100,"files":[{"filename":"docs/coordination-0.md"}]}')] }, 42)).toBe(false); - expect(incompleteFirstFileView({ toolCalls: [call(page1, 'jq: error (at :1): x\n{"filename": "docs/a.md"}')] }, 42)).toBe(false); - expect(incompleteFirstFileView({ toolCalls: [call(page1.replace('&page=1', '&page=2'), 'jq: error (at :1): x')] }, 42)).toBe(false); - expect(incompleteFirstFileView({ toolCalls: [call(page1.replace('/pulls/42/', '/pulls/7/'), 'jq: error (at :1): x')] }, 42)).toBe(false); - }); -}); - describe('skip actor: deferred-reuse wording in a Skip option (PR lane run 36641824710)', () => { const question = (skipDescription: string) => ({ questions: [{ question: '[ADVISORY] src/retry-worker.ts:2 — the worker now duplicates the tested `retrySeconds` helper from lib/retry-after.ts. How should this be handled? RECOMMENDATION: A (Fix).',