test: supply _setup_ready_line to setup-tail harnesses, register the pairing fixture, make the admission test runner-Bun independent; announce shim writes

Files: test/setup-hook-syntax-gate.test.ts, test/redact-prepush-hook.test.ts, test/setup-playwright-best-effort.test.ts, test/helpers/free-fixtures-data.ts, test/pregate-guards.test.ts, bin/gstack-capy-install
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-15 01:56:02 +00:00
1 parent e957b2194c
commit cad87246fd
6 files changed
+12 -3

No files matched your search

+1 -1
View File
@@ -458,7 +458,7 @@ exec "$chose" "$@"
EOF_SHIM
} > "$tmp"
fi
chmod 0755 "$tmp" && if cmp -s "$tmp" "$dir/$name"; then rm -f "$tmp"; else mv -f "$tmp" "$dir/$name"; fi
chmod 0755 "$tmp" && if cmp -s "$tmp" "$dir/$name"; then rm -f "$tmp"; else mv -f "$tmp" "$dir/$name" && say "wrote $dir/$name (gstack's per-directory $name shim; GSTACK_BUN_SHIM_EXPLAIN=1 shows its choice, GSTACK_BUN_SHIM=0 opts out)"; fi
done
exec 8>&-
}
+1
View File
@@ -18,6 +18,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
'test/fixtures/autoplan-edit-digests-al.json': ['test/autoplan-edit-digests-al.test.ts'],
'test/fixtures/autoplan-home-phase-entry-fb10.json': ['test/autoplan-method-read-audit.test.ts'],
'test/fixtures/autoplan-owned-state-edit.json': ['test/autoplan-owned-state.test.ts'],
'test/fixtures/autoplan-pairing/run-20261014-pairs.json': ['test/autoplan-pairing.test.ts'],
'test/fixtures/autoplan-phase-consumption-491.json': ['test/autoplan-publication-guard.test.ts'],
'test/fixtures/autoplan-phase-dash-ao.json': ['test/autoplan-phase-observer.test.ts'],
'test/fixtures/autoplan-phase-entry-alias-f359.json': ['test/autoplan-method-read-audit.test.ts'],
+5 -2
View File
@@ -175,10 +175,13 @@ describe('guards and lanes: install verdict admission (integration item 8)', ()
expect(checkRow(repo, 'guards')).toMatchObject({ status: 'incomplete', code: 'BUN_RESOLUTION_DRIFT' });
expect(checkRow(repo, 'guards').detail).toContain(`recorded bun 1.4.3 at ${repo.root}/gone/bun is gone`);
expect(ran(repo)).toBe(false);
verdict(repo, { bun_path: fs.realpathSync(process.execPath), bun_version: Bun.version });
const stub = path.join(fs.realpathSync(repo.root), 'pinned', 'bun');
fs.mkdirSync(path.dirname(stub), { recursive: true });
fs.writeFileSync(stub, `#!/bin/sh\n[ "$1" = --version ] && { echo 1.4.2; exit 0; }\nexec '${fs.realpathSync(process.execPath)}' "$@"\n`, { mode: 0o755 });
verdict(repo, { bun_path: stub, bun_version: '1.4.2' });
const ok = run(repo);
expect(ok.status, ok.out).toBe(EXIT.ok);
expect(ok.out).toContain(`runtime: bun ${Bun.version} at ${fs.realpathSync(process.execPath)} (recorded by the install verdict)`);
expect(ok.out).toContain(`runtime: bun 1.4.2 at ${stub} (recorded by the install verdict)`);
expect(ran(repo)).toBe(true);
});
});
+3
View File
@@ -406,6 +406,7 @@ describe("install UX surfaces (#1946 / eng review D3+D10)", () => {
describe("one-time consent prompt in setup (#1946, decision 6)", () => {
const setup = fs.readFileSync(path.join(ROOT, "setup"), "utf8");
const block = setup.slice(setup.indexOf("# ─── Redact pre-push guard consent"));
const readyLine = setup.slice(setup.indexOf("_setup_ready_line() {"), setup.indexOf("\n}\n", setup.indexOf("_setup_ready_line() {")) + 3);
test("prompt is gated on key ABSENCE and a real TTY, with a timed default-N read", () => {
expect(block).toContain("grep -q '^redact_prepush_hook:'");
@@ -432,6 +433,7 @@ describe("install UX surfaces (#1946 / eng review D3+D10)", () => {
"QUIET=0",
'log() { echo "$@"; }',
`GSTACK_CONFIG="${path.join(ROOT, "bin", "gstack-config")}"`,
readyLine,
block,
].join("\n");
const r = spawnSync("bash", ["-c", script], {
@@ -459,6 +461,7 @@ describe("install UX surfaces (#1946 / eng review D3+D10)", () => {
"QUIET=0",
'log() { echo "$@"; }',
`GSTACK_CONFIG="${path.join(ROOT, "bin", "gstack-config")}"`,
readyLine,
block,
].join("\n");
const r = spawnSync("bash", ["-c", script], {
+1
View File
@@ -36,6 +36,7 @@ function slice(from: string, to: string | null): string {
}
const HOOK_SECTIONS = [
slice('_setup_ready_line() {', '\n}\n') + '\n}\n',
slice('CANONICAL_GSTACK_ROOT="${CLAUDE_CONFIG_DIR', '# ─── GBrain detection'),
slice('# 11. Plan-tune cathedral hook install', '# ─── Redact pre-push guard consent'),
slice('if [ -n "${_HOOK_REFUSED:-}" ]; then', null),
@@ -486,6 +486,7 @@ function runSummary(reason: string, telemetry: 'ok' | 'fail' | 'missing', prelud
'log() { [ "$QUIET" -eq 0 ] && echo "$@" || true; }',
`SOURCE_GSTACK_DIR="${tmp}"`,
`_PW_FAIL_REASON="${reason}"`,
extractFn('_setup_ready_line'),
...prelude,
tail,
'echo "REACHED_END=1"',