test(#2137): column-invariance property + boundary tests; mark parser pending #2143

Address @trek-e's review (Option 2, interim tactical fix) on PR #2168:

- Add a fast-check property test (tests/derive-progress.property.test.cjs)
  asserting deriveProgressFromRoadmap's derived counts are invariant to
  header column ORDER and COUNT — shuffle the header cells and inject
  unrelated columns, assert counts match the data. This pins the parser's
  core new capability (header-name lookup vs. the old position-locked regex).
  Named derive-progress (not phase-lifecycle) so it isn't greedily attributed
  to the shorter `phase` prod prefix under lint-test-file-count; like the other
  *.property.test.cjs files it maps to no module and is cap-exempt.
- Add boundary regression tests in state.test.cjs: header+separator only
  (0 rows -> all-null), exactly 1 row, and ragged rows (extra/short cells,
  handled without throwing).
- Mark the adhoc Progress-table scan as pending the ADR-2143
  parseMarkdownTable/TABLE_SCHEMAS seam (re-point pending #1372 -> #2143).
- Fix the changeset lead-in to the required bold form.

Per the maintainer, reader/writer parity and CONTEXT.md updates are
explicitly out of scope for this stopgap — Phase 1 (ADR-2143) owns them.

Validated: property test 200 runs green; state.test.cjs #2137 block 8/8;
eslint clean; lint-test-file-count green; full `npm test` exit 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Behruz Nassre Esfahani
2026-07-13 06:51:21 -07:00
parent 78f4c4a9c3
commit 7a61294196
4 changed files with 202 additions and 1 deletions

View File

@@ -59,6 +59,11 @@ export function deriveProgressFromRoadmap(roadmapContent: string): RoadmapProgre
// an h3 `### Progress` (the `## Progress` substring starts at the 2nd hash),
// letting a decoy subheading hijack the slice.
// Case-insensitive to match the case-insensitive header-cell comparison below.
//
// allow-adhoc-markdown: line-based Progress-table scan (header lookup +
// positional cell indexing); table parsing is out of the markdown-sectionizer
// seam's scope. Superseded by the ADR-2143 parseMarkdownTable/TABLE_SCHEMAS
// seam; pending #2143.
const progressMatch = roadmapContent.match(/^##[ \t]+Progress\b/im);
let scoped = roadmapContent;
if (progressMatch && progressMatch.index !== undefined) {