Conversation
Move the three hard-coded section-keyword structures out of regex.ts into a single editable JSON file (sections.config.json) with a typed loader (sections.config.ts). No behaviour change — same aliases, same SectionName union, same exports. - sections.config.json: canonical source for aliases, anchors, splitLetterNormalizable, and anchorFallback (8 sections, version "1") - sections.config.ts: typed loader; validates shape at module load; derives SECTION_KEYWORDS, SPLIT_LETTER_NORMALIZABLE_SECTIONS, and new SECTION_ANCHORS / SECTION_ANCHOR_FALLBACK accessors (unread until L2); drift guard (_drift assignment) fails the build if a JSON key is missing from the SectionName union - regex.ts: deletes the three inline structures; imports + re-exports them from sections.config.ts so all existing import paths are unchanged - tsconfig.app.json: adds resolveJsonModule: true (required for tsc to accept the JSON import; Vite already handled it at runtime) Resolves #110
SECTION_ANCHORS and SECTION_ANCHOR_FALLBACK had no reader until L2 (#111) / L3 (#112), so fallow correctly flagged them as dead exports. Remove both; the JSON `anchors` / `anchorFallback` fields stay (still validated at load via SectionConfig), and #111/#112 will add each accessor alongside its consumer so no dead export ships. Refs #110 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Review — Approve ✅Clean, behaviorally faithful refactor. No correctness bugs found. Correctness — verified equivalentChecked the two derived structures against the deleted originals:
Order-dependence doesn't matter regardless — every alias is globally unique across sections, so both Type/build safety — sound
Minor (non-blocking)
Before mergeThe test-plan manual Solid, well-scoped refactor that sets up the L2/L3 anchor work cleanly. |
|
Merged — thanks for the thorough review, @rohithgollapalli. Confirmed the equivalence checks and the #56 sidebar-bleed guard call. Your three minors were all non-blocking so I merged on your approval (dismiss-on-push would've bounced it); filed the drift-guard comment correction (your minor #1) as a follow-up rather than re-trigger a review cycle. |
Lands L2 + L3 of the section-recognition epic (#109, on merged L1 #110), plus #113-review follow-up #114. - #114 — sections.config.ts _drift guard comment reworded to its true one-directional nature + runtime validate() extra-key check. - #111 (L2) — head-noun anchor fallback in matchSectionHeader behind 7 FP guardrails; exports SECTION_ANCHORS + SECTION_ANCHOR_FALLBACKS; skills/other stay off the fallback. Synthetic Chromium fixture added. - #112 (L3) — visual-primary boundary in splitIntoSections (font-ratio >= 1.2) with name/contact disambiguation; first direct unit coverage for splitIntoSections. allCaps dropped as a net-FP visual signal. Two-column flattened-header sidebar-noise regression tracked separately as #117. Closes #108 Closes #111 Closes #112 Closes #114
…113) Moves the three hard-coded section-keyword structures out of regex.ts into a single editable sections.config.json with a typed loader (sections.config.ts). Pure refactor — same aliases, same SectionName union, same exports to all consumers. Unused L2/L3 anchor accessors dropped to keep fallow green. Resolves #110 Co-authored-by: Rohith Gollapalli <rohithgollapalli@users.noreply.github.com>
Lands L2 + L3 of the section-recognition epic (#109, on merged L1 #110), plus #113-review follow-up #114. - #114 — sections.config.ts _drift guard comment reworded to its true one-directional nature + runtime validate() extra-key check. - #111 (L2) — head-noun anchor fallback in matchSectionHeader behind 7 FP guardrails; exports SECTION_ANCHORS + SECTION_ANCHOR_FALLBACKS; skills/other stay off the fallback. Synthetic Chromium fixture added. - #112 (L3) — visual-primary boundary in splitIntoSections (font-ratio >= 1.2) with name/contact disambiguation; first direct unit coverage for splitIntoSections. allCaps dropped as a net-FP visual signal. Two-column flattened-header sidebar-noise regression tracked separately as #117. Closes #108 Closes #111 Closes #112 Closes #114
…113) Moves the three hard-coded section-keyword structures out of regex.ts into a single editable sections.config.json with a typed loader (sections.config.ts). Pure refactor — same aliases, same SectionName union, same exports to all consumers. Unused L2/L3 anchor accessors dropped to keep fallow green. Resolves #110 Co-authored-by: Rohith Gollapalli <rohithgollapalli@users.noreply.github.com>
Lands L2 + L3 of the section-recognition epic (#109, on merged L1 #110), plus #113-review follow-up #114. - #114 — sections.config.ts _drift guard comment reworded to its true one-directional nature + runtime validate() extra-key check. - #111 (L2) — head-noun anchor fallback in matchSectionHeader behind 7 FP guardrails; exports SECTION_ANCHORS + SECTION_ANCHOR_FALLBACKS; skills/other stay off the fallback. Synthetic Chromium fixture added. - #112 (L3) — visual-primary boundary in splitIntoSections (font-ratio >= 1.2) with name/contact disambiguation; first direct unit coverage for splitIntoSections. allCaps dropped as a net-FP visual signal. Two-column flattened-header sidebar-noise regression tracked separately as #117. Closes #108 Closes #111 Closes #112 Closes #114
Summary
Moves the three hard-coded section-keyword structures out of `regex.ts` into a
single editable JSON file (`sections.config.json`) with a typed loader
(`sections.config.ts`). Pure refactor — no behaviour change. Same aliases, same
`SectionName` union, same exports to all existing consumers.
anchors (L2-ready), `splitLetterNormalizable`, and `anchorFallback`. Version
field `"1"` for future migrations.
module load, derives `SECTION_KEYWORDS` + `SPLIT_LETTER_NORMALIZABLE_SECTIONS`
(unchanged public API) + new `SECTION_ANCHORS`/`SECTION_ANCHOR_FALLBACK`
accessors (unread until L2/L3). Drift guard: `const _drift: Record<SectionName,
SectionConfig> = config.sections` fails the build if a JSON key is missing from
the union.
from `sections.config.ts` so `sections.ts`, `markdown-lines.ts`, and
`extract-fields.ts` import paths are unchanged (zero edits to those files).
Vite already handled JSON at runtime).
Closes #110
Test plan
npm run typecheckclean (34 files, 0 errors)npm run testgreen (34 test files, 414 tests, 0 failures)"summary"key in JSON to"summaryX"produces TS2741 at compile time; revertednpm run dev/npm run preview