Files
gstack/test/skill-e2e-sync-gbrain-readiness.test.ts
T
d789dd965b /sync-gbrain's read check works when the first page is over 64 KB (#4396) (#4497)
/sync-gbrain's read check no longer reports `unknown` when the first
page in your code source is over 64 KB.

Why: the check read the whole page to confirm its source and slug, and
big pages (lockfiles) hit the 64 KiB output limit on every run.

Nothing to do: it now reads a 4 KB window of the page and still treats
any cut-off output as `unknown`.

Co-authored-by: nfitzsimmons <2198211+nfitzsimmons@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
2026-11-18 17:08:51 +00:00

54 lines
3.2 KiB
TypeScript

import { afterAll, expect } from 'bun:test';
import { runSkillTest, type SkillTestResult } from './helpers/session-runner';
import { createReadinessFixture } from './helpers/sync-gbrain-readiness-fixture';
import { readinessVerdictProblems } from './helpers/sync-gbrain-readiness-verdict';
import { describeE2ETier } from './helpers/e2e-gate';
import { createEvalCollector, finalizeEvalCollector, describeIfSelected, testIfSelected, recordE2E, runId } from './helpers/e2e-helpers';
const collector = createEvalCollector('e2e-sync-gbrain-readiness');
const describeE2E = describeE2ETier('periodic');
afterAll(async () => { await finalizeEvalCollector(collector); });
async function runReadiness(kind: 'ready' | 'unknown', name: string) {
const fixture = createReadinessFixture(kind);
let result: SkillTestResult | undefined;
let failure: unknown;
try {
result = await runSkillTest({
testName: name, runId, workingDirectory: fixture.workDir, env: fixture.env,
prompt: 'Read readiness.md. Step 2 already ran. Execute the Step 4 read helper once, apply its guidance decision, then give the Step 5 capability and overall verdict from that evidence. The fixture supplies only this helper interface: other Step 5 rows are unavailable, so report them unknown rather than invoking extra CLI commands. Do not install, sync, doctor, put, delete, or repair the brain. A read does not prove semantic search or writes. Report whether CLAUDE.md changed.',
maxTurns: 8, timeout: 240_000, allowedTools: ['Read', 'Bash', 'Edit', 'Write'],
tools: ['Read', 'Bash', 'Edit', 'Write'],
});
expect(result.exitReason).toBe('success');
expect(fixture.calls()).toEqual([
'sources list --json',
'list --source client-fixture --limit 1',
'get code/fixture/readme --source client-fixture --json --body window --max-bytes 4096',
...(kind === 'unknown' ? ['get code/fixture/readme --source client-fixture --json'] : []),
]);
const content = fixture.content();
expect(fixture.sourceIntact()).toBe(true);
if (kind === 'ready') {
expect(content).toContain('## GBrain Search Guidance');
expect(content).toContain('<!-- gstack-gbrain-search-guidance:start -->');
} else {
expect(content).toContain(fixture.guidance);
}
expect(readinessVerdictProblems(kind, result.output)).toEqual([]);
} catch (error) { failure = error; }
finally {
if (result) recordE2E(collector, name, 'sync-gbrain-readiness', result,
failure ? { passed: false, error: String(failure) } : undefined);
else collector?.addTest({ name, suite: 'sync-gbrain-readiness', tier: 'e2e', passed: false,
duration_ms: 0, cost_usd: 0, exit_reason: 'harness_error', error: String(failure) });
fixture.cleanup();
}
if (failure) throw failure;
}
describeE2E('sync-gbrain periodic readiness', () => describeIfSelected('sync-gbrain source-scoped readiness actors', ['sync-gbrain-read-ready', 'sync-gbrain-read-unknown'], () => {
testIfSelected('sync-gbrain-read-ready', async () => runReadiness('ready', 'sync-gbrain-read-ready'), 270_000);
testIfSelected('sync-gbrain-read-unknown', async () => runReadiness('unknown', 'sync-gbrain-read-unknown'), 270_000);
}));