refactor: two names that meant different things in different files - #561
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
parseCellRefis exported fromxlsx/worksheet.tsand isdeliberately lenient — a cell reference that will not parse should cost
one cell, not the read.
pivot-writer.tshad a private one under thesame name that throws, which is right for what it does (a
targetCellthe 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.decodeUtf8means "decode, and report a part over V8'sMAX_STRING_LENGTHas the #514ParseErrornaming it" inreader.ts,ods/reader.tsandxlsb/reader.ts, and "decode" instream-reader.tsand
ods/stream.ts. The streaming readers not having the ceiling isintentional and is what
docs/PARITY.mdrecords —streamXlsxRowsisthe 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
decodeUtf8anddecodeUtf8Unchecked, so the difference isvisible at the call site rather than only in PARITY.
Both notes record what is still true of each streaming path: the parts
stream-reader.tsdecodes whole are the small ones, so asharedStrings.xmlover the ceiling would throw V8's raw error; andstreamOdsRowsstreams rows out ofcontent.xmlbut still builds thewhole part as a string to do it.
Names only.
pnpm testgreen — 10,583 tests, 234 files.🤖 Generated with Claude Code