Skip to content

fix(canon): deed_canon ignores inline ";" comments - #1136

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/canon-inline-comment
Oct 2, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/canon-inline-comment

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

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 :version therefore 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_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 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.
    • inline-comment decoy cannot mask a stale version. The comment carries the live version and the active pin is 0.0.1; the case expects FAIL (version).
    • inline-comment decoy is ignored when the active pin matches. The comment carries 0.0.1 and a quoted ";"; the case expects PASS.

Evidence

  • Before the fix: 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.
  • After the fix: passed 11 failed 0.
  • Docstring scan: deed_canon is a modified function and documented; coverage is 100%.

Deferred checks

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hw7qg3u9PAP6b2oKyVTSVC

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
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e5aaa1a4-1ef1-4555-a4de-bb139966385f

📥 Commits

Reviewing files that changed from the base of the PR and between c550314 and b1aee82.

📒 Files selected for processing (2)
  • scripts/check-canon-lockstep.sh
  • scripts/tests/check-canon-lockstep-deed-test.sh
 ______________________________________________________
< Linters are opinions; I'm the peer-reviewed journal. >
 ------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 🔴 Error committing to branch - (🔄 Check to retry)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hyperpolymath
hyperpolymath merged commit e2e0f6d into main Oct 2, 2026
50 of 52 checks passed
@hyperpolymath
hyperpolymath deleted the fix/canon-inline-comment branch October 2, 2026 03:49
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>
@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Autopilot could not be updated. Open Coding to check access and billing.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

❌ Failed to create Coding Agent finishing-touch task. Please try again.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant