mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-23 16:41:35 +01:00
Skipped quarantined tests fail the run, and the upgrade snooze sticks for git installs (GST-3344) (#4590)
A quarantined test that the runner skipped now fails the run, and "Not now" on the upgrade prompt now lasts its full snooze on git installs. Why: four outside reports showed a false pass, a snooze that came back after two hours, a model check that ignored `config.toml`, and two `$B` rules missing from /browse. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=red-team
This commit is contained in:
1 parent
0adfab9dd9
commit
e096fa850c
15 files changed
+175
-84
No files matched your search
@@ -187,6 +187,31 @@ describe('gstack-models inspector', () => {
|
||||
expect(doc.errors.map((e: { reason: string; role: string }) => `${e.reason}/${e.role}`)).toEqual(['custom_provider_requires_model/plan-review', 'custom_provider_requires_model/implementation']);
|
||||
});
|
||||
|
||||
// #4491 follow-up: resolve and list read the custom provider's config.toml model the way gstack-codex-probe role-ready does.
|
||||
test('a custom Codex provider naming the frontier catalog ID in config.toml resolves; any other name is not the tier', () => {
|
||||
const { env, home } = fixture();
|
||||
fs.mkdirSync(path.join(home, '.codex'));
|
||||
const toml = (model: string) => fs.writeFileSync(path.join(home, '.codex', 'config.toml'), `model = "${model}"\nmodel_provider = "proxy"\n`);
|
||||
toml('gpt-6-astra');
|
||||
const ok = json(['resolve', '--role', 'plan-review', '--provider', 'openai'], env);
|
||||
expect(ok.code).toBe(0);
|
||||
expect(ok.doc.selections[0]).toMatchObject({ role: 'plan-review', provider: 'openai', requestedModel: 'gpt-6-astra' });
|
||||
expect(json([], env).doc.errors.filter((e: { role: string }) => e.role === 'plan-review')).toEqual([]);
|
||||
toml('my-alias');
|
||||
const alias = json(['resolve', '--role', 'plan-review', '--provider', 'openai'], env);
|
||||
expect(alias.code).toBe(1);
|
||||
expect(alias.doc.errors[0]).toMatchObject({ reason: 'custom_provider_model_not_tier', provider: 'openai' });
|
||||
});
|
||||
|
||||
test('a custom provider whose config.toml model is not a string reports a structured error', () => {
|
||||
const { env, home } = fixture();
|
||||
fs.mkdirSync(path.join(home, '.codex'));
|
||||
fs.writeFileSync(path.join(home, '.codex', 'config.toml'), 'model = 5\nmodel_provider = "proxy"\n');
|
||||
const r = json(['resolve', '--role', 'plan-review', '--provider', 'openai'], env);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.doc.errors[0]).toMatchObject({ reason: 'native_provider_unresolved', provider: 'openai', role: 'plan-review' });
|
||||
});
|
||||
|
||||
test('project settings in the working directory are custom routing; detection limits are published', () => {
|
||||
const { env, root } = fixture();
|
||||
const project = path.join(root, 'project');
|
||||
|
||||
@@ -219,6 +219,7 @@ function fakeRun(reports: (n: number, argv: string[]) => string | null, exits: (
|
||||
const suite = (cases: string, file = 'a.test.ts') => `<testsuites name="bun test"><testsuite name="${file}" file="${file}">${cases}</testsuite></testsuites>`;
|
||||
const pass = (name: string) => `<testcase name="${name}" classname="" file="a.test.ts"/>`;
|
||||
const fail = (name: string) => `<testcase name="${name}" classname="" file="a.test.ts"><failure message="boom"/></testcase>`;
|
||||
const skipped = (name: string) => `<testcase name="${name}" classname="" file="a.test.ts"><skipped/></testcase>`;
|
||||
const Q = new Set(['a.test.ts::::q']);
|
||||
const run = (f: ReturnType<typeof fakeRun>, extra: Partial<Parameters<typeof runFlaky>[0]> = {}) =>
|
||||
runFlaky({ command: ['bun', 'test'], junit: 'r.xml', maxReruns: 3, cwd: tmp(), spawn: f.spawn, env: {}, now: () => NOW, quarantined: Q, ...extra });
|
||||
@@ -307,6 +308,34 @@ describe('the quarantine attempt budget under the full green verdict', () => {
|
||||
expect(renderResult(r, '/l').at(-1)).toContain('failed=0 flaky=0 quarantined=1');
|
||||
});
|
||||
|
||||
// #4550: a quarantined test still runs, so a skip on the attempt that decides the run is a quarantined failure.
|
||||
test('a quarantined test the runner skipped is a quarantined failure and the run is red', async () => {
|
||||
const f = fakeRun(() => suite(skipped('q') + pass('a')), () => 0);
|
||||
const r = await run(f);
|
||||
expect(f.calls).toHaveLength(1);
|
||||
expect(r.exitCode).toBe(1);
|
||||
expect(r.outcomes).toMatchObject([{ status: 'quarantined-fail', attempts: ['skip'], reason: 'quarantined, and skipped on the final attempt instead of running' }]);
|
||||
expect(r.ledger.map(l => [l.kind, l.id, l.attempts])).toEqual([['quarantined-fail', 'a.test.ts::::q', ['skip']]]);
|
||||
expect(renderResult(r, '/l').at(-1)).toBe('FLAKY_RESULT: tests=2 failed=1 flaky=0 quarantined=1 reruns=0 command_exit=0 verdict=fail ledger=/l');
|
||||
});
|
||||
|
||||
test('a quarantined test that passed and was then skipped on the whole-command retry is a quarantined failure', async () => {
|
||||
const f = fakeRun(n => n === 1 ? suite(pass('q') + fail('a')) : suite(skipped('q') + pass('a')), n => n === 1 ? 1 : 0);
|
||||
const r = await run(f);
|
||||
expect(f.calls).toHaveLength(2);
|
||||
expect(r.exitCode).toBe(1);
|
||||
expect(r.ledger.find(l => l.id === 'a.test.ts::::q')).toMatchObject({ kind: 'quarantined-fail', attempts: ['pass', 'skip'] });
|
||||
});
|
||||
|
||||
test('a quarantined test skipped first and passing on the whole-command retry still passes, and an ordinary skip follows the runner', async () => {
|
||||
const retried = fakeRun(n => n === 1 ? suite(skipped('q') + fail('a')) : suite(pass('q') + pass('a')), n => n === 1 ? 1 : 0);
|
||||
const r = await run(retried);
|
||||
expect(r.exitCode).toBe(0);
|
||||
expect(r.outcomes.find(o => o.test.id === 'a.test.ts::::q')).toMatchObject({ status: 'quarantined-pass', attempts: ['skip', 'pass'] });
|
||||
const ordinary = await run(fakeRun(() => suite(skipped('s') + pass('a')), () => 0), { quarantined: new Set() });
|
||||
expect(ordinary).toMatchObject({ exitCode: 0, quarantined: 0, outcomes: [], ledger: [] });
|
||||
});
|
||||
|
||||
test('quarantined failures do not count against --max-reruns', async () => {
|
||||
const f = fakeRun(n => suite(pass('a') + (n === 1 ? fail('q') : pass('q'))), n => n === 1 ? 1 : 0);
|
||||
expect((await run(f, { maxReruns: 0 })).exitCode).toBe(0);
|
||||
|
||||
@@ -96,15 +96,15 @@ for (const host of ['claude', 'codex'] as const) for (const args of [[], tenArgu
|
||||
});
|
||||
test(`${label}: upgrade snooze advances the same-version level`, () => {
|
||||
mkdirSync(join(root, '.gstack'), { recursive: true });
|
||||
writeFileSync(join(root, '.gstack/update-snoozed'), '{new} 1 0\n');
|
||||
writeFileSync(join(root, '.gstack/update-snoozed'), '1.0.1 1 0\n');
|
||||
const block = skill(host, 'gstack-upgrade').match(/```bash\n((?:\[ -d "\$\{GSTACK_ROOT[^\n]*\n(?:GSTACK_BIN=[^\n]*\n)?)?(?:GSTACK_STATE_ROOT=\$\([^\n]*gstack-paths --get GSTACK_STATE_ROOT[^\n]*\n)?_SNOOZE_FILE=[\s\S]*?)```/)![1];
|
||||
// The block resolves the state root through the installed helper first.
|
||||
const bin = join(root, '.claude/skills/gstack/bin');
|
||||
mkdirSync(bin, { recursive: true });
|
||||
mkdirSync(join(dirname(bin), 'lib'), { recursive: true }); // C1: an exported GSTACK_ROOT needs bin/ and lib/
|
||||
for (const name of ['gstack-paths', 'gstack-state-root.sh']) writeFileSync(join(bin, name), readFileSync(join(import.meta.dir, '../bin', name)), { mode: 0o755 });
|
||||
expect(run(apply(block), { GSTACK_STATE_ROOT: join(root, '.gstack'), GSTACK_BIN: bin, GSTACK_ROOT: dirname(bin) }).status).toBe(0);
|
||||
expect(readFileSync(join(root, '.gstack/update-snoozed'), 'utf8')).toMatch(/^\{new\} 2 \d+\n$/);
|
||||
expect(run(apply(block).replace('{line}', 'UPGRADE_AVAILABLE 1.0.0 1.0.1'), { GSTACK_STATE_ROOT: join(root, '.gstack'), GSTACK_BIN: bin, GSTACK_ROOT: dirname(bin) }).status).toBe(0);
|
||||
expect(readFileSync(join(root, '.gstack/update-snoozed'), 'utf8')).toMatch(/^1\.0\.1 2 \d+\n$/);
|
||||
});
|
||||
test(`${label}: health error preserves its diagnostic argument`, () => {
|
||||
const helper = skill(host, 'health').match(/health_capture_error\(\) \{[\s\S]*?\n \}/)![0];
|
||||
|
||||
@@ -171,7 +171,8 @@ describe('equal VERSION, main moved past the checkout', () => {
|
||||
expect(run().stdout).toBe('UPGRADE_AVAILABLE 1.0.0 1.0.0+2 ' + short(next));
|
||||
});
|
||||
|
||||
test("gstack-upgrade's Not-now block, with the fourth field substituted for {new}, snoozes exactly that SHA", () => {
|
||||
// #4561: the block takes the whole line and derives the key itself, so an agent never picks the field by hand.
|
||||
test("gstack-upgrade's Not-now block, given the whole four-field line, snoozes exactly that SHA", () => {
|
||||
const local = head();
|
||||
const main = pushUpstream('c2');
|
||||
serveCompare(local, main, 'ahead', 1);
|
||||
@@ -180,14 +181,14 @@ describe('equal VERSION, main moved past the checkout', () => {
|
||||
expect(fields).toHaveLength(4);
|
||||
const skill = fs.readFileSync(path.join(ROOT, 'gstack-upgrade', 'SKILL.md'), 'utf8');
|
||||
const block = /```bash\n(GSTACK_STATE_ROOT=\$\(~\/\.claude\/skills\/gstack\/bin\/gstack-paths[^\n]*\n_SNOOZE_FILE=[\s\S]*?)```/.exec(skill)![1]!;
|
||||
expect(block).toContain('_REMOTE_VER="{new}"');
|
||||
expect(skill).toContain('On a four-field line use the SHA (fourth field) as `{new}`');
|
||||
expect(block).toContain('_UPGRADE_LINE="{line}"');
|
||||
expect(block).not.toContain('{new}');
|
||||
const bin = path.join(fx.root, '.claude', 'skills', 'gstack', 'bin');
|
||||
fs.mkdirSync(bin, { recursive: true });
|
||||
fs.mkdirSync(path.join(path.dirname(bin), 'lib'), { recursive: true });
|
||||
for (const name of ['gstack-paths', 'gstack-state-root.sh']) fs.copyFileSync(path.join(ROOT, 'bin', name), path.join(bin, name));
|
||||
for (const name of ['gstack-paths', 'gstack-state-root.sh']) fs.chmodSync(path.join(bin, name), 0o755);
|
||||
const r = spawnSync('bash', ['-c', block.replace('{new}', fields[3]!)], { encoding: 'utf8', timeout: 15_000, env: { ...process.env, HOME: fx.root, GSTACK_STATE_ROOT: fx.state, GSTACK_ROOT: path.dirname(bin) } });
|
||||
const r = spawnSync('bash', ['-c', block.replace('{line}', line.trim())], { encoding: 'utf8', timeout: 15_000, env: { ...process.env, HOME: fx.root, GSTACK_STATE_ROOT: fx.state, GSTACK_ROOT: path.dirname(bin) } });
|
||||
expect(r.status).toBe(0);
|
||||
expect(fs.readFileSync(path.join(fx.state, 'update-snoozed'), 'utf8')).toMatch(new RegExp('^' + short(main) + ' 1 \\d+\\n$'));
|
||||
expect(run().stdout).toBe('');
|
||||
|
||||
Reference in new issue
Block a user