Skip to content

feat(excel-number-format): extract the shared Excel number-format classifier - #874

Merged
Mearman merged 3 commits into
mainfrom
feat/848-shared-excel-number-format
Sep 3, 2026
Merged

feat(excel-number-format): extract the shared Excel number-format classifier#874
Mearman merged 3 commits into
mainfrom
feat/848-shared-excel-number-format

Conversation

@Mearman

@Mearman Mearman commented Sep 3, 2026

Copy link
Copy Markdown
Member

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. isIsoCurrencyCodeShape is 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

  • Every test from both original suites carries over to the new package verbatim
  • pnpm lint / pnpm typecheck / pnpm typecheck:attw / pnpm test / pnpm test:workers / pnpm test:smoke across the whole workspace

@Mearman
Mearman marked this pull request as ready for review September 3, 2026 11:38
@Mearman
Mearman enabled auto-merge (rebase) September 3, 2026 11:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-03T11:42:33.506804Z 925c669 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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
Mearman force-pushed the feat/848-shared-excel-number-format branch from 925c669 to 326f8e2 Compare September 3, 2026 11:59
@Mearman
Mearman merged commit e325387 into main Sep 3, 2026
17 checks passed
@Mearman
Mearman deleted the feat/848-shared-excel-number-format branch September 3, 2026 12:03
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.

Number-format classifier is implemented twice, in ooxml.js and xls-codec

1 participant