mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-02 17:40:02 +02:00
* feat: add surface-aware exploratory QA and ship documentation gates * test: preserve delegated QA setup authority after main integration * fix(qa): clarify exploration order and preserve report artifacts * test(qa): follow the shared setup reference directly * refactor(ship): make verification and recovery routes explicit * test(ship): align evidence and review guards with explicit routes * fix(workflows): clarify ship recovery and functional QA evidence * fix(workflows): clarify approval recovery and full QA coverage * refactor(workflows): order review transactions and clarify ship state * fix(ship): clarify final verification and fail closed at publication * fix(evals): attribute native atomic documentation writes * fix(ship): clarify recovery and documentation lifecycle guidance * fix(test): preserve observed native placeholder styling in CI * fix(codex): report watchdog timeouts without a process-exit race * Checkpoint functional QA implementation and workflow validation repairs * Fix documentation and shared-review fixture contracts * docs: clarify judge reuse and evaluation supervision * test: align review evidence and selected case contracts * test: verify append-only documentation checkpoints and recovery * fix: qualify QA workflows and CI validation repairs * fix: launch shared-libs fixture scripts on Windows * fix: qualify QA deadlines, fixture isolation, and shard cleanup * fix: preserve qualified QA and cancellation repairs * fix: enforce functional fixture authority and share strict event decoding * fix: retain free-test evidence and explain recovery * fix: reject malformed native evidence after decoder consolidation * test: use reliable capture for telemetry privacy filters * test: refresh measured quick coverage and document validation costs * Fix native fixture receipts and preserve VM validation evidence * Align negative judge controls with upstream clarity policy * Fix report-only QA preparation and public evidence handling * Clarify QA-only preparation and current-report preservation * Stream Ship quality judgments with an explicit 64k response contract * Validate compact judge reasoning locally with supported wire schema * Align functional QA fixture instructions with evidence acceptance * Bind native browser diagnostics to execution evidence and align review verdicts * Preserve native diagnostic line boundaries * Serialize functional QA evidence from native captures * Keep large QA evidence fixture payload out of Windows argv
110 lines
5.5 KiB
TypeScript
110 lines
5.5 KiB
TypeScript
import { expect, test } from 'bun:test';
|
|
import * as fs from 'node:fs';
|
|
import * as os from 'node:os';
|
|
import * as path from 'node:path';
|
|
|
|
test('actual registered documentation callbacks stage the generated report contract and consume their builders', () => {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'docs-report-interface-'));
|
|
const root = path.resolve(import.meta.dir, '..');
|
|
try {
|
|
const script = path.join(dir, 'capture.test.ts');
|
|
fs.writeFileSync(script, `
|
|
import { expect, mock, test } from 'bun:test';
|
|
import * as fs from 'node:fs';
|
|
import * as path from 'node:path';
|
|
const root = ${JSON.stringify(root)};
|
|
const fixtureModule = path.join(root, 'test/helpers/docsync-fixture.ts');
|
|
const observerModule = path.join(root, 'test/helpers/docsync-observer.ts');
|
|
const fixtures = { ...await import(fixtureModule) };
|
|
const observers = { ...await import(observerModule) };
|
|
const callbacks = new Map();
|
|
const stopped = new Error('stopped before model launch');
|
|
let fixture, launched = 0;
|
|
mock.module(fixtureModule, () => ({ ...fixtures,
|
|
fixtureDocs(scenario) { fixture = fixtures.fixtureDocs(scenario); return fixture; },
|
|
preserveDocsEvidence() {},
|
|
}));
|
|
mock.module(observerModule, () => ({ ...observers,
|
|
docsSessionOptions(input) {
|
|
const options = observers.docsSessionOptions(input);
|
|
return { ...options, prompt: options.prompt + '\\nOPTIONS_BUILDER_USED' };
|
|
},
|
|
docsShipPhase(...args) { return observers.docsShipPhase(...args) + '\\nPHASE_BUILDER_USED'; },
|
|
docsBoundedStageInterface(...args) { return observers.docsBoundedStageInterface(...args) + '\\nBOUNDED_BUILDER_USED'; },
|
|
}));
|
|
mock.module(path.join(root, 'test/helpers/e2e-gate.ts'), () => ({
|
|
describeE2ETier: () => (_name, body) => body(),
|
|
}));
|
|
mock.module(path.join(root, 'test/helpers/e2e-helpers.ts'), () => ({
|
|
runId: 'free-docsync-interface',
|
|
describeIfSelected: (_name, _names, body) => body(),
|
|
testConcurrentIfSelected: (name, body) => callbacks.set(name, body),
|
|
createEvalCollector: () => ({}),
|
|
finalizeEvalCollector() {},
|
|
recordE2E() { throw new Error('no model result may be recorded'); },
|
|
logCost() { throw new Error('no model result may be graded'); },
|
|
}));
|
|
mock.module(path.join(root, 'test/helpers/session-runner.ts'), () => ({
|
|
async runSkillTest(options) {
|
|
launched++;
|
|
if (options.testName === 'ship-docsync-failure') {
|
|
expect(options.prompt).toContain('BOUNDED_BUILDER_USED');
|
|
expect(options.prompt).toContain('Execute the actual next phase from ' + path.join(fixture.home, 'phase.md'));
|
|
expect(options.prompt).toContain('deterministic child transport instead of Agent/Task');
|
|
expect(options.prompt).toContain('no user risk exception or risky edit is approved');
|
|
expect(options.allowedTools).toEqual(['Bash', 'Read', 'Write', 'Edit', 'Glob', 'Grep']);
|
|
} else {
|
|
expect(options.prompt).toContain('OPTIONS_BUILDER_USED');
|
|
expect(options.prompt).toContain('Execute the next phase from ' + path.join(fixture.home, 'phase.md'));
|
|
expect(options.prompt).toContain('No real PR, push, store action or later ship phase is authorized.');
|
|
expect(options.prompt).toContain('no risk exception is granted');
|
|
expect(options.allowedTools).toEqual(['Bash', 'Read', 'Grep', 'Glob', 'Write', 'Edit', 'Agent', 'Task']);
|
|
}
|
|
expect(options.workingDirectory).toBe(fixture.repo);
|
|
expect(options.maxTurns).toBe(30);
|
|
expect(options.timeout).toBeGreaterThan(0);
|
|
expect(fs.readFileSync(path.join(fixture.skills, 'document-release/SKILL.md'), 'utf8')).not.toContain('This fixture child returns a deliberately obsolete completion');
|
|
const phase = fs.readFileSync(path.join(fixture.home, 'phase.md'), 'utf8');
|
|
expect(phase).toContain('PHASE_BUILDER_USED');
|
|
if (options.testName === 'ship-docsync-store') {
|
|
expect(phase).toContain('**Documentation preflight:**');
|
|
expect(phase).not.toContain('## Documentation');
|
|
} else {
|
|
const prBody = fs.readFileSync(path.join(fixture.skills, 'ship/sections/pr-body.md'), 'utf8');
|
|
const start = prBody.indexOf('## Documentation');
|
|
const end = prBody.indexOf('## Test plan', start);
|
|
expect(start).toBeGreaterThan(0);
|
|
expect(end).toBeGreaterThan(start);
|
|
expect(phase).toContain(prBody.slice(start, end));
|
|
expect(phase).toContain('documentation_section');
|
|
expect(phase).not.toContain('## Step 15: Commit');
|
|
expect(phase).not.toContain('#### Redaction scan');
|
|
}
|
|
throw stopped;
|
|
},
|
|
}));
|
|
await import(path.join(root, 'test/skill-e2e-ship-docsync.test.ts'));
|
|
expect(callbacks.size).toBe(13);
|
|
for (const name of ['ship-docsync', 'ship-docsync-completion', 'ship-docsync-current', 'ship-docsync-failure', 'ship-docsync-store']) {
|
|
test(name + ' constructs its real native request without launching it', async () => {
|
|
const before = launched;
|
|
await expect(callbacks.get(name)()).rejects.toBe(stopped);
|
|
expect(launched).toBe(before + 1);
|
|
expect(fs.existsSync(fixture.home)).toBe(false);
|
|
});
|
|
}
|
|
`);
|
|
const result = Bun.spawnSync([process.execPath, 'test', script], {
|
|
env: { ...process.env, EVALS: '', EVALS_TIER: '', EVALS_ALL: '', EVALS_RUN_ID: 'free-docsync-interface',
|
|
GSTACK_EVAL_DIR: path.join(dir, 'evidence'), GSTACK_HOME: path.join(dir, 'state') },
|
|
stdout: 'pipe', stderr: 'pipe', timeout: 120_000,
|
|
});
|
|
const output = result.stdout.toString() + result.stderr.toString();
|
|
expect(result.exitCode, output).toBe(0);
|
|
expect(output).toContain('5 pass');
|
|
expect(output).toContain('0 fail');
|
|
} finally {
|
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
}
|
|
});
|