aidd-lint hard-wrap cop joins code lines inside a nested fence #563
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#563
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The os-aidd-lint hard-wrap cop does not track fence depth. It should skip lines inside code fences of any depth, but currently treats code inside nested fences as prose.
Observed
plugins/os-aidd-lint/bin/aidd-lint --fix plugins/os-sdlc/agents/responsibility-auditor.mdjoined three code lines into one line, breaking the Ruby sketch inside a nested fence.After manual restoration, the plain check still reports:
plugins/os-sdlc/agents/responsibility-auditor.md:78: hard-wrap: paragraph (lines 78-80) is hard-wrapped.Reproduce
Expected
The cop should track fence depth. Lines inside an inner fence (of any backtick count) must be skipped by both check and autofix.
Illustration
Triage 2026-09-21
Still reproduces. Verified today on the live file and on a minimal case.
Evidence
plugins/os-aidd-lint/bin/aidd-lint plugins/os-sdlc/agents/responsibility-auditor.mdreports79: hard-wrap: paragraph (lines 79-81) is hard-wrapped(line shifted by one since filing; nested fence spans lines 66-107).a = 1/b = 2/c = 3. Check flags lines 11-13;--fixrewrites them toa = 1 b = 2 c = 3.df09b557).Root cause
plugins/os-aidd-lint/lib/aidd_lint/fence_mask.rb—FENCE = /\A\s*(```+|~~~+)/andinside = !insideon every match. One boolean, no marker length. The inner ``` closes the outer ```` fence.Solution
Follow the CommonMark rule: remember the opening fence character and length; a line closes the fence only if it uses the same character with at least that many marks. Lines inside stay masked. No stack is needed: a shorter inner marker is content, not a new fence.
hard_wrap.rbconsumes the mask viadocument.skip_maskunchanged.Cases
~~~marker inside a backtick fence: does not close it.Regression test in
plugins/os-aidd-lint/tests/cops/hard_wrap_test.rb(or a new fence_mask test) covering the nested case.Work started via /os-sdlc:implement on branch ticket-563 (session 8858ead3-4a18-4793-a17b-b548ce11a3a9).
Resolution
Done: FenceMask now tracks the opening fence marker character and length; a line closes the fence only on a same-character marker of at least that length, so a nested shorter fence (e.g. ```ruby inside ````markdown) stays masked from both the hard-wrap check and --fix
Evidence: commit
1ab89c6d70, plugins/os-aidd-lint/lib/aidd_lint/fence_mask.rb + plugins/os-aidd-lint/tests/fence_mask_test.rb; ruby -Iplugins/os-aidd-lint/lib -Iplugins/os-aidd-lint/tests plugins/os-aidd-lint/tests/fence_mask_test.rb -> 5 runs, 5 assertions, 0 failuresFollow-ups: #620 contract-auditor verdict, #621 dispatch-id settlement gap (both already filed)