Repository navigation
Description
Problem
A Word document's headers and footers often hold the text that says what it is: the date of a letter, a reference or case number, "CONFIDENTIAL" or "Draft", the chapter of a book. Gamma Reader drops the whole part without a trace — for the reader and for the assistant alike, since both read the same conversion (ui-packages/web/src/formats/docx.ts:89-106).
Reproduction (with the package's own mammoth): build a minimal .docx whose word/header1.xml holds "CONFIDENTIAL - Draft dated 24 October 2026", word/footer1.xml holds "Acme Ltd, Case 4471", and one body paragraph. mammoth.convertToHtml returns exactly <p>The body says this.</p> with messages: [] — no output, no warning.
The codebase already built the machinery for exactly this class of loss, and states its own contract: "Each rule names content Mammoth drops without trace" (ui-packages/web/src/formats/docx-unconverted.ts:48) — equations, charts, diagrams and bare objects all get an italic "(label not converted)" marker in place (:28-45). But markUnconvertedContent only ever opens word/document.xml (:11-12, 91-94); header and footer parts are the unnamed remainder. So a reader asking "when was this written, what is its reference" gets no answer and no hint there was one — and a document marked confidential opens without its marking.
Proposal
- Extend the unconverted pass to the header and footer parts each section references:
sectPr'sheaderReference/footerReferencer:ids, resolved throughword/_rels/document.xml.rels(JSZip is already a dependency of this pass). - Where each section begins, insert the existing marker voice carrying the part's text — e.g. (Header, not placed: CONFIDENTIAL — Draft dated 24 October 2026) — so the content is neither lost nor silently promoted into the body flow.
- Skip parts that hold no text (spacing-only headers); documents without headers and footers render exactly as today.
Goal
After this, every header and footer that carries text appears in the converted document, marked as a header or footer at its section, for both the reader and the assistant; nothing a Word author put in those parts is lost silently, and documents without them are unchanged.
Verification
grep -rwiE 'headerReference|footerReference' ui-packages/web/src/formats --include='*.ts' --exclude='*test*'
pnpm --filter @gamma-reader/web test --silent
pnpm --filter @gamma-reader/web exec vitest run --project unit src/formats/docx.test.ts
pnpm check(the fixture and test to add with the change: a .docx with a text-bearing header and footer converts to markdown that contains both, in the marker voice — today the conversion returns only the body and messages: [], as the reproduction above shows, so no such test can pass)
Refs
- Reproduction: a minimal package with
word/header1.xml("CONFIDENTIAL - Draft dated 24 October 2026"),word/footer1.xml("Acme Ltd, Case 4471") and one body paragraph;mammoth.convertToHtml→<p>The body says this.</p>,messages: [] - ui-packages/web/src/formats/docx-unconverted.ts:11-12,91-94 — only
word/document.xmlis ever read - ui-packages/web/src/formats/docx-unconverted.ts:28-48 — the marker voice and its stated contract, "Each rule names content Mammoth drops without trace"
- ui-packages/web/src/formats/docx.ts:89-106 — the one conversion feeding both the reader and the assistant
- Tell readers which Word content did not convert, instead of logging it to the browser console #45 (closed) — the marker system this completes; it named what could be named inside document.xml
- Give Word footnotes the treatment comments got — a note's reference is a link to nowhere today, and its text an unlabeled list at the end #191 — footnotes, the sibling piece of document apparatus waiting on the same treatment
- ui-packages/web/PRODUCT.md — "explain... the few actions that affect persistence" and capability boundaries; a silent loss is a boundary nobody can see
Activity
bencode commentedon Oct 23, 2026
Independent review — posted by the scheduled issue-reviewer loop (a session separate from the one that files these issues), under the maintainer's standing instruction to evaluate, sharpen, or retire
source:scheduledproposals. Audited againstmain@90b046f(no commits since filing).Evidence audit: every citation confirmed, and the reproduction re-run and confirmed verbatim.
docx-unconverted.ts:12(documentPath = 'word/document.xml') and:86-100—markUnconvertedContentonly ever reads that one part;:48carries the stated contract "Each rule names content Mammoth drops without trace" verbatim;:28-47is the italic "(label not converted)" voice.docx.ts:90-106— the singlemammoth.convertToHtmlpass feeding reader and assistant alike.word/header1.xml"CONFIDENTIAL…",word/footer1.xml"Acme Ltd, Case 4471", one body paragraph): mammoth 1.12.3 returns exactly<p>The body says this.</p>withmessages: []. Claim confirmed word for word.Sensor + Verification block repaired (logged here per policy): lint ✓, but
verifyfalsely passed on unmodified main — the block's commands are the generic suite, and the asserted behavior lives in a test that doesn't exist yet (the block's own parenthetical admits "no such test can pass"). Same disease as #175's block before its repair; unrepaired, a later beat would close this as implemented while nothing had changed. Edited only the Verification block, prepending a gate that fails on main today (confirmed red) and that any implementation of this proposal must turn green — resolvingsectPr's references is impossible without these tokens:+grep -rwiE 'headerReference|footerReference' ui-packages/web/src/formats --include='*.ts' --exclude='*test*' pnpm --filter @gamma-reader/web test --silentRe-linted ✓; verify now ✗ on main ✓ (not implemented).
Verdict: valid, keep open. Two sharpenings for implementation:
sectPr; resolving per section and inserting per section would repeat "CONFIDENTIAL" after each chapter. Collect unique header/footer parts by relationship id and mark each once, at the section where it first applies — and pin that in the test (a two-section fixture sharing one header must show the marker exactly once).bencode commentedon Oct 26, 2026
Closing as not planned. Gamma Reader reads a Word document's body; headers and footers stay out of scope.
If a header or footer matters, such as a date, a reference number or a confidentiality mark, open the original in Word, or copy that text into a note next to the document so you and the assistant can both see it.