mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-17 10:25:33 +02:00
test: phantom-hooks heal coverage — incident facsimile, per-item safety, lock, canonical tripwires
- gstack-settings-hook-schema-aware: 16 new cases — identity re-point (tag
restore), foreign-basename rejection, mixed-entry per-item safety for
add-event/remove-source/--all, prune-stale modes incl. bash-prefix +
Windows-backslash + spaced-path idempotence, duplicate collapse preferring
the tagged twin, plan_tune_hooks:no split, backup-on-change no-churn,
fail-closed corrupt-JSON for every mutator, stale-lock takeover,
fresh-foreign-lock skip, two-writer concurrency smoke, and an INCIDENT
FACSIMILE replaying the exact 2026-08-17 production damage (6/3/2 entries,
mixed tags, live-ephemeral Stop) healing to 2/1/1 canonical.
- NEW setup-hook-canonical-paths: static tripwires — canonical-only resolver
(no $SOURCE_GSTACK_DIR anywhere in it), heal-before-guards ordering,
unsuppressed heal output, ${VAR:-0} counter idiom, shared-prelude
concatenation at every bun call site, KNOWN_HOOKS completeness vs setup's
registrations, uninstall cleanup-before-deletion ordering, defect-class
warning present.
- setup-plan-tune-hooks-noninteractive: PT_EXPLICIT pins + `gstack-config
has` provenance + has-subcommand behavior (env-resolution, malformed keys).
- auq-error-fallback-hook: registration + both-teardown wiring (previously
untested).
- uninstall: behavioral ordering test running the INSTALLED copy from inside
the root it deletes.
- setup-windows-fallback / gstack-config-key-locale: pins updated for the new
HOOK_CMD shape and the third C-locale validator.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
f0560738af
commit
05e6f1cfe5
@@ -129,3 +129,36 @@ describe('hook integration — invoked as PostToolUse', () => {
|
||||
expect(out.additionalContext).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Registration + teardown wiring (static). Setup registers this hook under
|
||||
// its own source tag (sharing plan-tune-cathedral would overwrite the
|
||||
// question-log entry — same event+matcher); both teardown surfaces
|
||||
// (--no-team, uninstall) must remove it, which pre-v1.67.2 neither did.
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
import * as fs from 'fs';
|
||||
|
||||
describe('setup registration + teardown wiring (static)', () => {
|
||||
const ROOT = path.resolve(__dirname, '..');
|
||||
const setupSrc = fs.readFileSync(path.join(ROOT, 'setup'), 'utf-8');
|
||||
const uninstallSrc = fs.readFileSync(path.join(ROOT, 'bin', 'gstack-uninstall'), 'utf-8');
|
||||
|
||||
test('setup registers the hook via the canonical resolver under --source auq-error-fallback', () => {
|
||||
expect(setupSrc).toMatch(
|
||||
/AUQ_ERROR_FALLBACK_HOOK="\$\(_hook_command_path hosts\/claude\/hooks\/auq-error-fallback-hook/,
|
||||
);
|
||||
expect(setupSrc).toContain('--source auq-error-fallback');
|
||||
});
|
||||
|
||||
test('--no-team tears the hook down', () => {
|
||||
const idx = setupSrc.indexOf('# Also tear down plan-tune');
|
||||
expect(idx).toBeGreaterThan(-1);
|
||||
const slice = setupSrc.slice(idx, idx + 900);
|
||||
expect(slice).toContain('remove-source --source auq-error-fallback');
|
||||
});
|
||||
|
||||
test('gstack-uninstall tears the hook down', () => {
|
||||
expect(uninstallSrc).toContain('remove-source --source auq-error-fallback');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user