You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
schema: per-scope walkers respect structural run boundaries
Three review findings: the per-scope walkers (rules, content,
acronyms) iterated every matching heading in the parent window,
even after an intervening same-level non-match closed the run
for structural validation. A schema like `Step+` followed by
`Summary` would still apply Step's content / rule / acronym-
scope checks to a `## Step` that appeared after `## Summary`,
diverging from `matchRun`'s contiguous-run semantics.
Extracted a shared `ScopeRunIndices` helper in
internal/schema/validate.go that mirrors matchScope's run
semantics: scan forward from the first match for additional
same-level matches, stop at the first same-level non-match,
skip deeper headings as body content. Falls back to the first
wrong-level match in the window when no in-level match exists
so a misindented section still triggers per-scope checks.
Wired all three walkers through the helper:
- internal/schema/acronyms.go::walkRanges
- internal/schema/validate_content.go::walkContentScopes
- internal/rules/requiredstructure/scope_rules.go::walkScopes
Dropped the no-longer-used `findHead` / `findContentMatchingHead`
/ `scanContentHeads` / `findMatchingHead` / `scanHeads` helpers
that the walkers replaced.
Regression test: TestPlan156_ScopeRunStopsAtBoundary. Two
`## Step` sections satisfy the content constraint, then
`## Summary`, then a third `## Step` without the required code
block; the third Step is outside the run and its content check
must not fire.
https://claude.ai/code/session_012GGH62fZUzLuzP8T4ocGkJ
0 commit comments