Skip to content

Clone gate scans the branch being cloned; coverage note no longer denies low findings - #9

Merged
tiltom merged 4 commits into
mainfrom
fix/clone-gate-branch-and-coverage-copy
Nov 10, 2026
Merged

tiltom merged 4 commits into
mainfrom
fix/clone-gate-branch-and-coverage-copy

Conversation

@tiltom

@tiltom tiltom commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

What changed

Clone gate scans the branch the clone checks out (hooks/flagrix-clone-gate.sh)

  • The hook ran npx -y flagrix scan "$url" --json with no --ref, so git clone --branch release … / -b release was gated on the default branch, not release.
  • It now reads --branch <name>, --branch=<name> and -b <name> (also after -- in gh repo clone owner/repo -- -b <name>) and passes the value as --ref. Only the clone command itself is read, so git checkout -b wip && git clone … does not pick up wip. --bare is not mistaken for -b.
  • Clones with git options before the subcommand are now gated too: git -C <dir> clone …, git -c key=val clone …, git --git-dir=… clone … (quoted values included). Before, the matcher only knew git clone, so these passed ungated.
  • Block messages name the branch, and the suggested re-run includes --ref.
  • docs/agent-gating.md no longer says "every git clone is gated". It now says recognized git clone / gh repo clone commands are gated, and that the hook reads command text, so a clone behind an alias, variable or script isn't seen. It also says what the hook scans: the checked-out branch (or the default branch), pinned to the commit at scan time. It does not cover other fetched branches/tags, or a push between the scan and the clone.
  • New tests/clone-gate.test.ts runs the real script with a stubbed npx on PATH (20 cases).

Coverage note on an incomplete low scan (src/lib/coverage.ts)

  • describeCoverage always ended with "Nothing was found in what was read", even when low-weight findings were printed with it (a real scan showed it above "7 issues").
  • It now takes the finding count. With findings it says "What was read turned up only low-weight findings — that says nothing about the files left unread." With none, the sentence is unchanged. This applies to the human output and the MCP tool text.
  • Tests: the render and MCP text for an incomplete low with one low finding, plus unit cases for each branch.

Checks

  • npm run typecheck is clean and npm test passes (59 tests).

Not in this PR

The clone gate ran `flagrix scan <url> --json` with no --ref, so
`git clone --branch release …` (or -b) was gated on the default branch
instead of release. Parse --branch/--branch=/-b from the clone itself
(not from other commands on the same line, and after -- for gh repo
clone) and pass it as --ref; name the branch in the block message.

Adds hook tests that run the script with a stubbed npx, and documents
what the hook does and doesn't scan in docs/agent-gating.md.
On an incomplete low scan describeCoverage always ended with "Nothing
was found in what was read", even when low-weight findings were listed
right below it. Pass the finding count and say "only low-weight
findings" when there are some; the zero-findings sentence is unchanged.
The matcher only knew `git clone`, so `git -C /tmp clone …`,
`git -c key=val clone …` and `git --git-dir=… clone …` passed ungated.
Allow any run of git global options (with quoted or unquoted values)
between `git` and `clone`.

docs/agent-gating.md no longer says "every git clone is gated": it says
recognized git clone / gh repo clone commands are, and that the hook
reads command text, so clones behind aliases, variables or scripts are
not seen.
@tiltom tiltom self-assigned this Nov 10, 2026
Bumps the package, the lockfile, `flagrix --version`, the MCP server's
reported version and both versions in server.json to 0.5.1, and syncs
the bundled rules snapshot to 2026.11.10.001.

Patch: the clone gate now scans the branch being cloned and recognizes
git options before `clone`, and the incomplete-scan note no longer says
nothing was found when low findings exist. No JSON or flag changes.
@tiltom
tiltom merged commit d4f18d5 into main Nov 10, 2026
3 checks passed
@tiltom
tiltom deleted the fix/clone-gate-branch-and-coverage-copy branch November 18, 2026 15:46
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.

1 participant