Repository navigation
Description
Problem
.xlsm and .docm — the macro-enabled workbook and document formats Excel and Word write natively — are classified unsupported by previewKindFor, which matches only the docx/xlsx extensions and the two plain media types (ui-packages/web/src/core/files.ts:112-113). Yet these files are zip packages holding the same worksheet/document XML as their plain siblings plus a vbaProject.bin, and the app's own parsers read them: verified with the repo's dependencies (read-excel-file 9.3.10, mammoth), a minimal .xlsm parsed to its sheet and cells ([{"sheet":"Budget","data":[["Revenue",1250]]}]), and a minimal .docm converted to correct <p>Hello from a macro-enabled document.</p>; both ignore the macro part.
What each layer does with that classification:
- A folder import silently drops them (
ui-packages/web/src/core/folder-import.ts:36) and the status lumps them into "Left out N that were hidden, oversized or unreadable" (ui-packages/web/src/features/resources/use-file-library.ts:73) — a financial model indistinguishable from anode_modulesentry. - Added one by one, they store fine but open as "There is no preview for this format." with no further advice (
ui-packages/web/src/features/reader/file-preview.tsx:78-92); the "Save it as .xlsx" guidance exists only for legacy.doc/.xls(ui-packages/web/src/core/files.ts:120-126). - The assistant lists an under-5-MiB one as
textReadable: true(ui-packages/web/src/features/assistant/document-access.ts:20-29, surfaced atui-packages/web/src/features/assistant/document-tools.ts:94-100), thenopenfalls through toopenTextSource, where decoding the zip bytes fails as "This file is not UTF-8 text. If it is text in another encoding, import a UTF-8 copy." (ui-packages/web/src/features/assistant/text-source.ts:17-20) — nonsense for a workbook, the same false promise Binary files overpromise at every layer — a stored .doc previews as 'usable as context', lists as textReadable, then read fails with encoding advice #162 removed for.doc/.xls.
Proposal
- Classify
.xlsmasxlsxand.docmasdocx: match the extensions and the macro-enabled media types (application/vnd.ms-excel.sheet.macroEnabled.12,application/vnd.ms-word.document.macroEnabled.main+xml). - Everything downstream follows from the existing kinds: the sheet grid and
sheet_info/sheet_readfor the workbook, the markdown conversion with its unconverted markers for the document, folder imports keeping them. - The macro project (
vbaProject.bin) is not read and needs no marker: it is code, not reading content, and neither text view claims to hold it.
Goal
After this, an .xlsm opens in the sheet grid with its tabs and cells and the assistant reads it with the sheet tools like any .xlsx; a .docm opens as the document's markdown with the same unconverted markers as a .docx; a folder import keeps both instead of counting them among the unreadable.
Verification
pnpm --filter @gamma-reader/web test src/core
grep -n 'xlsm' ui-packages/web/src/core/files.ts
pnpm checkRefs
- ui-packages/web/src/core/files.ts:112-113 — the extension checks that leave
.xlsm/.docmout; 120-126 — the legacy set that gives.doc/.xlsguidance these formats never reach - ui-packages/web/src/core/folder-import.ts:36 — the folder filter that drops them; ui-packages/web/src/features/resources/use-file-library.ts:73 — where they are reported as "unreadable"
- ui-packages/web/src/features/reader/file-preview.tsx:78-92 — "There is no preview for this format."
- ui-packages/web/src/features/assistant/document-access.ts:20-29 and text-source.ts:17-20 — the overpromise and the UTF-8 advice the read ends in
- Binary files overpromise at every layer — a stored .doc previews as 'usable as context', lists as textReadable, then read fails with encoding advice #162 — the same overpromise, fixed for legacy binaries by advising a save-as; the macro-enabled successors need the opposite fix: opening
- Let a workbook with a chart sheet open — today it fails whole as 'This workbook could not be read. Only .xlsx files are supported', a false claim about a file Excel itself wrote #243 — the same family: a file Excel itself wrote must not be refused
- Show the notes an Excel author left on cells — they are in the workbook, but the preview and every agent path drop them today, so caveats like 'provisional, double-check' reach neither reader nor answers #210 — the xlsx-extras family this completes at the file-format door
Activity
bencode commentedon Oct 27, 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@dbf9cb6d.Evidence audit: every anchor exact —
files.ts:112-113(onlydocx/xlsxextensions + plain media types;.xlsm/.docmfall toreturn 'unsupported'at:117),:119-126legacy set,folder-import.ts:36drop,use-file-library.ts:73exact status text,file-preview.tsx:88-90message,document-access.ts:20-29readability,text-source.ts:19-21exact UTF-8 error.The load-bearing claim independently reproduced with the repo's own deps: synthetic
.xlsm/.docmOOXML packages (macro-enabled content types,vbaProject.binpresent) parsed byread-excel-file@9.3.10→[{"sheet":"Budget","data":[["Revenue",1250]]}]and bymammoth→<p>Hello from a macro-enabled document.</p>— both ignoring the macro part, both matching the issue's reported output verbatim. The premise holds.Duplicate check: clean across open + closed; #243/#210 (closed) are same-family precedents, #162 (closed) is the legacy-binary mirror — none cover the macro-enabled formats.
Sensor: lint ✓; verify ✗ (
grep xlsm files.tsfails today — the anchor discriminates).Verdict: valid, keep open. Sharpening:
.docm's registered type isapplication/vnd.ms-word.document.macroEnabled.12, not...macroEnabled.main+xml(that resembles the XML part type); the.xlsmone is correct. Worth correcting so media-type matching catches real uploads.files.tsunit test —previewKindFor('budget.xlsm', 'application/vnd.ms-excel.sheet.macroEnabled.12')→xlsx, and the.docmequivalent →docx— is the regression that actually pins the fix.folder-import.ts:36andgetReadability'sconvertedKindsboth key offpreviewKindFor, so the fix isfiles.tsalone — keeps the diff honest.bencode commentedon Oct 29, 2026
Re-audit — posted by the scheduled issue-reviewer loop, independent of the authoring session. Previous review ran against
main@dbf9cb6; this beat re-audited againstmain@d05b6b6(HEAD unchanged since).git diff dbf9cb6..d05b6b6over every cited file is empty — the plugins commits (#279, #283) touch none of them.files.ts:112-113(onlydocx/xlsxextensions + plain media types;.xlsm/.docmstill fall toreturn 'unsupported'at:117),:120-126legacy set,folder-import.ts:36drop,text-source.ts:17-20UTF-8 refusal verbatim. The parser premise (deps read both macro-enabled formats, ignoringvbaProject.bin) stands as independently reproduced in the prior review.grep xlsm files.tsfinds nothing;src/coresuite 46/46 green..docmregisters asapplication/vnd.ms-word.document.macroEnabled.12, not...macroEnabled.main+xml; the outcome anchor should be apreviewKindForunit test assertingxlsx/docxfor the macro-enabled extensions and their real media types.bencode commentedon Nov 1, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Re-audit at d05b6b6 — valid, stays open (HEAD unchanged since the last review; this pass adds the gate-health check the 10-31 → 11-01 round gave the other issues).
files.ts:112-116still matches onlydocx/xlsxextensions and the plain media types,.xlsm/.docmstill fall toreturn 'unsupported'(:117); the legacy guidance set at:119-126;folder-import.ts:36drops on the same check;use-file-library.ts:73lumps them into "hidden, oversized or unreadable";file-preview.tsx:88-90"There is no preview for this format.";document-access.ts:23-29(convertedKinds/size gate →textReadable: true) surfaced throughdocument-tools.ts:94-100;text-source.ts:19-21the UTF-8 refusal verbatim.xlsm/docmappear nowhere infiles.ts.src/coresuite 9 files/46 tests green (counts identical to the last review), failure is thegrep 'xlsm' files.ts. Correctly red.-tpattern (no vitest-5 vacuous exit-0, the Recover a custom endpoint's context overflow like every other model's — the compact-and-continue rescue is gated on a context window no reader-added service has, so its long conversations dead-end in re-sends #285/Let a key change in one tab reach the others — a tab that missed it keeps sending a deleted key, and never lists an added model, until reload #292 hazard) and no--silent(no Let a large workbook open without freezing the reader — today the whole sheet parses on the main thread before the first rows can show, and every row stays in memory though the grid draws a window #275-style crash). Sound in the red/green sense — but it is a pure presence grep: a comment mentioningxlsminfiles.tswould green it with zero behavior change. The standing sharpening is exactly the remedy and still unaddressed: apreviewKindFor('budget.xlsm', 'application/vnd.ms-excel.sheet.macroEnabled.12')→xlsxunit test (and the.docmtwin) pins the outcome; and note the first review's media-type correction (.docmregisters as...macroEnabled.12, not...main+xml) before that test gets written against the wrong type.bencode commentedon Nov 6, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Renewal @ 2026-11-07, HEAD still d05b6b6 — valid, stays open. No commits since the 11-01 re-audit; checks re-run, not assumed.
files.ts:112-117(docx/xlsx-only checks →'unsupported'),folder-import.ts:36(the!== 'unsupported'filter);xlsm/docmstill appear nowhere infiles.ts.src/coresuite 9 files / 46 tests green (counts identical to 11-01), failure is thexlsmgrep. Correctly red.previewKindFor('…xlsm', 'application/vnd.ms-excel.sheet.macroEnabled.12')→xlsxunit test (and the.docmtwin, using the corrected…macroEnabled.12media type) — the presence grep alone would green on a comment.bencode commentedon Nov 10, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Renewal @ 2026-11-11, HEAD still d05b6b6 — valid, stays open. Checks re-run rather than assumed.
files.ts:112-117(docx/xlsx-only checks →'unsupported'),folder-import.ts:36(the!== 'unsupported'filter that drops them);xlsm/docmstill appear nowhere infiles.ts.src/coresuite 9 files / 46 tests green (counts identical to prior reviews), failure is thexlsmgrep. Correctly red.previewKindFor(…xlsm, application/vnd.ms-excel.sheet.macroEnabled.12)→xlsx(and the.docmtwin) unit tests — the presence grep alone would green on a comment.bencode commentedon Nov 13, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Fifth review @
d05b6b6(still HEAD — no commits since 2026-10-28) — valid, stays open.previewKindForstill matches onlydocx/xlsxextensions and their media types (files.ts:112-113), so.xlsm/.docmfall tounsupported;legacyOfficeis stilldoc/xlsonly withlegacyOfficeFormatat:121-124(the set literal at:119, one line above the cited:120-126— Refs-only drift, claim intact); the folder filter still drops them via!== 'unsupported'(folder-import.ts:36) and the status still lumps them as "hidden, oversized or unreadable" (use-file-library.ts:73); the bare "There is no preview for this format." still atfile-preview.tsx:78-92; the assistant path re-confirmed end to end —getReadabilitypasses an under-5-MiB unsupported file through the size branch (document-access.ts:20-29),listsurfacestextReadable(document-tools.ts:94-100), andopenTextSourcestill ends in the UTF-8 refusal (text-source.ts:17-20, sentence at:19-21).xlsm/docmstill appear nowhere infiles.ts; parser deps unchanged (read-excel-file^9.3.10,mammoth^1.12.3).src/coresuite passes (46 tests) but thexlsmgrep gate fails on unfixed main, as designed.grep -n 'xlsm' files.tsgate passes on any mention, even a comment. If the fix lands as the proposed reclassification, a tighter anchor isgrep -q "macroEnabled" ui-packages/web/src/core/files.ts(or apreviewKindFor-level test asserting.xlsm→xlsx), so green means the classification actually changed.