diff --git a/test/gbrain-refresh-install-render.test.ts b/test/gbrain-refresh-install-render.test.ts index 0b803ed2a..b630402c6 100644 --- a/test/gbrain-refresh-install-render.test.ts +++ b/test/gbrain-refresh-install-render.test.ts @@ -44,13 +44,18 @@ describe('gstack-config gbrain-refresh: machine-wide render guards', () => { expect(branch).toContain('command -v bun'); }); - test('renders the :user variant in place into the install', () => { + test('renders the :user variant for the claude host', () => { expect(branch).toContain('gen:skill-docs:user --host claude'); }); - test('is self-documenting about the reset --hard / re-run cycle', () => { - expect(branch).toContain('reset --hard'); - expect(branch).toContain('gbrain-refresh'); + // #2569: the render goes to an UNTRACKED out-dir, never in place — the old + // in-place render dirtied the install checkout on every refresh, and this + // branch used to self-document a reset --hard / re-run cycle as the + // workaround. The out-dir render makes that cycle unnecessary. + test('renders to an untracked out-dir, never in place (#2569)', () => { + expect(branch).toContain('--out-dir'); + expect(branch).toContain('render/claude'); + expect(branch).not.toContain('reset --hard'); }); }); diff --git a/test/setup-bun-cmd-and-pipe-bugs.test.ts b/test/setup-bun-cmd-and-pipe-bugs.test.ts index 695a1d447..098597d55 100644 --- a/test/setup-bun-cmd-and-pipe-bugs.test.ts +++ b/test/setup-bun-cmd-and-pipe-bugs.test.ts @@ -45,16 +45,19 @@ describe('setup: gen:skill-docs:user exit-code propagation (pipe-masking fix)', expect(r.stdout).not.toContain('LOG: warning'); }); - test('setup: the live gbrain regen block has no pipe before the || guard', () => { + test('setup: the live gbrain render block has no pipe masking its exit code', () => { // Slice the exact block from setup and confirm the fix is in place - // without resorting to a fragile line-number check. - const start = SETUP_SRC.indexOf('gbrain detected — regenerating'); + // without resorting to a fragile line-number check. (#2569 renamed the + // block from "regenerating" to "rendering ... into $_GSTACK_RENDER_DIR" — + // the exit-code-propagation invariant is unchanged.) + const start = SETUP_SRC.indexOf('gbrain detected — rendering'); expect(start).toBeGreaterThan(-1); - const end = SETUP_SRC.indexOf('|| log', start); + const end = SETUP_SRC.indexOf('warning: gen:skill-docs:user failed', start); expect(end).toBeGreaterThan(start); const block = SETUP_SRC.slice(start, end); expect(block).toContain('bun_cmd run gen:skill-docs:user --host claude'); - // The bug shape: `... | tail -N` between the call and the `|| log` guard. + // The bug shape: `... | tail -N` between the call and the failure guard — + // a pipe would replace the render's exit code with tail's. expect(block).not.toMatch(/gen:skill-docs:user[^\n]*\|\s*tail/); }); }); diff --git a/test/setup-sections-linking.test.ts b/test/setup-sections-linking.test.ts index a6aa516ce..b0558283f 100644 --- a/test/setup-sections-linking.test.ts +++ b/test/setup-sections-linking.test.ts @@ -24,12 +24,17 @@ function fnBody(src: string, name: string): string { } describe('setup links sections/ for cherry-pick install targets', () => { - test('link_claude_skill_dirs links sections/ via _link_or_copy', () => { + test('link_claude_skill_dirs installs runtime assets (incl. sections/) via the shared helper', () => { + // #2317/#2454 generalized the sections/-only install into + // _link_skill_runtime_assets, which carries EVERY runtime asset a skill + // references (sections/, checklist.md, specialists/, ...). That helper + // routes through _link_or_copy internally (windows-safe), so the old + // per-directory _link_or_copy assertion moved there. const body = fnBody(SETUP, 'link_claude_skill_dirs'); - expect(body).toContain('sections'); - // sections install must route through the windows-safe helper, not raw ln. - expect(body).toMatch(/_link_or_copy\s+"\$gstack_dir\/\$dir_name\/sections"\s+"\$target\/sections"/); - expect(body).toMatch(/if \[ -d "\$gstack_dir\/\$dir_name\/sections" \]/); + expect(body).toMatch(/_link_skill_runtime_assets\s+"\$gstack_dir\/\$dir_name"\s+"\$target"/); + const helper = fnBody(SETUP, '_link_skill_runtime_assets'); + expect(helper).toContain('_link_or_copy'); + expect(helper).not.toMatch(/\bln -s/); }); test('kiro per-skill loop rewrites + copies sections/*', () => { diff --git a/test/uninstall-windows-copies.test.ts b/test/uninstall-windows-copies.test.ts index e72fe962f..fb4a92636 100644 --- a/test/uninstall-windows-copies.test.ts +++ b/test/uninstall-windows-copies.test.ts @@ -151,8 +151,17 @@ describe.skipIf(process.platform === 'win32')( test('SKILL.md symlink pointing elsewhere → kept and listed', () => { // Target path must not contain "gstack" anywhere (the provenance match // is a substring check, mirroring setup's cleanup helpers) — the suite - // tmpdir prefix does, so use a separate neutral tmpdir. - const neutral = fs.mkdtempSync(path.join(os.tmpdir(), 'other-skill-src-')); + // tmpdir prefix does, so use a separate neutral tmpdir. os.tmpdir() + // reads $TMPDIR at CALL time, and in shared-process shard runs a + // neighboring test can leave it pointing at a gstack-containing path — + // observed once in a full-suite shard (the "neutral" target then + // matched the provenance substring and the dir was wrongly deleted by + // the test's own expectations). Fall back to a fixed neutral root and + // ASSERT neutrality so the precondition can never silently rot. + let neutralRoot = os.tmpdir(); + if (neutralRoot.includes('gstack')) neutralRoot = '/private' + path.sep + 'tmp'; + const neutral = fs.mkdtempSync(path.join(neutralRoot, 'other-skill-src-')); + expect(neutral.includes('gstack')).toBe(false); const elsewhere = path.join(neutral, 'elsewhere.md'); fs.writeFileSync(elsewhere, '# not ours\n'); const dir = path.join(skillsDir, 'someone-elses');