Skip to content

Give the OOXML part names and content-types namespace one home each - #23

Merged
duharry0915 merged 1 commit into
mainfrom
dedupe-constants
Sep 20, 2026
Merged

duharry0915 merged 1 commit into
mainfrom
dedupe-constants

Conversation

@Haakam21

@Haakam21 Haakam21 commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Pure de-duplication, found while inventorying the remaining constants. No value changes: XLSX_LEADING_ENTRIES, both magic Buffers and every part name resolve to byte-identical strings at runtime, verified by evaluating this branch and main side by side rather than assumed — the manifest's exact spelling and order is what keeps exceljs off the temp-file spool branch, so it is the one thing worth checking directly.

'word/document.xml' and 'xl/workbook.xml' each appeared three times (a Buffer for the raw-byte scan, inline in ooxmlKind's exact-match path, and again later as DOCX_MAIN_PART / WORKBOOK_PART); the string is now canonical and the Buffer derives from it, so the two routing paths cannot come to disagree about which part names a package. WORKBOOK_RELS_PART and CONTENT_TYPES_PART moved up beside them and XLSX_LEADING_ENTRIES now references all three instead of respelling them. CONTENT_TYPES_NS was declared locally inside each of the two scans of [Content_Types].xml, which have to agree on the namespace they filter by, so it is hoisted next to PACKAGE_RELS_NS — the one it is easily confused with, since the two parts have distinct OPC namespaces.

Every one of these literals now occurs exactly once in the file. 530 tests, typecheck and build pass.

🤖 Generated with Claude Code


Open workspace in Conductor

Pure de-duplication found while inventorying the remaining constants. No value
changes: XLSX_LEADING_ENTRIES, both magic Buffers and every part name resolve to
byte-identical strings at runtime, compared against main by evaluating both
modules. That equality is the point of the commit rather than a side effect —
the manifest's exact spelling and order is what keeps exceljs off the temp-file
spool branch, so it is verified rather than assumed.

- 'word/document.xml' and 'xl/workbook.xml' each appeared three times: as a
  Buffer for the raw-byte scan, inline in ooxmlKind's exact-match path, and
  again later as DOCX_MAIN_PART / WORKBOOK_PART. The string is now canonical and
  the Buffer derives from it, so the two routing paths cannot come to disagree
  about which part names a package.
- WORKBOOK_RELS_PART and CONTENT_TYPES_PART moved up beside them, and
  XLSX_LEADING_ENTRIES now references all three instead of respelling them. The
  rebuild orders exactly the parts the resolver reads; spelling one differently
  in the manifest would reintroduce the branch the rebuild exists to avoid.
- CONTENT_TYPES_NS was declared locally inside each of the two scans of
  [Content_Types].xml. They must agree on the namespace they filter by, so it is
  hoisted to module scope next to PACKAGE_RELS_NS, which it is easily confused
  with — the parts have distinct OPC namespaces and the comment now says so.

Each literal now occurs exactly once in the file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@duharry0915
duharry0915 merged commit 02ff25a into main Sep 20, 2026
1 check 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.

2 participants