Skip to content

refactor: two names that meant different things in different files - #561

Merged
productdevbook merged 1 commit into
mainfrom
refactor/names-that-lie
Aug 13, 2026
Merged

refactor: two names that meant different things in different files#561
productdevbook merged 1 commit into
mainfrom
refactor/names-that-lie

Conversation

@productdevbook

Copy link
Copy Markdown
Owner

refactor: two names that meant different things in different files

Neither is a bug today. Both are the shape a bug arrives in: a line moved
between two files keeps working and quietly changes contract.

parseCellRef is exported from xlsx/worksheet.ts and is
deliberately lenient — a cell reference that will not parse should cost
one cell, not the read. pivot-writer.ts had a private one under the
same name that throws, which is right for what it does (a targetCell
the caller typed, where a typo has no salvageable reading and pivoting at
A1 silently would be worse) and wrong to reach for anywhere else. It is
now parseCellRefStrict, with the reason for the difference on it.

decodeUtf8 means "decode, and report a part over V8's
MAX_STRING_LENGTH as the #514 ParseError naming it" in reader.ts,
ods/reader.ts and xlsb/reader.ts, and "decode" in stream-reader.ts
and ods/stream.ts. The streaming readers not having the ceiling is
intentional and is what docs/PARITY.md records — streamXlsxRows is
the answer to the ceiling, since it SAX-parses the worksheet off the
decompression stream and never builds one string for it. The two spellings
are now decodeUtf8 and decodeUtf8Unchecked, so the difference is
visible at the call site rather than only in PARITY.

Both notes record what is still true of each streaming path: the parts
stream-reader.ts decodes whole are the small ones, so a
sharedStrings.xml over the ceiling would throw V8's raw error; and
streamOdsRows streams rows out of content.xml but still builds the
whole part as a string to do it.

Names only. pnpm test green — 10,583 tests, 234 files.

🤖 Generated with Claude Code

Neither is a bug today. Both are the shape a bug arrives in: a line moved
between two files keeps working and quietly changes contract.

**`parseCellRef`** is exported from `xlsx/worksheet.ts` and is
deliberately lenient — a cell reference that will not parse should cost
one cell, not the read. `pivot-writer.ts` had a private one under the
same name that *throws*, which is right for what it does (a `targetCell`
the caller typed, where a typo has no salvageable reading and pivoting at
A1 silently would be worse) and wrong to reach for anywhere else. It is
now `parseCellRefStrict`, with the reason for the difference on it.

**`decodeUtf8`** means "decode, and report a part over V8's
`MAX_STRING_LENGTH` as the #514 `ParseError` naming it" in `reader.ts`,
`ods/reader.ts` and `xlsb/reader.ts`, and "decode" in `stream-reader.ts`
and `ods/stream.ts`. The streaming readers not having the ceiling is
intentional and is what `docs/PARITY.md` records — `streamXlsxRows` is
the answer *to* the ceiling, since it SAX-parses the worksheet off the
decompression stream and never builds one string for it. The two spellings
are now `decodeUtf8` and `decodeUtf8Unchecked`, so the difference is
visible at the call site rather than only in PARITY.

Both notes record what is still true of each streaming path: the parts
`stream-reader.ts` decodes whole are the small ones, so a
`sharedStrings.xml` over the ceiling would throw V8's raw error; and
`streamOdsRows` streams rows out of `content.xml` but still builds the
whole part as a string to do it.

Names only. `pnpm test` green — 10,583 tests, 234 files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@productdevbook
productdevbook merged commit ece7bb7 into main Aug 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant