From dc1661c222304dddd797bece882bb2501d2b6e76 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 15 May 2026 23:03:10 -0500 Subject: fix(cj-scan): suppress detection inside nested non-cj begin_* blocks cj-scan.py matched =#+begin_src cj:= / =#+end_src= line-by-line without awareness of enclosing block scopes. A cj fence embedded inside =#+begin_example= (typical when documenting what the = for any type other than cj: (the cj-open regex is checked first), enter a wrapper state where every line is content until the matching =#+end_= closer fires. Inside a wrapper, both fence patterns and legacy inline cj: lines stay suppressed. Added the TestCjScanNestedFencesIgnored class with 6 tests: nesting inside example, src , and quote; regression guards for clean wrapper close and unclosed-wrapper non-swallow. Canonical pytest: 302 passed, 1 skipped. --- todo.org | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'todo.org') diff --git a/todo.org b/todo.org index 2160558..aea4ab1 100644 --- a/todo.org +++ b/todo.org @@ -1800,6 +1800,33 @@ Scope: Origin: came up while authoring =triage-intake.org= on 2026-05-11. * Rulesets Resolved +** DONE [#C] Fix =cj-scan= false positives on cj fences nested inside other =#+begin_*= blocks :bug: +CLOSED: [2026-05-15 Fri] + +=cj-scan.py= was matching =#+begin_src cj:= / =#+end_src= line-by-line +without awareness of enclosing block scopes. A cj fence embedded inside a +=#+begin_example= block (typically when documenting what the == +(for any == other than =cj:= via the more-specific cj-open regex, which +is checked first), it enters a wrapper state where every line is treated as +content until the matching =#+end_= closer fires. Inside a wrapper, cj +fence patterns and legacy inline =cj:= lines are both suppressed. + +Tests: added =TestCjScanNestedFencesIgnored= (6 tests) to +=claude-templates/.ai/scripts/tests/test_cj_scan.py= covering nesting inside +=#+begin_example=, =#+begin_src =, and =#+begin_quote=, plus +regression guards that a wrapper closes cleanly (a subsequent real cj fence +is still detected) and that an unclosed wrapper doesn't silently swallow +later content into false-positive cj blocks. + +Full =make test-scripts= equivalent (=python3 -m pytest=): 302 passed, 1 +skipped, 0 failures. + ** DONE [#A] Add =make doctor= — verify ~/.claude/ matches repo + settings.json :feature: A drift detector that scans =~/.claude/= and reports anything inconsistent with what the repo expects. Single-command answer to "is my machine consistent with rulesets?" -- cgit v1.2.3