fix(l3-gate): count mutations not creations — unblock initial bootstrap commit (BRO-1435)#76
Conversation
…tstrap commit (BRO-1435) Found via P11 dogfooding of the v0.27.0 autonomous-loop demo: `bstack bootstrap` activates the L3 rate gate, then the user's first `git commit` of the freshly- *created* governance is blocked — the gate counted 5 newly-created L3 files as 5 mutations (5/1 EXCEEDED). Creation is not mutation: no prior governance state to destabilize. - l3-rate-gate.sh staged count: a staged L3 path counts only if it exists at HEAD (`git cat-file -e HEAD:<path>`); new files + first-ever commit are exempt. - l3-rate-gate.sh committed count: `git log --diff-filter=M` (additions don't consume the budget) + `grep -c .` (fixes a latent off-by-one vs `wc -l` on a format: stream). - tests/l3-rate-gate.test.sh: 4 hermetic cases (creation exempt, 1 mod OK, 2nd mod in window blocked, non-gov ignored). The pre-commit template calls the script, so this fixes both bootstrap Day-1 UX and every deployed pre-commit. Gate purpose preserved: governance modifications still rate-limited to 1/window (case C). Validation: 7 tests green (incl. new + template_lockstep count 20); shellcheck + bash -n clean. P20: independent review PASS 9/10, no blockers. VERSION 0.27.0 -> 0.27.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 16 minutes and 5 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
BRO-1435 — L3 rate gate blocked the initial
bstack bootstrapcommitFound via P11 dogfooding of the v0.27.0 autonomous-loop demo.
bstack bootstrapactivates the L3 rate gate, then the user's firstgit commitof the freshly-created governance is blocked — the gate counted the 5 newly-created L3 files as 5 mutations (5/1 EXCEEDED). Creation is not mutation: there's no prior governance state to destabilize.Fix (
scripts/l3-rate-gate.sh)HEAD(git cat-file -e HEAD:<path>). New files (and the first-ever commit, noHEAD) are exempt.git log --diff-filter=Mso additions don't consume the per-window budget — only modifications do. Switchedwc -lon aformat:%Hstream →grep -c ., fixing a latent off-by-one (one committed L3 mutation previously counted as 0).bstack bootstrapDay-1 UX and every deployed.githooks/pre-commit.Gate purpose preserved
Governance modifications are still rate-limited to 1 per
τ_a₃window. Only creation is exempt.Test plan
tests/l3-rate-gate.test.sh— 4 hermetic cases: A create 5 L3 files → exempt (exit 0) · B 1 modification → within budget (exit 0) · C 2nd modification same window → blocked (exit 1) · D non-governance → ignored (exit 0). 4/4 pass.template_lockstep15/15 (count 20),schema-validation,repair-merge-hooks,onboard,gitignore-aware-bootstrap,omega-drift-trend— all green.bash -n+shellcheckclean.P20 cross-review
Independent reviewer: PASS 9/10, no blockers. Verified the fix does not weaken the gate (proved 3 additional ways 2+ modifications still block), that
git cat-file -e HEAD:correctly handles delete-then-readd / first-commit / spaced paths, no false negatives in the committed count, and--json/--warn-only/--window/hook-contract intact. Minor (accepted): a convoluted delete-then-recreate evasion — acceptable for a stability guardrail, not a security control.Primitive count unchanged (20).
VERSION0.27.0 → 0.27.1. Related: BRO-1431.🤖 Generated with Claude Code