feat(excel-number-format): extract the shared Excel number-format classifier - #874
Merged
Conversation
Mearman
marked this pull request as ready for review
September 3, 2026 11:38
Mearman
enabled auto-merge (rebase)
September 3, 2026 11:38
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ier package ooxml.js and xls-codec each carried their own tokenizing classifier for Excel's number-format mini-language (ECMA-376 Part 1 SS18.8.30, which [MS-XLS] 2.4.126 defers to for BIFF8's own format codes) -- deciding whether a numeric cell's format code says percentage, currency, date, time, elapsed duration, or plain number. The two implementations were character-for-character identical in every classification rule (the tokenizer, the section splitter, the locale-tag-vs-currency-bracket distinction, the minutes-vs-months resolution, the built-in format table), verified by diffing both files directly -- only naming, visibility, and doc-comment wording differed, and ooxml.js additionally carried its own xlsx-specific write-side vocabulary that has no BIFF8 counterpart. Rather than making one codec depend on the other -- which would couple two sibling format codecs and drag ooxml.js's XML/ZIP dependency into xls-codec, which needs none of it -- the classifier moves into its own foundation package, matching the family's existing pattern of narrow, single-purpose foundation packages (byte-codec, archive-codec, document-outline.js, document-compute.js). isIsoCurrencyCodeShape is now exported (previously a private helper in each copy) so a consuming codec's own writer can reuse the identical ISO-4217-shape predicate the classifier already uses, rather than a second copy. Every test from both original suites carries over verbatim, plus a compact it.each table and three edge-case tests (quoted-literal day code, escaped percent sign, colour bracket) that only xls-codec's original suite had.
…classifier ooxml.js's typed/xlsx/number-format.ts and xls-codec's own number-format.ts carried character-for-character identical classifiers for Excel's number-format mini-language, verified by diffing both files directly. Both packages now import the classifier from excel-number-format instead: xls-codec drops its own copy entirely (content.ts, index.ts, workbook/globals.ts import from the shared package), and ooxml.js keeps only its own xlsx-specific write-side vocabulary, which has no BIFF8 counterpart and was never duplicated.
…ace link ooxml.js and xls-codec's own excel-number-format dependency needed a real lockfile entry to resolve to the workspace link rather than the registry; the README's excel-number-format row also gains the column padding its neighbours already carry, dropped when the row was added during a manual rebase-conflict resolution.
Mearman
force-pushed
the
feat/848-shared-excel-number-format
branch
from
September 3, 2026 11:59
925c669 to
326f8e2
Compare
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.
Fixes #848.
ooxml.js's typed/xlsx/number-format.ts and xls-codec's own number-format.ts carried character-for-character identical classifiers for Excel's number-format mini-language (ECMA-376 Part 1 §18.8.30, which BIFF8's [MS-XLS] 2.4.126 defers to) -- deciding whether a numeric cell's format code says percentage, currency, date, time, elapsed duration, or plain number. Verified by diffing both files directly: only naming, visibility, and doc-comment wording differed, and ooxml.js additionally carried its own xlsx-specific write-side vocabulary with no BIFF8 counterpart.
The classifier moves into its own foundation package,
excel-number-format, matching the family's existing pattern of narrow, single-purpose foundation packages (byte-codec, archive-codec, document-outline.js, document-compute.js) rather than making one format codec depend on the other.isIsoCurrencyCodeShapeis now exported (previously a private helper in each copy) so a consuming codec's own writer can reuse it.xls-codec drops its own copy of the classifier entirely; ooxml.js keeps only its own write-side vocabulary, which has no BIFF8 counterpart and was never duplicated.
Test plan
pnpm lint/pnpm typecheck/pnpm typecheck:attw/pnpm test/pnpm test:workers/pnpm test:smokeacross the whole workspace