Skip to content

Complete Plan 61: Required Structure Rule Hardening - #168

Merged
jeduden merged 1 commit into
mainfrom
claude/structure-hardening-nAcAb
Apr 26, 2026
Merged

Complete Plan 61: Required Structure Rule Hardening#168
jeduden merged 1 commit into
mainfrom
claude/structure-hardening-nAcAb

Conversation

@jeduden

@jeduden jeduden commented Apr 25, 2026

Copy link
Copy Markdown
Owner

Summary

This PR completes Plan 61 by adding comprehensive edge-case tests for the MDS020 required structure rule and improving diagnostic messages to include expected values. All acceptance criteria have been met and the plan is marked complete.

Key Changes

Test Coverage Enhancements

  • Added 7 new unit tests covering critical edge cases:
    • Wildcard heading level mismatch: Validates that wildcard headings (# ?) still enforce correct heading levels
    • Soft-wrapped body paragraphs: Ensures multi-line body text matches front matter fields when concatenated
    • Body sync diagnostic clarity: Improved messages now include the expected value so authors know what to write
    • Integer front matter sync: Validates that numeric front matter values are properly stringified for heading sync
    • Missing heading sync suppression: Confirms sync checks don't fire spurious diagnostics when required headings are absent
    • Multiple missing sections: Tests that each missing required section generates its own diagnostic
    • Combined ordering and level errors: Validates that sections with both ordering and level issues report both diagnostics

Diagnostic Message Improvements

  • Enhanced checkBodySync() to include the expected value in error messages
    • Changed from: body does not match frontmatter field "description"
    • Changed to: body does not match frontmatter field "description": expected "..."
  • Updated README documentation to reflect the improved diagnostic format

Test Fixtures

  • Added wildcard-level.md: Tests wildcard heading with incorrect level
  • Added multi-missing.md: Tests multiple missing required sections
  • Added wildcard-tmpl.md: Template file for wildcard heading tests

Plan Completion

  • Marked Plan 61 status as complete (✅)
  • Checked off all 5 tasks and 6 acceptance criteria in the plan document
  • Updated main PLAN.md to reflect completion status

Implementation Details

  • All new tests follow existing patterns using writeSchema(), newTestFile(), and assertion helpers
  • Tests are focused and isolated, each validating a single edge case
  • Diagnostic messages now provide actionable guidance by showing expected values
  • No breaking changes to existing functionality; all improvements are additive

https://claude.ai/code/session_01Lt7t1NZecqrysXAAp63LYa

Copilot AI review requested due to automatic review settings April 25, 2026 07:27
@codecov

codecov Bot commented Apr 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.69%. Comparing base (c323541) to head (d5548ae).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #168      +/-   ##
==========================================
+ Coverage   89.65%   89.69%   +0.03%     
==========================================
  Files         113      113              
  Lines       12163    12163              
==========================================
+ Hits        10905    10909       +4     
+ Misses        798      796       -2     
+ Partials      460      458       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Completes Plan 61 by hardening the MDS020 (required-structure) rule via additional edge-case coverage and clearer body-sync diagnostics (including the expected value in the message).

Changes:

  • Added targeted unit tests for required-structure edge cases (wildcard level enforcement, soft-wrapped body sync, integer front matter sync, missing-heading sync suppression, multi-missing sections, combined ordering+level errors).
  • Improved body-sync diagnostic messaging to include the expected value, and updated rule documentation accordingly.
  • Added new MDS020 fixture files for wildcard-level mismatch and multiple missing required sections; marked Plan 61 complete in plan tracking docs.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plan/61_required-structure-hardening.md Marks Plan 61 tasks/acceptance criteria as completed.
internal/rules/requiredstructure/rule_test.go Adds Plan 61 edge-case unit tests for MDS020 behavior.
internal/rules/requiredstructure/rule.go Enhances body-sync diagnostic to include the expected value.
internal/rules/MDS020-required-structure/bad/wildcard-level.md Adds fixture asserting wildcard heading level mismatch diagnostic.
internal/rules/MDS020-required-structure/bad/multi-missing.md Adds fixture asserting multiple missing required sections diagnostics.
internal/rules/MDS020-required-structure/bad/data/wildcard-tmpl.md Adds schema template fixture for wildcard heading tests.
internal/rules/MDS020-required-structure/README.md Updates documented body-sync diagnostic format with expected value.
PLAN.md Updates Plan 61 status to complete in the main plan index.

@jeduden jeduden added queue Add to a PR to enqueue it and removed queue Add to a PR to enqueue it labels Apr 25, 2026
@jeduden
jeduden force-pushed the claude/structure-hardening-nAcAb branch from 80322fc to 8e7a36e Compare April 25, 2026 08:12
@jeduden
jeduden requested a review from Copilot April 25, 2026 08:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@jeduden
jeduden force-pushed the claude/structure-hardening-nAcAb branch from 8e7a36e to 81cb3ca Compare April 26, 2026 06:19
@jeduden jeduden added queue Add to a PR to enqueue it queue:active Applied automatically when a PR is in an active batch and removed queue Add to a PR to enqueue it labels Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

🟢 Merge Queue — picked up

This PR is in the queue and will be batched with other queue-labelled PRs.

Next: No action needed — you'll get another comment when CI starts on the batch. View merge queue run.

@jeduden jeduden added queue Add to a PR to enqueue it and removed queue:active Applied automatically when a PR is in an active batch labels Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

Merge Queue — requeued

The merge queue hit an error while processing this PR:

batch creation failed: git push origin merge-queue/batch-168-1777185064:refs/heads/merge-queue/batch-168-1777185064 failed (exit 128): fatal: could not read Username for 'https://github.com': terminal prompts disabled

View merge queue run.

Next: No action needed — the queue will retry on the next tick.

@jeduden jeduden added queue:active Applied automatically when a PR is in an active batch and removed queue Add to a PR to enqueue it labels Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

🟢 Merge Queue — picked up

This PR is in the queue and will be batched with other queue-labelled PRs.

Next: No action needed — you'll get another comment when CI starts on the batch. View merge queue run.

@jeduden jeduden added queue Add to a PR to enqueue it and removed queue:active Applied automatically when a PR is in an active batch labels Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

Merge Queue — requeued

The merge queue hit an error while processing this PR:

batch creation failed: git push origin merge-queue/batch-168-1777185084:refs/heads/merge-queue/batch-168-1777185084 failed (exit 128): fatal: could not read Username for 'https://github.com': terminal prompts disabled

View merge queue run.

Next: No action needed — the queue will retry on the next tick.

@jeduden jeduden added queue:active Applied automatically when a PR is in an active batch and removed queue Add to a PR to enqueue it queue:active Applied automatically when a PR is in an active batch labels Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

🟢 Merge Queue — picked up

This PR is in the queue and will be batched with other queue-labelled PRs.

Next: No action needed — you'll get another comment when CI starts on the batch. View merge queue run.

@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

Merge Queue — requeued

The merge queue hit an error while processing this PR:

batch creation failed: git push origin merge-queue/batch-168-1777185102:refs/heads/merge-queue/batch-168-1777185102 failed (exit 128): fatal: could not read Username for 'https://github.com': terminal prompts disabled

View merge queue run.

Next: No action needed — the queue will retry on the next tick.

@jeduden jeduden added the queue Add to a PR to enqueue it label Apr 26, 2026
@jeduden jeduden added queue:active Applied automatically when a PR is in an active batch and removed queue Add to a PR to enqueue it labels Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

🟢 Merge Queue — picked up

This PR is in the queue and will be batched with other queue-labelled PRs.

Next: No action needed — you'll get another comment when CI starts on the batch. View merge queue run.

@jeduden jeduden removed the queue:active Applied automatically when a PR is in an active batch label Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

Merge Queue — requeued

The merge queue hit an error while processing this PR:

batch creation failed: git push origin merge-queue/batch-168-1777185119:refs/heads/merge-queue/batch-168-1777185119 failed (exit 128): fatal: could not read Username for 'https://github.com': terminal prompts disabled

View merge queue run.

Next: No action needed — the queue will retry on the next tick.

@jeduden jeduden added queue Add to a PR to enqueue it and removed queue Add to a PR to enqueue it labels Apr 26, 2026
Copilot AI review requested due to automatic review settings April 26, 2026 13:56
@jeduden
jeduden force-pushed the claude/structure-hardening-nAcAb branch from 81cb3ca to 1f0fdde Compare April 26, 2026 13:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

- checkBodySync now includes the expected value in its message so
  authors know immediately what text the body must contain
- Add 7 unit tests covering wildcard heading level mismatch, soft-wrapped
  body sync, integer front matter values, sync not fired for absent
  headings, multiple simultaneously missing sections, and out-of-order
  sections that also carry a level mismatch
- Add fixture tests: bad/wildcard-level.md (h2 where h1 required) and
  bad/multi-missing.md (two required sections both absent)
- Update README Diagnostics table to show the improved body-sync format
- Mark plan 61 complete

https://claude.ai/code/session_01Lt7t1NZecqrysXAAp63LYa
@jeduden
jeduden force-pushed the claude/structure-hardening-nAcAb branch from 1f0fdde to d5548ae Compare April 26, 2026 14:58
@jeduden jeduden added queue Add to a PR to enqueue it queue:active Applied automatically when a PR is in an active batch and removed queue Add to a PR to enqueue it labels Apr 26, 2026
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

🟢 Merge Queue — picked up

This PR is in the queue and will be batched with other queue-labelled PRs.

Next: No action needed — you'll get another comment when CI starts on the batch. View merge queue run.

@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

🔵 Merge Queue — CI running

Merged into batch branch merge-queue/batch-168-1777215877. View CI run.

Next: No action needed — you'll be notified when CI completes.

@jeduden jeduden removed the queue:active Applied automatically when a PR is in an active batch label Apr 26, 2026
@jeduden
jeduden merged commit cbf8a6b into main Apr 26, 2026
12 checks passed
@jeduden

jeduden commented Apr 26, 2026

Copy link
Copy Markdown
Owner Author

Merge Queue — merged

This PR landed on main via commit cbf8a6b. CI run that validated the merge.

Next: Done — nothing more to do here.

jeduden pushed a commit that referenced this pull request May 3, 2026
- Fix misleading "Skip images" comment in scanFullRefs (Copilot #203)
- Fix inaccurate shortcutRE comment (Copilot #270)
- Handle image shortcuts ![label] in scanShortcutRefs: bypass heuristic
  since '!' makes intent unambiguous, adjust column to '!' position
  (Copilot #315)
- Add tests for image shortcuts (collapsed and shortcut forms, Copilot #168)
- Add tests covering previously uncovered paths: PI block content,
  collapsed-ref footnote/placeholder/image/code-block exclusions,
  shortcut starting with digit, ApplySettings error branches,
  toStringSlice variants

https://claude.ai/code/session_01KTesZkrq3uXhbR36d8SdCH
jeduden pushed a commit that referenced this pull request May 3, 2026
- Fix misleading "Skip images" comment in scanFullRefs (Copilot #203)
- Fix inaccurate shortcutRE comment (Copilot #270)
- Handle image shortcuts ![label] in scanShortcutRefs: bypass heuristic
  since '!' makes intent unambiguous, adjust column to '!' position
  (Copilot #315)
- Add tests for image shortcuts (collapsed and shortcut forms, Copilot #168)
- Add tests covering previously uncovered paths: PI block content,
  collapsed-ref footnote/placeholder/image/code-block exclusions,
  shortcut starting with digit, ApplySettings error branches,
  toStringSlice variants

https://claude.ai/code/session_01KTesZkrq3uXhbR36d8SdCH
jeduden pushed a commit that referenced this pull request May 4, 2026
- Fix misleading "Skip images" comment in scanFullRefs (Copilot #203)
- Fix inaccurate shortcutRE comment (Copilot #270)
- Handle image shortcuts ![label] in scanShortcutRefs: bypass heuristic
  since '!' makes intent unambiguous, adjust column to '!' position
  (Copilot #315)
- Add tests for image shortcuts (collapsed and shortcut forms, Copilot #168)
- Add tests covering previously uncovered paths: PI block content,
  collapsed-ref footnote/placeholder/image/code-block exclusions,
  shortcut starting with digit, ApplySettings error branches,
  toStringSlice variants

https://claude.ai/code/session_01KTesZkrq3uXhbR36d8SdCH
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.

3 participants