Streaming reader: preserve a formula cell's cached ERROR token (t="e") - #1
Merged
Merged
Conversation
uuid@8 is npm-deprecated and uuid@14 (current latest) drops the main field plus ships ES2021 (??=) syntax that browserify@16 cannot parse. uuid@9.0.1 is the highest version with a main field and CJS output that browserify@16 accepts. Stage: git add package.json package-lock.json
* Fix: pin uuid to ^9.0.1 to keep browserify build working uuid@8 is npm-deprecated and uuid@14 (current latest) drops the main field plus ships ES2021 (??=) syntax that browserify@16 cannot parse. uuid@9.0.1 is the highest version with a main field and CJS output that browserify@16 accepts. Stage: git add package.json package-lock.json * Add AGENTS.md with hard rules for AI-generated PRs Captures recurring problems from AI-authored PRs: drive-by formatter sweeps, synthetic-model tests instead of real round-trip, missing file lists, .prettierrc edits across overlapping PRs, and unverified XLSX serialization changes. README and CONTRIBUTING point to AGENTS.md. PR template adds a Files-changed section and a checklist mirroring the rules. Stage: git add AGENTS.md README.md CONTRIBUTING.md .github/PULL_REQUEST_TEMPLATE.md
…ing dedup (protobi#66) * fix: use XML hash for streaming shared strings * Add regression tests for richText shared-string deduplication Covers the bug fixed in the cherry-picked commit: richText objects previously collapsed to hash key '[object Object]', deduping every richText cell into a single shared-string entry. Tests verify both correct deduplication and distinction by formatting. --------- Co-authored-by: Gavin Kline <gwkline23@gmail.com>
Fixes critical bug in WorkbookWriter streaming with useSharedStrings: every richText cell collapsed into a single shared-string entry (richText objects coerced to '[object Object]' as hash key, deduping all of them). Cherry-picked from protobi#50 by @gwkline; adds regression tests covering richText deduplication and formatting-aware distinction. Addresses upstream exceljs#2267. Also pins uuid to ^9.0.1 to keep browserify build working (uuid@14 dropped the main field; uuid@11 ships ES2021 syntax that browserify@16 cannot parse). Adds AGENTS.md with hard rules for AI-generated PRs. Files changed: - lib/utils/shared-strings.js: hash richText by rendered XML - spec/unit/utils/shared-strings.spec.js: 2 new regression tests - AGENTS.md: new (hard rules for AI agents) - README.md, CONTRIBUTING.md: pointers to AGENTS.md, release notes - .github/PULL_REQUEST_TEMPLATE.md: per-PR checklist - FORK.md: release notes - package.json, package-lock.json: version bump, uuid 8 -> 9 Tests: 886 unit tests passing (4 in SharedStrings, up from 2). PRs: protobi#64 (uuid), protobi#65 (AGENTS.md), protobi#66 (richText fix)
The streaming WorkbookReader dropped the cached error result on a FORMULA
cell. A cell like `<c t="e"><f>1/0</f><v>#DIV/0!</v></c>` carries both a
formula and a cached error result, but the formula branch only special-cased
t="str"; every other type (including t="e") fell through to
`parseFloat(c.v.text)`, so `parseFloat('#DIV/0!')` -> NaN and the token was
lost. The bare-error `case 'e'` further down only covers non-formula error
cells.
Fix: add a `c.t === 'e'` case in the formula branch that mirrors the
non-streaming `Workbook.load()` shape — `cellValue.result = {error: c.v.text}`
— matching the bare-error case below it. Ordering is str -> e -> numeric
fallback.
Test (spec/integration/issues): writes a formula cell with a cached error
result via the public `writeBuffer`, reads it back BOTH ways, and asserts the
streaming WorkbookReader now matches the non-streaming oracle
(`result:{error:'#DIV/0!'}`). Reverting the fix reds the streaming arm
(result becomes NaN); the oracle arm stays green. Reader-only change — no
serialization path touched.
Committed with --no-verify per AGENTS.md (avoid prettier/eslint reshaping
unrelated code); only the two intended files are staged.
Owner
Author
|
Merging directly via the documented |
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.
What
The streaming
WorkbookReaderdropped the cached error result on a formula cell.A cell like
<c t="e"><f>1/0</f><v>#DIV/0!</v></c>carries both a formula and a cached error result. The reader's formula branch only special-casedt="str"; every other type — includingt="e"— fell through toparseFloat(c.v.text), soparseFloat('#DIV/0!')→NaNand the token was lost. The bare-errorcase 'e'lower down only covers non-formula error cells.Fix
Add a
c.t === 'e'case in the formula branch that mirrors the non-streamingWorkbook.load()shape:Ordering is
str→e→ numeric fallback, matching the bare-errorcase 'e'below it. Reader-only change — no serialization path is touched.Test (real fixture round-trip, per AGENTS.md)
spec/integration/issues/issue-xls214-streaming-formula-error-token.spec.js:wb.xlsx.writeBuffer()(no synthetic models / internal serializers).Workbook.load()(the oracle) and the streamingWorkbookReader(the subject).{formula:'1/0', result:{error:'#DIV/0!'}}.Revert the fix and the streaming arm goes RED (
resultbecomesNaN); the oracle arm stays green.Scope
One logical change (bug fix + its regression test). No version bump, no
dist/rebuild, no config changes — versioning/publish is a separate maintainer release step per the fork's convention. Committed with--no-verifyper AGENTS.md to avoid prettier/eslint reshaping unrelated code.