Add bounded catalog CSV proposal parser (supersedes #1013)
Adds a pure decoded-text CSV parser that returns proposed catalog rows with source row/line/column pointers, raw cells, identifier states, fingerprints, malformed-row records and duplicate signals. It does not establish identity or rights, accept assertions, persist data, or expose an HTTP/MCP operation.
Supersedes the bounded 16-file parser source from #1013 (c7b91add960bfcdd97c28a74d81b6989b0a09e13) on current main c4ca79f570a262716d07aeb7ccab6adce1d60b92, without bringing over its parent history. The original branch and PR are preserved. This is a source-only slice toward Context #2140, not completion of the import workflow.
The successor caps decoded input at 1,048,576 UTF-16 code units, keeps pending blank lines in constant-size bookkeeping, validates tighter tokenizer limits, and preserves invalid identifier whitespace and non-ASCII characters instead of repairing them. Limits and the malformed unterminated-tail exception are documented in the module README.
Validation: 61 focused tokenizer/proposal/bounds/provenance/identifier tests pass; strict scoped TypeScript, repository lint, scoped lint and TypeScript formatting pass. Independent source review passes after two identifier findings were fixed with red/green regressions. Exactly 16 files under lib/context/imports; no dependency changes.
Current API has no equivalent text proposal parser. Skills' catalog import script handles file-based CSV/XLSX and identity/interest candidates with a different contract, and remains unchanged. Fixtures are synthetic; real-export calibration, original-byte retention, storage, review/acceptance, transport registration and authenticated end-to-end behavior remain follow-up work. No build, listener, provider or live customer operation was run.
Summary by cubic
Adds a bounded pure CSV parser that turns generic catalog export text into proposed rows with source pointers, raw cells, identifier states, fingerprints, malformed-row records, and duplicate signals. It does not establish identity or rights, accept assertions, persist data, or expose an HTTP/MCP operation—every proposal is literally status: "proposed". Supersedes the bounded 16-file parser source from #1013 on current main without its parent history; the original branch is preserved.
Bounded input handling
- Caps decoded input at 1,048,576 UTF-16 code units before scanning, plus 10,000 data rows, 1,000 columns, and 10,000 cell length; whole-input failures throw
ContextImportErrorwith a code and never return a partial result. - Trailing blank lines use constant-size bookkeeping, so a long blank suffix cannot allocate unbounded records; interior blank lines are only materialized once a later record proves they are not trailing.
Parser behavior
- Malformed rows (
empty_row,column_count_mismatch,unterminated_quote,text_after_closing_quote) are reported with pointers beside proposals, never dropped or repaired; a cell with text after its closing quote keeps its literal source text. - Identifiers are shape-checked only: ISRC (2 letters, 3 alphanumerics, 7 digits) and UPC/EAN/GTIN (12–14 digits) after stripping ASCII hyphens and spaces and upper-casing ASCII letters. Tabs, line breaks, non-ASCII characters, and edge whitespace stay
malformedrather than being repaired; empty cells areunknown; a missing column isuncollected. - Duplicates are signals, not deletions:
same_isrcandsame_row_contentlist rows ordered by first row; a shared UPC within one release is not flagged. - Validated by 61 focused tests plus strict scoped TypeScript, repository lint, scoped lint, and TS formatting; no dependency changes and exactly 16 new files under
lib/context/imports.
Fixtures are synthetic; real-export calibration, storage, review/acceptance, transport registration, and authenticated end-to-end behavior remain follow-up work.