mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-02 17:40:02 +02:00
- design: serve.test.ts drove an inline mirror server; now two tests run the real serve() on an ephemeral port (reload confinement, submit exit 0). - setup-gbrain: rollback + voyage tests execute the template-extracted init blocks (3 sites) instead of drifted local bash copies. - terminal-agent: internalHandler source greps replaced by a behavioral /internal/grant + /internal/revoke auth matrix (no/wrong/valid token). - /health: server-security-surface and the server-auth / security-audit-r2 / sidebar-tabs source greps fold into one liveness-only check on the real body; the L4 sidecar wiring gets a behavioral /pty-inject-scan test. - delete tautologies (browser-manager onDisconnect, memory-command #12), ios swiftui tap fixture self-check, memory-ingest put_page grep, detach source greps, sidebar-agent absence pins, dead-CSS pins + the dead CSS, security-audit-r2 Task 1 + the test-only meta-commands re-export, duplicate generated-SKILL.md checks. - make-pdf coverage-gaps cases move into their owner test files.
71 lines
2.8 KiB
TypeScript
71 lines
2.8 KiB
TypeScript
// Post-rename doc-regen regression: after `bun run gen:skill-docs`, no
|
|
// `gstack-brain-init` or `gbrain_sync_mode` strings appear in any of the
|
|
// generated SKILL.md files (the cross-product blind spot codex
|
|
// Finding #12 flagged).
|
|
//
|
|
// The check runs against the canonical claude-host output already on
|
|
// disk. We don't shell out to gen-skill-docs again; the existing
|
|
// freshness check in gen-skill-docs.test.ts covers that. This test
|
|
// just verifies the rename actually propagated to the generated
|
|
// artifacts that users see.
|
|
|
|
import { describe, test, expect } from 'bun:test';
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
|
|
const ROOT = path.resolve(import.meta.dir, '..');
|
|
|
|
const FORBIDDEN_PATTERNS = [
|
|
// Bare identifier — should NEVER appear in generated docs (if it does,
|
|
// a template still has the old call site).
|
|
/^.*\bgstack-brain-init\b.*$/m,
|
|
/^.*\bgbrain_sync_mode\b.*$/m,
|
|
];
|
|
|
|
// Per the preamble resolver: generated docs DO contain the
|
|
// "~/.gstack-brain-remote.txt" string in the migration-window fallback. We
|
|
// don't grep for that — it's intentional. We grep for the call-site
|
|
// identifiers only.
|
|
|
|
function findSkillMdFiles(): string[] {
|
|
const skillMd = path.join(ROOT, 'SKILL.md');
|
|
const files: string[] = [skillMd];
|
|
// Top-level skill directories with their own SKILL.md.
|
|
const entries = fs.readdirSync(ROOT, { withFileTypes: true });
|
|
for (const e of entries) {
|
|
if (e.isDirectory() && !e.name.startsWith('.') && !['node_modules', 'test'].includes(e.name)) {
|
|
const inner = path.join(ROOT, e.name, 'SKILL.md');
|
|
if (fs.existsSync(inner)) files.push(inner);
|
|
}
|
|
}
|
|
return files;
|
|
}
|
|
|
|
describe('post-rename doc-regen regression (codex Finding #12)', () => {
|
|
test('no generated SKILL.md contains "gstack-brain-init"', () => {
|
|
const offenders: string[] = [];
|
|
for (const file of findSkillMdFiles()) {
|
|
const content = fs.readFileSync(file, 'utf-8');
|
|
const m = content.match(/^.*\bgstack-brain-init\b.*$/m);
|
|
if (m) offenders.push(`${path.relative(ROOT, file)}: ${m[0].slice(0, 100)}`);
|
|
}
|
|
if (offenders.length > 0) {
|
|
console.error(`Stale "gstack-brain-init" in generated SKILL.md files:\n${offenders.map((o) => ' ' + o).join('\n')}`);
|
|
}
|
|
expect(offenders).toEqual([]);
|
|
});
|
|
|
|
test('no generated SKILL.md contains "gbrain_sync_mode"', () => {
|
|
const offenders: string[] = [];
|
|
for (const file of findSkillMdFiles()) {
|
|
const content = fs.readFileSync(file, 'utf-8');
|
|
const m = content.match(/^.*\bgbrain_sync_mode\b.*$/m);
|
|
if (m) offenders.push(`${path.relative(ROOT, file)}: ${m[0].slice(0, 100)}`);
|
|
}
|
|
if (offenders.length > 0) {
|
|
console.error(`Stale "gbrain_sync_mode" in generated SKILL.md files:\n${offenders.map((o) => ' ' + o).join('\n')}`);
|
|
}
|
|
expect(offenders).toEqual([]);
|
|
});
|
|
});
|