Repository navigation
Enforce claim scopes at push time - #20
Closed
Deep-Sixed wants to merge 1 commit into
Closed
Deep-Sixed wants to merge 1 commit into
Deep-Sixed wants to merge 1 commit into
Conversation
Scopes were only compared against other claims when a claim was granted; the hook never looked at what a push actually changed, so an agent could claim src/** and push edits anywhere. The pre-receive hook now lists the paths changed by the commits a push introduces (rev-list newrev --not --all, combined diff for merges, renames split) and requires an approval bound to the exact update, including the sorted out_of_scope_paths, when the owner of a claimed branch touches anything outside its scopes. This restores the content-aware check the predecessor Codex_Kernel gate performed on incoming objects, applied to QuorumGit's claim scopes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mc44WsAZx9hzZdWEihDk5a
This was referenced Sep 29, 2026
Owner
Author
|
Closing in favour of #10, which enforces claim scopes in the hook as part of a broader change (it also moves approval consumption into the The branch stays in place because #21 and #22 are stacked on it.
Any that #10 lacks can be ported there. Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1 of 4 restoring ideas from the retired Codex_Kernel repo. The PRs are stacked: this one → approver quorum →
approve request --push→ ref namespaces. Merge in that order.Problem
Declared
--scopeglobs were only compared against other claims when a claim was granted. The pre-receive hook never looked at what a push changed. An agent that claimedsrc/api/**could push edits tosrc/db/**and the hook accepted it, which undercut the README's "overlapping edits" guarantee.Codex_Kernel's gate did inspect the pushed content (changed paths derived from the pushed commits). This PR brings that idea back and applies it to QuorumGit's claim scopes.
Change
gate._new_commit_pathslists the paths changed by the commits the push introduces, usingrev-list <newrev> --not --allpiped intodiff-tree.-c). Merging already-published history such asmainis not charged. Conflict resolutions and edits made inside the merge commit are.--no-renamesis set, so moving a file into scope still charges the path it moved from.check_ref_update: when the owner pushes a claimed branch, any path outside the claim's scopes makes the push anout_of_scope_update. That needs an approval bound to the exact update. The operation includes the sortedout_of_scope_paths, so the approver sees what they are approving. The same field is added when the push is also protected or forced, so one approval covers both.work.scope_matches/paths_outside_scopes/claim_scopesadd real glob matching:**spans any number of directories.*and?stay within one path segment.[...]character classes work.Not affected: unclaimed branches, branch deletions, and the local (no-hook) model.
Tests
tests/test_scope_enforcement.pyadds 30 tests:Local results:
pytest125 passed,ruffclean,pyright0 errors.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mc44WsAZx9hzZdWEihDk5a
Generated by Claude Code