From 48f0ceff64ee05274b14794a9a5707b647f8268e Mon Sep 17 00:00:00 2001 From: garrytan Date: Sat, 17 Oct 2026 02:56:57 +0000 Subject: [PATCH] test: state-matrix stats test resolves its slug under its own state root (home containment) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/state-matrix.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/state-matrix.test.ts b/test/state-matrix.test.ts index 8b07a7c5f..66f0ee6a5 100644 --- a/test/state-matrix.test.ts +++ b/test/state-matrix.test.ts @@ -120,12 +120,13 @@ describe('gstack-specialist-stats', () => { try { expect(spawnSync('git', ['init', '-q'], { cwd: root, timeout: 30_000 }).status).toBe(0); const stats = path.resolve(import.meta.dir, '..', 'bin', 'gstack-specialist-stats'); - const slug = spawnSync(path.resolve(import.meta.dir, '..', 'bin', 'gstack-slug'), [], { cwd: root, encoding: 'utf8', timeout: 30_000 }).stdout.match(/^SLUG=(.+)$/m)![1]; + const env = { ...process.env, GSTACK_STATE_ROOT: path.join(root, 'state') }; + const slug = spawnSync(path.resolve(import.meta.dir, '..', 'bin', 'gstack-slug'), [], { cwd: root, encoding: 'utf8', timeout: 30_000, env }).stdout.match(/^SLUG=(.+)$/m)![1]; const dir = path.join(root, 'state', 'projects', slug); fs.mkdirSync(dir, { recursive: true }); const entry = { specialists: Object.fromEntries(['state-machines', 'testing'].map(n => [n, { dispatched: true, findings: 0 }])) }; fs.writeFileSync(path.join(dir, 'main-reviews.jsonl'), Array(10).fill(JSON.stringify(entry)).join('\n') + '\n'); - const r = spawnSync(stats, [], { cwd: root, encoding: 'utf8', timeout: 60_000, env: { ...process.env, GSTACK_STATE_ROOT: path.join(root, 'state') } }); + const r = spawnSync(stats, [], { cwd: root, encoding: 'utf8', timeout: 60_000, env }); expect(r.stdout).toContain('state-machines: 10/10 dispatched, 0 findings (0%) [NEVER_GATE]'); expect(r.stdout).toContain('testing: 10/10 dispatched, 0 findings (0%) [GATE_CANDIDATE]'); } finally {