Skip to content

chore(hooks): scope integ-local-gate to PRs that touch local-execution code - #845

Merged
go-to-k merged 1 commit into
mainfrom
fix/integ-local-gate-scope-check
Jun 13, 2026
Merged

chore(hooks): scope integ-local-gate to PRs that touch local-execution code#845
go-to-k merged 1 commit into
mainfrom
fix/integ-local-gate-scope-check

Conversation

@go-to-k

@go-to-k go-to-k commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Problem

integ-local-gate.sh verified the integ-local marker UNCONDITIONALLY on every gh pr merge / git merge, unlike its sibling gates integ-destroy-gate.sh and integ-broad-gate.sh, which first check whether the merged PR's diff actually touches their scope before consulting the marker.

Because the integ-local marker is file-scoped AND carries a 14-day TTL, a marker that has aged out (or been invalidated by an unrelated src/local change already on main) blocked EVERY merge — including pure src/provisioning PRs that touch no local-execution code at all. This surfaced while merging a Cloud Control RDS provider fix: the gate demanded a Docker local-invoke run for a PR that has nothing to do with local execution.

Fix

Add the PR-diff scope guard the sibling gates already have. For gh pr merge <N> the hook fetches the PR file list via gh pr view <N> --json files and passes the merge through when no path matches the local-execution scope:

^src/local/|^src/cli/commands/local-*.ts$|^tests/integration/local-

git merge and number-less gh pr merge fall through to the unconditional verify (the incoming diff cannot be cheaply enumerated). Fail-open on a gh pr view error so an infra outage never blocks merges, mirroring integ-broad-gate.sh.

This makes the hook match its own documented intent (CLAUDE.md already says it blocks "any PR that touches src/local/** ...").

Tests

4 new smoke cases in integ-local-gate.test.sh (20/20 pass): non-local-files pass-through, src/local file gate-fires, tests/integration/local- file gate-fires, gh pr view failure fail-open. Hook header + .claude/rules/hooks.md gate description updated. No src change.

…n code

integ-local-gate.sh verified the integ-local marker UNCONDITIONALLY on
every `gh pr merge` / `git merge`, unlike its sibling integ-destroy-gate
and integ-broad-gate which first check whether the merged PR's diff
actually touches their scope. Because the integ-local marker is
file-scoped AND carries a 14d TTL, a marker that has aged out (or been
invalidated by an unrelated src/local change already on main) blocked
EVERY merge -- including pure src/provisioning PRs that touch no local
code at all.

Add the PR-diff scope guard the siblings already have: for
`gh pr merge <N>` the hook now fetches the PR file list via
`gh pr view <N> --json files` and passes the merge through when no path
matches the local-execution scope
(^src/local/|^src/cli/commands/local-*.ts$|^tests/integration/local-).
`git merge` and number-less `gh pr merge` fall through to the
unconditional verify since the incoming diff cannot be cheaply
enumerated. Fail-open on a `gh pr view` error (infra outage must not
block merges), mirroring integ-broad-gate.

Adds 4 smoke-test cases (non-local pass-through, src/local file gate,
tests/integration/local- file gate, gh-failure fail-open) and updates
the hooks.md gate description. No src change.
@go-to-k
go-to-k merged commit 041d745 into main Jun 13, 2026
5 checks passed
@go-to-k
go-to-k deleted the fix/integ-local-gate-scope-check branch June 13, 2026 15:14
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.221.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant