Skip to content

Clamp Markdown ranges to physical source lines - #5017

Merged
Widthdom merged 3 commits into
mainfrom
fix-issue4910
Jul 31, 2026
Merged

Clamp Markdown ranges to physical source lines#5017
Widthdom merged 3 commits into
mainfrom
fix-issue4910

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • Clamp Markdown heading ranges to the last physical source line for LF/CRLF and terminated/non-terminated files.
  • Omit empty body ranges, clamp unclosed fenced-code ranges to the same EOF contract, and bump the Markdown extractor contract so existing indexes refresh.
  • Add extractor, persistence, outline/definition, LSP, and 12,648-line regression coverage.

Root cause

SourceLineSplitter intentionally preserves a trailing empty array entry for newline-terminated content, while Markdown EOF ranges used the split-array length as the physical line count.

Validation

  • dotnet build CodeIndex.sln -c Release --no-restore -p:UseSharedCompilation=false — succeeded with 0 warnings and 0 errors for net8.0/net9.0.
  • dotnet test ... -c Release --filter FullyQualifiedName~Issue4910 — 5/5 passed on both net8.0 and net9.0.
  • Markdown-focused tests — 32/32 passed on net8.0; 28/28 passed with 4 existing skips on net9.0.
  • Full Debug net8.0 suite — 11,041 passed, 7 unrelated transient failures, 7 skipped; all 7 failures passed when rerun in isolation.
  • Full Debug net9.0 suite — 10,574 passed, 1 unrelated timing failure, 420 skipped; the failure passed when rerun in isolation.
  • dotnet format CodeIndex.sln --verify-no-changes --no-restore
  • dotnet run --project tools/CodeIndex.Changelog -p:UseSharedCompilation=false -- check
  • Real CHANGELOG.md outline smoke test — total_lines: 12648, root end_line: 12648, root body_end_line: 12648.
  • Codex adversarial review — first-round unclosed-fence finding fixed; second round completed with no findings.

Documentation and changelog

  • Updated the English and Japanese Markdown range contracts in DEVELOPER_GUIDE.md and TESTING_GUIDE.md.
  • Added changelog.d/unreleased/4910.fixed.md.

Follow-up candidates

None.

Fixes #4910

@Widthdom
Widthdom marked this pull request as ready for review July 31, 2026 18:08
@Widthdom
Widthdom merged commit face213 into main Jul 31, 2026
12 checks passed
@Widthdom
Widthdom deleted the fix-issue4910 branch July 31, 2026 18:08
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.

Clamp Markdown root-heading ranges to the actual file

1 participant