Skip to content

fix(cm): rebuild bounded fields when a link reference or a far indent re-shapes a list - #484

Merged
mtskf merged 3 commits into
mainfrom
chore/arch-07-pr2-guard-regression-corpus
Nov 9, 2026
Merged

mtskf merged 3 commits into
mainfrom
chore/arch-07-pr2-guard-regression-corpus

Conversation

@mtskf

@mtskf mtskf commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Summary

Closes two guard regressions in the changed-range-bounded StateFields: the shared structural guard missed link reference definitions forming/dissolving, and the fenced-code collapse guard missed far indent changes that flip an indented fence between ListItem and Document.

Changes

  • New src/webview/cm/link-reference-risk.ts: scans the edit's nonblank run for a possible (container-relative) [ leaf start on either side of the edit, so edits inside multi-line labels/titles are covered. Shared by both guards.
  • structural-guard.ts: new LINK-REFERENCE arm in touchesStructuralReparse (after NEWLINE/GT deltas, before TABLE-DELIM).
  • fenced-code-collapse.ts: topLevelBoundaryRisk now also fires on an indent delta and on link-reference risk; the insideBlock scoping moved first so in-fence edits stay bounded. The fenced STRUCTURAL regex stays narrow.
  • Corpus: the [a]: /url / [a]; /url pair (both directions) and a leading-frontmatter fence document added to SHAPE_CORPUS; indent dedent→reindent case plus an explicit frontmatter no-collapse assertion in cm-fenced-collapse-bounded.test.ts; one callout bounded≡full case.
  • Accepted over-trigger: line-start links, malformed container prefixes and [-led code lines in the same nonblank run take the full walk. Inline images stay bounded.

Related

  • TODO: ARCH-07 PR2 — shared structural guard and fenced-code guard regressions into the verification corpus

Test Plan

  • pnpm compile
  • Exhaustive oracle: 158 residuals before the fix → 0 after (119,572 checked / 35,132 arms-silent); reverting only the shared fix restores residuals
  • Fenced bounded≡full: new indent and link-ref cases red without their fix, green with it; verbatim-reuse and in-fence hot-path cases stay green
  • lint + full test suite (parallel-checks)

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMxzpcgXWjg2R55jytCAxG

mtskf added 3 commits November 9, 2026 23:35
… re-shapes a list

The shared structural guard missed a link reference definition forming or
dissolving (`[a]: /url` <-> `[a]; /url`), which flips whether following
indented blocks continue a list item. A new shared linkReferenceRisk check
scans the edit's nonblank run so edits inside multi-line labels and titles
are covered too.

The fenced-code collapse guard missed a far indent change flipping an
indented fence between ListItem and Document; topLevelBoundaryRisk now also
fires on an indent delta and on link-reference risk, still scoped outside
existing fence records so in-fence editing stays bounded.

Both regressions, plus the leading-frontmatter fence case from #479, are now
in the exhaustive corpus / fenced bounded-equals-full tests.
@mtskf
mtskf merged commit 437a8b3 into main Nov 9, 2026
2 checks passed
@mtskf
mtskf deleted the chore/arch-07-pr2-guard-regression-corpus branch November 9, 2026 15:03
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.

1 participant