fix(test): update four main-side assertions to the T3 installer contracts

Integration drift from the T3 lane: three static assertions pinned the OLD
implementation shapes that T3 legitimately replaced — the gbrain-refresh
branch no longer self-documents a reset --hard cycle (#2569 renders to an
untracked out-dir instead; the test now pins THAT), setup's regen block
renamed to the render form (re-anchored, same exit-code-propagation
invariant), and sections/ linking generalized into _link_skill_runtime_assets
(the _link_or_copy routing assertion moved into the helper). Fourth: the
uninstall neutral-target test asserted against os.tmpdir(), which reads
$TMPDIR at call time — a shard neighbor can leave it gstack-containing,
making the "neutral" symlink target match the provenance substring; the test
now falls back to a fixed neutral root and asserts neutrality explicitly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-16 10:01:27 -07:00
co-authored by Claude Fable 5
parent d889453686
commit 5b65f91a8c
4 changed files with 38 additions and 16 deletions
+11 -2
View File
@@ -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');