commands/reflect: exclude H1 from the numbered-sequence match - #175
Merged
Merged
Conversation
v0.133.1 shipped `^#+ [0-9]+\.`, which matches any heading depth. A fenced
code block containing `# 1. what is suppressed` / `# 2. the unfiltered source`
is therefore counted as sections 1 and 2, and `uniq -d` reports collisions
that do not exist.
Caught on the first real run of the step it had just added: the check returned
`1 2 17` against a page whose only true duplicate is 17. The `tail -1` max is
exposed to the same defect - a numbered comment above every real heading would
silently inflate the next number.
Narrow to `^#{2,6}`. Safe because vault notes never carry `# H1` (the filename
is the title), and the collision detector still fires on a fabricated `### 5.`
duplicate.
The step was verified before shipping with a positive and a negative control,
both synthetic; neither had a code fence, so the failure mode existed only in
real input.
bborbe
marked this pull request as ready for review
September 17, 2026 16:42
There was a problem hiding this comment.
Now I have everything I need. Let me perform the in-session classification and adjudication.
Classification (Step 4c-sel):
Changed files: CHANGELOG.md, commands/reflect.md — neither is a .go file, no go.mod, no Makefile, no agent/command/skills files.
Judgment candidates filtered by trigger:
changelog/conventional-prefix-required— triggerCHANGELOG.md→ applicable: the entry starts withfix:✓ (passes)agent-cmd/command-frontmatter— triggercommands/**/*.md→ skipped: file existed before, rule applies when "anycommands/*.mdfile is created"agent-cmd/command-thin— trigger includescommands/**/*.md→ skipped: file existed before, rule applies when "any newcommands/*.mdfile is added or substantially changed"
All other rules have triggers that don't match (**/*.go, go.mod, Makefile, etc.).
Mechanical findings: zero (already confirmed).
Adjudication (Step 4d-sel):
changelog/conventional-prefix-required: entryfix:✓- The fix itself is correct:
^#{2,6}on lines 169/171 properly excludes depth-1 headings - Version alignment: all four version strings are still
0.133.1— appropriate for an## Unreleasedentry (the releaser will bump on merge) - No Go code, no tests, no security surface
{
"verdict": "approve",
"summary": "Clean bugfix: the ENHANCE path's collision-detection regex was too broad (`^#+`), matching bash comments inside fenced code blocks as section headings. The fix narrows it to `^#{2,6}` (depth 2–6 only), which is safe because vault note filenames are the H1 and never carry `# H1`. The CHANGELOG entry uses the correct `fix:` prefix. Version strings remain at v0.133.1, appropriate for an `## Unreleased` section.",
"comments": [],
"concerns_addressed": [
{
"concern": "correctness: regex `^#+` matched depth-1 headings AND `#`-prefixed lines inside fenced code blocks, causing false positive duplicate collisions",
"disposition": "addressed",
"detail": "commands/reflect.md:169,171 — `^#+` replaced with `^#{2,6}`; depth-1 headings excluded because vault filenames serve as titles"
},
{
"concern": "tests: original v0.133.1 step was verified with synthetic fixtures lacking code fences — defect only reproduced in real input",
"disposition": "not-an-issue",
"detail": "This is a documentation-only fix in a Claude Code commands file; no Go code or test suite is affected. The concern is noted as background context for why the defect was not caught pre-release."
}
]
}
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.
What
Narrows the numbered-sequence match in
/vault-cli:reflect's ENHANCE path from^#+to^#{2,6}.The bug
v0.133.1 (merged ~40 min ago) added a step telling ENHANCE to derive the next section number from the whole file:
^#+matches any heading depth — including a#-prefixed line inside a fenced code block. On a page whose bash examples contain:…those comments are counted as sections 1 and 2, and
uniq -dreports duplicates that do not exist.Caught on the first real run of the step it had just added. The check returned
1 2 17against a page whose only genuine duplicate is17.The
tail -1max carries the same exposure: a numbered comment higher than any real heading would silently inflate the next number, which is the exact failure the step was written to prevent.Why it reached a release
The step was verified before shipping, with a positive control (fabricated
### 5.duplicate → caught) and a negative control (clean file → silent). Both fixtures were synthetic and neither contained a code fence, so the defect existed only in real input. That is the gap, and it is worth naming rather than quietly patching.The fix
^#{2,6}— excludes depth-1 only. Safe because vault notes never carry# H1; the filename is the title, and the no-H1 rule is a documented vault convention.Verified on the same real page:
^#+(shipped)1 2 17← two phantom^#{2,6}(this PR)17← correctNegative control re-run: a fabricated
### 5./### 5.pair is still caught.Severity
Fails safe — it over-reports collisions, so a reader investigates a phantom rather than missing a real one. Hence a follow-up rather than a revert.