Merge origin/main (v1.91.7.0) into test-audit-reduction

Keep both intents: v1.91.7.0's functional QA, docsync and exploratory
paid cases and their free owners stay; this branch's deletions stay
deleted. main's new paid keys follow the derived-closure touchfile rule
(free *.test.ts paths dropped, static helper/fixture closure added), its
new helper-only tests join the ratchet baseline, and its free selection
examples that named free test files now assert the derived selection.

Periodic CI keeps seven slices without the retired Autoplan slice; the
gate census keeps seven single-worker slices with --skip-judges. Wall
and census literals are recomputed from the merged planner, durations
are re-recorded on Ubicloud, and VERSION stays 1.91.8.0 above 1.91.7.0.
This commit is contained in:
garrytan committed 2026-09-29 13:48:02 +00:00
commit b421bba2c9
325 files changed
+42569 -8257

No files matched your search

+68 -2
View File
@@ -24,6 +24,7 @@ import {
paidShardWallUpperBoundMs,
parseCliOptions,
parseRunManifest,
resolvePaidShardBudget,
SUPERVISED_WORKER_COUNTS,
retriesForFiles,
RETRY_OVERRIDES,
@@ -165,12 +166,77 @@ describe('recorded-duration slice packing', () => {
} as SliceResult]);
expect(merged).toEqual({ 'test/a.test.ts': 42_000, 'test/b.test.ts': 5_000, 'test/g.test.ts': 70_000 });
expect(Object.keys(merged)).toEqual(['test/a.test.ts', 'test/b.test.ts', 'test/g.test.ts']);
expect(() => parseCliOptions(['--write-durations'])).toThrow('--write-durations requires --report');
expect(parseCliOptions(['--report', '/tmp/r', '--write-durations']).writeDurations).toBe(true);
expect(() => parseCliOptions(['--write-durations'], {})).toThrow('--write-durations requires --report');
expect(parseCliOptions(['--report', '/tmp/r', '--write-durations'], {}).writeDurations).toBe(true);
});
});
describe('manifest executor scope', () => {
test('list-only validates and prints the selected manifest slice without launching tests or writing results', () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'paid-manifest-list-'));
try {
const receipt = path.join(dir, 'launched.json');
const file = path.join(dir, 'skill-e2e-list-probe.test.ts');
fs.writeFileSync(file, `import { test } from 'bun:test';
import { writeFileSync } from 'node:fs';
test('local launch sentinel', () => writeFileSync(${JSON.stringify(receipt)}, 'true'));`);
const manifest: PaidRunManifest = {
version: 1, tier: 'gate', evalsAll: true, sliceCount: 3, selectionReason: 'local list-only fixture',
entries: [
{ file, slice: 1, status: 'planned' },
{ file: 'test/skill-e2e-plan.test.ts', slice: 2, status: 'planned',
budget: resolvePaidShardBudget(['test/skill-e2e-plan.test.ts']) },
],
};
const manifestPath = path.join(dir, 'manifest.json');
fs.writeFileSync(manifestPath, JSON.stringify(manifest));
const evalDir = path.join(dir, 'evals');
const env = {
PATH: path.dirname(process.execPath),
...(process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}),
HOME: dir, TMPDIR: dir, TEMP: dir, TMP: dir,
EVALS_PREFLIGHT_OK: '1', GSTACK_CLAUDE_CLI_VERSION: 'free-fixture', GSTACK_EVAL_DIR: evalDir,
};
const run = (args: string[], disablePreflightTools = false) => {
const result = spawnSync(process.execPath, [path.join(ROOT, 'scripts/test-paid-shards.ts'),
'--plan', manifestPath, '--list', ...args], { cwd: ROOT,
env: disablePreflightTools ? { ...env, PATH: dir, EVALS_PREFLIGHT_OK: '' } : env,
encoding: 'utf8', timeout: 10_000 });
expect(result.error).toBeUndefined();
expect(fs.existsSync(receipt)).toBe(false);
expect(fs.existsSync(evalDir)).toBe(false);
return result;
};
const selected = run(['--slice', '1', '--jobs', '1', '--timeout', '5']);
expect(selected.status, selected.stderr).toBe(0);
expect(selected.stdout).toContain('slice 1/3: 1 shard(s)');
expect(selected.stdout).toContain(`${file} wall=5000ms source=explicit policy=none`);
expect(selected.stdout).not.toContain('skill-e2e-plan.test.ts');
const noPreflight = run(['--slice', '1'], true);
expect(noPreflight.status, noPreflight.stderr).toBe(0);
expect(noPreflight.stdout).toContain(file);
const registered = run(['--slice', '2']);
expect(registered.status, registered.stderr).toBe(0);
expect(registered.stdout).toContain('skill-e2e-plan.test.ts');
expect(registered.stdout).toContain('source=registered policy=skill-e2e-plan-existing-retry-v1');
const empty = run(['--slice', '3']);
expect(empty.status, empty.stderr).toBe(0);
expect(empty.stdout).toContain('slice 3/3: 0 shard(s)');
for (const [args, error] of [
[['--slice', '4'], 'exceeds manifest sliceCount'],
[['--slice', '1', '--tier', 'periodic'], 'refusing a cross-tier run'],
[[], '--plan and --slice must be used together'],
] as const) {
const invalid = run([...args]);
expect(invalid.status).toBe(1);
expect(invalid.stderr).toContain(error);
}
expect(fs.readFileSync(manifestPath, 'utf8')).toBe(JSON.stringify(manifest));
} finally {
fs.rmSync(dir, { recursive: true, force: true });
}
}, 60_000);
test('a conflicting inherited carve scope cannot suppress a planned case; direct Bun stays scoped', () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'paid-manifest-scope-'));
const fixtureRoot = path.join(dir, 'fixture');