fix(canon): deed_canon ignores inline ";" comments - #1136
Merged
Merged
Conversation
DEED comments run from any ";" outside a string to line-end (deed.abnf `comment`), but deed_canon stripped only whole-line comments. A clause written `(canon ; :version "2.1.2"` followed by an active stale `:version` returned the commented value, so Gate A assertion 3 could pass a spine that is out of lockstep. The reader now drops each line's comment tail with a quote-aware awk scan (a ";" inside a string, including after an escaped quote, is kept). It is backslash-free, so the byte-identical copies in rsr-template-repo's dogfood-gate.yml and repo-init.just stay safe. Two new cases in check-canon-lockstep-deed-test.sh: an inline decoy cannot mask a stale version, and an inline decoy is ignored when the active pin matches. Both failed before the fix (9/11), 11/11 after. Raised by CodeRabbit on rsr-template-repo#222. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hw7qg3u9PAP6b2oKyVTSVC
Contributor
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
hyperpolymath
added a commit
to hyperpolymath/rsr-template-repo
that referenced
this pull request
Oct 2, 2026
## Summary The `deed_canon` reader now ignores inline `;` comments. Before this, it stripped only whole-line comments. This answers the CodeRabbit thread on #222. A clause written `(canon ; :version "2.1.2"` followed by an active stale `:version "2.1.1"` returned the **commented** value. The dogfood Canon lockstep check could then pass a deed that is out of lockstep, and `just init` could stamp a pin the deed does not hold. DEED's grammar (`deed.abnf`, `comment = ";" *text-char line-end`) allows a comment from any `;` outside a string. ## Changes - `deed_canon` drops each line's comment tail with a quote-aware awk scan. A `;` inside a string is kept, including one after an escaped `\"`. The change is in `.github/workflows/dogfood-gate.yml` and `build/just/repo-init.just`. - The reader stays **backslash-free**, as the `canon_key` note requires. The quote and backslash characters come from `sprintf("%c", 34/92)`. - It is byte-identical to the copy in standards `scripts/check-canon-lockstep.sh` (one md5 across all three). The regression cases live in that repo's `check-canon-lockstep-deed-test.sh`: hyperpolymath/standards#1136. Verified: - This repo's own deed still reads 2.1.2 / `6a5aa885…` / `e70efd2f…`. - On a probe deed with `(canon ; :version "9.9.9"`, `:version "1;2"`, and a trailing-comment decoy, the reader returns `1;2` and the real gates hash. ## RSR Quality Checklist ### Required - [x] Tests pass (standards suite 11/11; the two new cases failed before the fix) - [x] Code is formatted - [x] Linter is clean - [x] No banned language patterns - [x] No `unsafe` blocks without `// SAFETY:` comments - [x] No banned functions - [x] SPDX license headers present on all new/modified source files - [x] No secrets, credentials, or `.env` files included ### As Applicable - [x] Documentation updated: the function's comment now states the comment rule ## Screenshots N/A: shell reader only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Hw7qg3u9PAP6b2oKyVTSVC <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Canonical pin checks now correctly extract declarations when inline semicolon comments are present, while preserving semicolons and escaped characters inside quoted strings. * This improves consistency of pin validation across repository checks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Autopilot could not be updated. Open Coding to check access and billing. |
Contributor
|
❌ Failed to create Coding Agent finishing-touch task. Please try again. |
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.
Summary
Gate A assertion 3 reads the spine deed through
deed_canon. That reader stripped only whole-line;comments. DEED comments, however, run from any;outside a string to the end of the line (1-formats/deed/spec/abnf/deed.abnf,comment).A clause written
(canon ; :version "<live>"followed by an active stale:versiontherefore returned the commented value, and the gate passed a spine that is out of lockstep. CodeRabbit raised this on hyperpolymath/rsr-template-repo#222.Changes
scripts/check-canon-lockstep.sh:deed_canondrops each line's comment tail with a quote-aware awk scan. A;inside a string is kept, including one after an escaped\". The scan is backslash-free and byte-identical to the two copies in rsr-template-repo, updated in fix(canon): deed_canon ignores inline ";" comments rsr-template-repo#224.scripts/tests/check-canon-lockstep-deed-test.sh: two new cases.0.0.1; the case expects FAIL(version).0.0.1and a quoted";"; the case expects PASS.Evidence
passed 9 failed 2, and the two new cases are the two failures. That counts as the mutant kill: the old reader is the mutant.passed 11 failed 0.deed_canonis a modified function and documented; coverage is 100%.Deferred checks
governance / Workflow security linter: pre-existing red onmain(KYAML flow-sequence false positive inprovisioning-check-reusable.yml), unrelated to this change. Deferred to Workflow security linter: duplicate-key checker false-positives on KYAML flow sequences (red on main since #1133) #1137.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hw7qg3u9PAP6b2oKyVTSVC