Skip to content

fix(gate): the install-gate refusal names the hazard, not the machinery - #502

Merged
sandstream merged 1 commit into
mainfrom
fix/501-gate-refusal-wording
Aug 20, 2026
Merged

sandstream merged 1 commit into
mainfrom
fix/501-gate-refusal-wording

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Closes #501.

The report was that the gate had a false positive. It did not.

git commit -qam "… naming the permission \deployment:env:view` …"was blocked. Backticks inside **double** quotes are command substitution, so that command never commits that text — the shell runsdeployment:env:view` and splices its output in. Measured:

$ bash -c 'echo "... naming the permission `deployment:env:view` ..."'
bash: deployment:env:view: command not found
... naming the permission  ...

The permission name is silently deleted from the commit message. indirectInstall (src/install-gate.ts) caught a real silent corruption: argv0 is an unresolvable substitution and an install verb is present, so it cannot verify what runs → fail closed. Single quotes are literal and are not blocked.

What was actually broken: the wording

BLOCKED — cannot reduce to a triage target: indirect-bin:`deployment:env:view`
Triage it first: `kit triage …`, or install via `kit pkg <eco>:<name>`.

Both lines are about kit's internals, and both are nonsense advice for this command. The reasonable conclusion was "the gate mis-parsed my commit message", and the workaround that follows — write the message to a file, use -F — hides the defect instead of fixing it. A refusal that misdescribes what it caught teaches people to route around the gate.

Now:

BLOCKED — `deployment:env:view` is COMMAND SUBSTITUTION, not text: the shell runs it and
splices its output into the argument, so the characters you typed never reach the command
(backticks substitute inside double quotes too — single quotes are literal). If you meant it
literally, use single quotes, or pass the text via a file (e.g. `git commit -F <file>`). If you
meant to run it, run it as its own command so kit can see what installs.

and the Triage it first line is appended only when the block really is about an install target — $PM install evil keeps the generic wording.

Fail-closed behaviour is untouched: same block, same exit 2. This changes only what the operator is told.

Tests

  • install-gate.test.ts — explainUnverifiable for the backtick form, the $( ) form (no backtick-specific aside), and null for every other unverifiable reason so the generic path is preserved; plus the verdict carrying the hazard, and $PM install evil still carrying the generic one.
  • gate-bash-refusal.test.ts (new) — the compiled CLI, because a helper that returns the right sentence to nobody is not a fixed message: exit 2 preserved, the hazard wording present, Triage it first absent, the generic case unchanged, and a single-quoted commit message allowed. Offline by construction — an unresolvable indirection is refused before any registry lookup, so no network.

One test-harness note worth keeping: execFile has no input option, so the first version of the e2e test left the gate waiting on a stdin pipe that never closed and hung for two minutes. spawnSync({ input }) closes it.

Verification

  • npm test: 4350 tests, 0 fail, 0 skipped (macOS, non-root)
  • eslint src: 0 errors; prettier --check "src/**/*.ts" clean
  • Reproduced the block on both 6.6.5 (the reporter's version) and 6.7.0 before changing anything

🤖 Generated with Claude Code

A blocked `git commit -m "… `deployment:env:view` …"` was reported as a false
positive. The gate was right: backticks inside DOUBLE quotes are command
substitution, so the shell runs the token and splices its output into the
argument. Measured —

  $ bash -c 'echo "... the permission `deployment:env:view` ..."'
  bash: deployment:env:view: command not found
  ... the permission  ...

— the words silently vanish from the message. `indirectInstall` caught a real
silent corruption.

What was broken is the wording. The refusal named a triage target and offered
`kit triage` / `kit pkg`, both nonsense for that command, so the operator
concluded kit had mis-parsed a commit message and routed around the gate with
-F — hiding a command that would have committed a message with a hole in it. A
refusal that misdescribes what it caught trains people to distrust it.

Now: the substitution case explains the substitution, says single quotes are
literal, and points at `git commit -F <file>`; the "Triage it first" line is
appended only when the block really is about an install target. Fail-closed
behaviour is unchanged, and a bare-variable indirection ($PM install evil) keeps
the generic wording.

Tests drive the compiled CLI, because a helper that returns the right sentence to
nobody is not a fixed message: exit 2 preserved, wording asserted both ways, and
a single-quoted commit message still passes. Both cases are offline by
construction — an unresolvable indirection is refused before any registry lookup.

Closes #501

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 89c87b3 into main Aug 20, 2026
19 checks passed
@sandstream
sandstream deleted the fix/501-gate-refusal-wording branch August 20, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install-gate's refusal describes the machinery, not the hazard: a double-quoted backtick is command substitution, and the message never says so

1 participant