Repository navigation
Add protected fields: structured rules for values in JSON/TOML files - #33
Draft
Deep-Sixed wants to merge 8 commits into
Draft
Deep-Sixed wants to merge 8 commits into
Deep-Sixed wants to merge 8 commits into
Conversation
A protected path governs a whole file; a protected field governs one value inside matching JSON or TOML files, named by a JSON Pointer. A push needs a protected_field_update approval only when it changes that value. - structured.py derives field changes from Git objects, per commit new to the repository (same known tips as protected paths), with combined-diff semantics for merges. Values compare as canonical JSON (1, 1.0 and true differ; key order does not). Missing <-> present is a change; content that cannot be parsed or read fails closed. - Migration 010: protected_fields table, and ref_updates.field_changes so the reference-transaction prepared stage replays what pre-receive derived (NULL rows from before the migration are recomputed). - gate: protected_field_update operation in the hook, the prepared-stage re-validation, and approve prepare (which now also reports fields). - registry/CLI: repo protect-field <repo> <glob> <pointer> [--format] [--remove], operator only and audited; repo policy lists the rules; protected_field_update can take a per-operation policy override. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0142xh1CDDPxBvB1EHu6PN3m
# Conflicts: # README.md # src/quorumgit/gate.py # src/quorumgit/git_objects.py # tests/test_approval_authority.py # tests/test_authorization_binding.py
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.
A protected path covers a whole file. A protected field covers one value inside matching JSON or TOML files. This is the "structured rules" follow-up to protected paths, and the general version of Codex_Kernel's
PROTECTED_JSON_FIELDS. A push needs aprotected_field_updateapproval only when it changes that value. Other edits to the same file are ordinary content.quorumgit repo protect-field myproject config/state.json /max_depth --agent lead quorumgit repo protect-field myproject 'services/*/settings.toml' /limits/replicas --agent lead quorumgit repo protect-field myproject config/state /schema_version --format json --agent leadWhat changes
structured.pyworks out field changes from Git objects alone:1,1.0andtruecount as different; reordered object keys don't.~0/~1escapes and array indices.''means the whole document.012_protected_fields.sql:protected_fieldstable.ref_updates.field_changes. The reference-transactionpreparedstage replays the field changes pre-receive recorded, the same way it replayspathsandscope_paths, so the operation hashes don't shift. Rows validated before the migration have NULL there and are recomputed.protected_field_updateoperation, with fields shown aspath#pointerin rejection messages.approve prepareworks out field changes from the clone using the same code and reports them.repo protect-field <repo> <glob> <pointer> [--format json|toml] [--remove]is operator-only and audited. The format comes from the glob's extension unless--formatis given.repo policylists the rules.protected_field_updateis a new operation type, so it can have its own per-operation policy (for example, two votes).Testing
tests/test_protected_fields.py(11 tests):prepare's hash matching the hook's, approved, pushed, and consumed; other edits to the file need nothing, and changing the value again needs a new approval010.pytest: 273 passed.ruff checkandpyrightare clean.🤖 Generated with Claude Code
https://claude.ai/code/session_0142xh1CDDPxBvB1EHu6PN3m
Generated by Claude Code
Integration after review fixes
Merged current
mainthrough #32, #34, and #35 into this branch without rebasing or rewriting history.012_protected_fields.sql, after merged010_protected_ref_names.sqland011_quorum_consumer_separation.sql.The integration review also caught and fixed the replay case where a validation has pre-derived paths but no stored field-change list (for example, an update validated before the protected-fields migration). A regression test now covers recomputing only the missing field changes without re-deriving or referencing absent path variables.