T-2YLD-mc-structured-cells-upstream
Status: planning/backlog · Impact: high · Complexity: small
The dev repo’s table consumers all re-parse raw string[][] rows because the
markdown-contract library throws the cell safeParse output away after
validating. Implement the D-VSLI design (markdown-contract repo PR #49, under
provenance/d0015/) so the contract becomes the single source for table shape
AND typed cell/row values. Three additive pieces:
- A1 — typed cell transforms: keep the cell
safeParseOUTPUT instead of discarding it once validation passes, so a column declared with a Zod transform (e.g. an enum or a parsed Location) yields its transformed value, not the raw string. - B1 — typed row read-back: expose
Row = z.output<cells>typed rows on the table projection and onread(), so a consumer getsrow.Location/row.Kindinstead of indexing into a positionalstring[]. - C1 — position preservation: additively preserve per-cell positions and
inline-code spans (
cellPos/inlineSpans) on the projection, so byte-pinned consumers (placeholder scanners) can keep masking inline code without a second hand-rolled walk.
All three are backward-compatible: raw rows: string[][], the default
TableView type parameter, and the content/table/cell finding shape are
unchanged, so the dev repo keeps building on the current vendored tag until the
consumer tasks (W2-W5) opt in. This is UPSTREAM work in the markdown-contract
repo (tracked here only); the dev repo currently pins markdown-contract at
v0.1.0-pre.2 in package.json, and this task’s tail is cutting a new tag the
dev repo can bump to.
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: D-VSLI piece A1 implemented — a column with a Zod transform yields
its transformed cell value through the projection; the cell
safeParseoutput is retained, not discarded. - AC-2: D-VSLI piece B1 implemented —
Row = z.output<cells>typed rows are available on the table projection and onread(). - AC-3: D-VSLI piece C1 implemented — per-cell positions (
cellPos) and inline-code spans (inlineSpans) are additively preserved on the projection. - AC-4: Backward-compatible — raw
rows: string[][], the defaultTableViewtype parameter, and thecontent/table/cellfinding shape are unchanged; existing markdown-contract tests stay green. - AC-5: A new markdown-contract release/tag is cut that the dev repo can
consume by bumping the
markdown-contractpin inpackage.json.
Out of scope
Section titled “Out of scope”- Rewiring any dev-repo consumer onto the new typed-cell/typed-row API — that is W2 (touchpoint parsers), W3 (scan-placeholders), W4 (frontmatter read-back), and W5 (Operations tables).