mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-12 16:08:59 +02:00
test: repin ~70 assertions to the script contract — every literal gets a successor
Assertions that pinned inline-bash internals (update-check guard, _SESSIONS reaping, telemetry start/end blocks, routing probe, repo-strip producer, first-task gating, EXPLAIN_LEVEL/QUESTION_TUNING echoes, #2499 jq scope resolution, Issue-8 CONDUCTOR gate) now pin the same invariants in their new home: bin/gstack-skill-start / bin/gstack-skill-end file content for script internals, the invocation fence + interpretation prose for render-side behavior. No assertion deleted without a successor; live-execution tests (routing probe, brain-sync jq) run against script bytes unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
eb1607aaf8
commit
17bebe33ab
+20
-11
@@ -38,28 +38,38 @@ function makeCtx(host: 'claude' | 'codex'): TemplateContext {
|
||||
};
|
||||
}
|
||||
|
||||
/** Extract the routing-probe block from the rendered preamble bash. */
|
||||
function extractRoutingProbe(rendered: string): string {
|
||||
const start = rendered.indexOf('_HAS_ROUTING="no"');
|
||||
// Token-reduction Phase 1: the probe bash moved from the rendered preamble
|
||||
// into bin/gstack-skill-start (invoked by every host's preamble fence). The
|
||||
// probe block under test is extracted from the LIVE script bytes.
|
||||
const SKILL_START_SCRIPT = fs.readFileSync(
|
||||
path.join(ROOT, 'bin', 'gstack-skill-start'),
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
/** Extract the routing-probe block from the skill-start script. */
|
||||
function extractRoutingProbe(scriptText: string): string {
|
||||
const start = scriptText.indexOf('_HAS_ROUTING="no"');
|
||||
expect(start).toBeGreaterThan(-1);
|
||||
const end = rendered.indexOf('done', start);
|
||||
const end = scriptText.indexOf('done', start);
|
||||
expect(end).toBeGreaterThan(start);
|
||||
return rendered.slice(start, end + 'done'.length);
|
||||
return scriptText.slice(start, end + 'done'.length);
|
||||
}
|
||||
|
||||
describe('routing probe checks AGENTS.md too (#2500)', () => {
|
||||
for (const host of ['claude', 'codex'] as const) {
|
||||
test(`rendered preamble probes CLAUDE.md AND AGENTS.md (${host})`, () => {
|
||||
test(`preamble reaches the CLAUDE.md AND AGENTS.md probe (${host})`, () => {
|
||||
// The render must invoke the script that owns the probe...
|
||||
const rendered = generatePreambleBash(makeCtx(host));
|
||||
const probe = extractRoutingProbe(rendered);
|
||||
expect(rendered).toContain('gstack-skill-start');
|
||||
// ...and the probe must cover both convention files.
|
||||
const probe = extractRoutingProbe(SKILL_START_SCRIPT);
|
||||
expect(probe).toContain('CLAUDE.md');
|
||||
expect(probe).toContain('AGENTS.md');
|
||||
});
|
||||
}
|
||||
|
||||
test('live probe block: AGENTS.md-only repo reports HAS_ROUTING=yes', () => {
|
||||
const rendered = generatePreambleBash(makeCtx('claude'));
|
||||
const probe = extractRoutingProbe(rendered);
|
||||
const probe = extractRoutingProbe(SKILL_START_SCRIPT);
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'routing-probe-'));
|
||||
try {
|
||||
fs.writeFileSync(
|
||||
@@ -77,8 +87,7 @@ describe('routing probe checks AGENTS.md too (#2500)', () => {
|
||||
});
|
||||
|
||||
test('live probe block: repo with neither file reports HAS_ROUTING=no', () => {
|
||||
const rendered = generatePreambleBash(makeCtx('claude'));
|
||||
const probe = extractRoutingProbe(rendered);
|
||||
const probe = extractRoutingProbe(SKILL_START_SCRIPT);
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'routing-probe-'));
|
||||
try {
|
||||
const out = execSync(
|
||||
|
||||
Reference in New Issue
Block a user