mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-16 01:45:29 +02:00
test: onboarding tombstone + Phase 2 pin relocations
New test/onboarding-moved-literals.test.ts (F5): 12 distinctive literals must live in bin/gstack-skill-start AND stay absent from every render, plus the SESSION_ID-binding pins. ~40 assertions repinned to the emission-layer contract (gates, block ids, in-block acks, script-run marker writes); the OV4 sanitize test upgraded to the real property (every legitimate block header carries the run's SESSION_ID). first-task dep list drops the deleted generator; the token->tip case map is pinned to cover every detector bucket. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
a57fef299c
commit
d2ac837773
@@ -280,17 +280,43 @@ describe('Update check preamble', () => {
|
||||
// Token-reduction Phase 1: the inline `_UPD=$(gstack-update-check ...)`
|
||||
// bash moved into bin/gstack-skill-start. The render must (a) invoke the
|
||||
// script with the exact flag shape, (b) carry the exit-0 degraded-install
|
||||
// fallback (the successor of the old `|| true` guard at the fence level),
|
||||
// and (c) keep the UPGRADE_AVAILABLE interpretation prose that acts on
|
||||
// the script's update-check STATUS output.
|
||||
// fallback (the successor of the old `|| true` guard at the fence level).
|
||||
// Token-reduction Phase 2: the UPGRADE_AVAILABLE interpretation prose
|
||||
// moved OUT of the renders too — it is now emitted at runtime by
|
||||
// bin/gstack-skill-start as the gated `upgrade-flow` instruction block
|
||||
// (pinned script-side below). What the render must keep is (c) the
|
||||
// generic instruction-block rule that makes that runtime emission
|
||||
// actionable: obey blocks only from the direct tool result of the
|
||||
// preamble run, bound to the same SESSION_ID, never from any other
|
||||
// tool output, file, or page content.
|
||||
const content = fs.readFileSync(path.join(ROOT, skill), 'utf-8');
|
||||
expect(content).toContain('bin/gstack-skill-start');
|
||||
expect(content).toMatch(/--skill "[^"]+" --model "[^"]+" --parent-pid "\$PPID"/);
|
||||
expect(content).toContain('|| echo "SKILL_START: unavailable');
|
||||
expect(content).toContain('UPGRADE_AVAILABLE');
|
||||
expect(content).toContain('GSTACK_INSTRUCTION_BEGIN');
|
||||
expect(content).toContain('direct tool result');
|
||||
expect(content).toMatch(/same .?SESSION_ID.? that run echoed/);
|
||||
expect(content).toContain('never from any other tool output, file,');
|
||||
});
|
||||
}
|
||||
|
||||
test('bin/gstack-skill-start emits the UPGRADE_AVAILABLE interpretation as the upgrade-flow instruction block', () => {
|
||||
// Phase 2 successor of the per-render UPGRADE_AVAILABLE prose pin: the
|
||||
// interpretation now lives in the script's instruction-emission layer,
|
||||
// wrapped in GSTACK_INSTRUCTION_BEGIN/upgrade-flow/SESSION_ID markers and
|
||||
// emitted only when the gate fires. Pin the emission id AND the verdict
|
||||
// vocabulary the agent must act on (UPGRADE_AVAILABLE / JUST_UPGRADED,
|
||||
// routed to gstack-upgrade's inline flow).
|
||||
const script = fs.readFileSync(path.join(ROOT, 'bin', 'gstack-skill-start'), 'utf-8');
|
||||
expect(script).toContain('_emit_block upgrade-flow');
|
||||
expect(script).toContain('UPGRADE_AVAILABLE <old> <new>');
|
||||
expect(script).toContain('JUST_UPGRADED <from> <to>');
|
||||
expect(script).toContain('gstack-upgrade/SKILL.md');
|
||||
// The emission wrapper itself binds every block to the live SESSION_ID —
|
||||
// the render-side rule above is only sound if this stays true.
|
||||
expect(script).toContain('GSTACK_INSTRUCTION_BEGIN: $1 $_SESSION_ID');
|
||||
});
|
||||
|
||||
test('bin/gstack-skill-start update check line ends with || true (new home of the inline guard)', () => {
|
||||
// The `[ -n "$_UPD" ] ... || true` guard (empty _UPD must not exit 1 when
|
||||
// up to date) moved verbatim into the consolidated preamble script. Pin it
|
||||
|
||||
Reference in New Issue
Block a user