fix(generator): CSI numbering skips note/continuation/vanish siblings (#122, 1/2)#123
Conversation
…#122) renderMarkdown numbered children by raw array index, so specifier-note, continuation, and vanish siblings consumed CSI ordinals and shifted the numbered siblings — a 1..15 "Related Sections" list rendered 5..20. Advance the ordinal only past nodes that actually carry a number (new consumesNumber/renderChildren helpers), at every level (part/article/pr). getLabel is unchanged. The shared markdown renderer feeds MCP + API; the mockup's public/js/tree.js gets the same fix. Refs #122
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes sibling numbering in markdown rendering by introducing ordinal tracking that skips notes, continuations, and vanished nodes. New helper functions track a "number-consuming" ordinal, and three renderers now use ordinal-aware child rendering instead of array indices. A regression test validates the fix. ChangesOrdinal-aware sibling numbering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…des (#122) A blank paragraph that inherited a numbered style (Signal 2) was emitted as an empty numbered node — a phantom "13." row that also consumed a CSI number. buildTree now filters empty paragraphs before structuring (generalizing the prior continuation-only empty drop). Non-empty punctuation-only lines (e.g. a stray tailoring "]") are intentionally kept — Word numbers them too. Combined with PR #123's numbering fix, the manufacturer "Related Sections" example now renders 1..15, matching Word. - inference.test.ts: drops-empty + keeps-"]" unit regressions - paring-fixes.integration.test.ts: local-only end-to-end test; the fixture is copyrighted and gitignored, so it skips in CI like the ARCAT tests Closes #122
PR 1 of 2 for #122 (numbering fix; sanitization follows in PR 2).
Problem
renderMarkdown(shared by MCP + the API, and ported to the mockup) numbered a node's children by their raw array index. Specifier-note, continuation, and vanish siblings therefore consumed CSI ordinals and shifted the numbered siblings: inparing-fixes.docx, a 1–15 "Related Sections" list rendered as 5–20 (4 leading[NOTE]banners pushed it by 4). This happened at every level (part→article, article→pr, pr→pr).Fix
Advance the CSI ordinal only past nodes that actually carry a number. New
consumesNumber()(false fornote/continuation/vanish) +renderChildren()helper;getLabelis unchanged.Verify
Real-file render of "Related Sections" after the fix now starts at
1.:pnpm test→ 49 files, 590 unit tests pass (incl. new regression inmarkdown.test.ts: leading note siblings → list still starts at1.). Verified RED before, GREEN after.pnpm lint(eslint +tsc+ prettier) clean.Scope
pr2and a stray]— are ingestion artifacts handled in PR 2 (inference.tssanitization), which will also commitparing-fixes.docxas a regression fixture.public/js/tree.jscarries the same raw-index logic and gets the identical fix applied on themockupbranch.Refs #122(left open until PR 2).🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests