add gstack 2 parity and lifecycle gates

This commit is contained in:
Sinabina
2026-07-17 11:08:32 -07:00
parent b6572ebbb7
commit 9919c4cdd3
212 changed files with 29098 additions and 3845 deletions
+24
View File
@@ -9,6 +9,9 @@
*/
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
import { mkdtempSync, mkdirSync, rmSync, writeFileSync, chmodSync } from 'fs';
import { tmpdir } from 'os';
import { join } from 'path';
import { SALIENCE_DEFAULT_ALLOWLIST } from '../scripts/brain-cache-spec';
const ORIGINAL_ENV = process.env.GSTACK_SALIENCE_ALLOWLIST;
@@ -85,6 +88,27 @@ describe('salience allowlist gate', () => {
expect(list.length).toBeGreaterThan(0);
});
test('managed GSTACK_BIN config controls salience without a Claude install path', async () => {
if (process.platform === 'win32') return;
const root = mkdtempSync(join(tmpdir(), 'gstack-salience-bin-'));
const bin = join(root, 'bin');
mkdirSync(bin, { recursive: true });
const config = join(bin, 'gstack-config');
writeFileSync(config, '#!/bin/sh\nprintf "%s" "custom-safe/,projects/"\n');
chmodSync(config, 0o755);
const previousBin = process.env.GSTACK_BIN;
try {
process.env.GSTACK_BIN = bin;
delete process.env.GSTACK_SALIENCE_ALLOWLIST;
const mod = await importCache();
expect(mod.getSalienceAllowlist()).toEqual(['custom-safe/', 'projects/']);
} finally {
if (previousBin) process.env.GSTACK_BIN = previousBin;
else delete process.env.GSTACK_BIN;
rmSync(root, { recursive: true, force: true });
}
});
test('default allowlist contains nothing sensitive', async () => {
const sensitivePrefixes = ['personal', 'family', 'therapy', 'reflection', 'private', 'medical', 'health'];
for (const prefix of sensitivePrefixes) {