Conversation
In tools/check-structure.py, required section heading validation previously ran re.findall() against unstripped file text. If a code block contained a comment or string matching a section heading (e.g., `# ## Security`), it falsely satisfied the required section check even if the required section was missing in prose. Extract body and prose (code fences stripped) before evaluating required section headings, and extract headings from prose. Added a regression test in tools/check-structure-test.py. Co-authored-by: mjmirza <34001140+mjmirza@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Problem Reproduction & Root Cause
In
tools/check-structure.py, required section heading validation incheck_file()previously ranre.findall(r"^#{2,3}\s+(.+)$", text, re.M)against raw, unstripped file text (text).Because
textincludes fenced code blocks and ASCII diagrams, if a code block contained a comment or string matching a required section heading (such as# ## Security), those lines were matched as section headings.Consequently, if a pattern entry was missing a required section in prose (e.g.,
## 17. Security), but contained a matching heading line inside a code fence,check-structure.pyfalsely passed the entry without reporting the missing section.Solution
In
tools/check-structure.py, extractbodyandprose(code fences stripped viastrip_fences(body)) before checking required section headings, and extract headings fromproserather than rawtext.In
tools/check-structure-test.py, add unit testtest_check_file_heading_inside_fence_does_not_satisfy_required_section.Historical Duplicate Audit
Checked complete repository history across all branches and commits. This fix has never been proposed before.
Validation
python3 tools/check-structure-test.pypasses all 23 unit tests (including the new regression test).python3 tools/check-structure.pypasses on all 890 published pattern entries across 29 families inpatterns/.make testpasses cleanly.Confidence Score
PR created automatically by Jules for task 17438947466618601045 started by @mjmirza