Give the OOXML part names and content-types namespace one home each - #23
Merged
Merged
Conversation
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
approved these changes
Sep 20, 2026
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.
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 andmainside 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 inooxmlKind's exact-match path, and again later asDOCX_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_PARTandCONTENT_TYPES_PARTmoved up beside them andXLSX_LEADING_ENTRIESnow references all three instead of respelling them.CONTENT_TYPES_NSwas 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 toPACKAGE_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