test: seed the versioned slug cache in the memory-injection deny case (#2901)

The preference hook now resolves the project bucket from gstack-slug's
v2 slug-cache entry instead of basename(cwd); this fixture still wrote
preferences under the basename bucket without the entry the skill
preamble always writes first.
This commit is contained in:
garrytan committed 2026-10-02 15:12:23 +00:00
1 parent 59ab809e4a
commit 09dd7403f0
1 file changed
+6
+6
View File
@@ -12,6 +12,7 @@ import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import { spawnSync } from 'child_process';
import { slugCacheFile } from '../lib/bin-context';
const ROOT = path.resolve(import.meta.dir, '..');
const HOOK = path.join(ROOT, 'hosts', 'claude', 'hooks', 'question-preference-hook');
@@ -161,6 +162,11 @@ describe('memory injection', () => {
},
]);
// Set a never-ask preference and check both deny AND memory are surfaced.
// The hook resolves the project bucket from gstack-slug's versioned
// slug-cache entry (#2901), which the skill preamble writes first.
const cacheFile = slugCacheFile(stateRoot, fixtureCwd);
fs.mkdirSync(path.dirname(cacheFile), { recursive: true });
fs.writeFileSync(cacheFile, `v2:${cwdSlug}`);
fs.mkdirSync(path.join(stateRoot, 'projects', cwdSlug), { recursive: true });
fs.writeFileSync(
path.join(stateRoot, 'projects', cwdSlug, 'question-preferences.json'),