From 965bd8f55525e117e8ce73a5cf813b8cb8918d23 Mon Sep 17 00:00:00 2001 From: Marve10s Date: Sat, 21 Nov 2026 23:41:10 +0300 Subject: [PATCH 1/2] fix(server): PowerPoint speaker notes leave out the notes page's slide number, date, header and footer --- .../server/src/provider/documentTextWorker.ts | 18 ++++++- .../src/provider/userInputAttachments.test.ts | 50 ++++++++++++++++++- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/apps/server/src/provider/documentTextWorker.ts b/apps/server/src/provider/documentTextWorker.ts index 1e9e8e86b57cd..e254e101cf93e 100644 --- a/apps/server/src/provider/documentTextWorker.ts +++ b/apps/server/src/provider/documentTextWorker.ts @@ -221,6 +221,18 @@ function* paragraphs(node: XmlNode): Generator { } } } +// A notes page also holds the slide image, slide number, date, header and footer placeholders. +const NOTES_PAGE_PLACEHOLDERS = new Set(["sldImg", "sldNum", "dt", "hdr", "ftr"]); +const isNotesPagePlaceholder = (node: XmlNode) => + node.name === "sp" && NOTES_PAGE_PLACEHOLDERS.has(all(node, "ph").next().value?.attrs.type ?? ""); +function withoutNotesPagePlaceholders(node: XmlNode): XmlNode { + return { + ...node, + children: node.children + .filter((child) => typeof child === "string" || !isNotesPagePlaceholder(child)) + .map((child) => (typeof child === "string" ? child : withoutNotesPagePlaceholders(child))), + }; +} function* inCell(parts: Iterable): Generator { yield CELL_START; yield* parts; @@ -733,14 +745,16 @@ async function* document(path: string, extension: string): AsyncGenerator { occurrences: { text: "Repeated value", count: rows ? 10_000 : 512 }, })), ), + { + ext: "pptx", + bounded: true, + parts: { + "ppt/presentation.xml": + '', + "ppt/_rels/presentation.xml.rels": + '', + "ppt/slides/a.xml": "

Slide text

", + "ppt/slides/_rels/a.xml.rels": + '', + "ppt/notesSlides/table.xml": + '

Before the table

Repeated value

', + }, + expected: [ + "Notes:\nBefore the table", + "Repeated value", + "[Extracted text truncated at document extraction limits.]", + ], + occurrences: { text: "Repeated value", count: 10_000 }, + }, ...["ods", "odt", "odp", "docx"].map((ext) => ({ ext, bounded: true, @@ -989,7 +1010,7 @@ describe("question answer paths", () => { "ppt/slides/_rels/slide1.xml.rels": '', "ppt/notesSlides/notes7.xml": - "evacuation code ORCHID-81", + 'evacuation code ORCHID-81Harbor briefing11/21/2026Crew only57', "ppt/notesSlides/notes3.xml": "Board at gate 4", "ppt/notesSlides/ignored.xml": "Unrelated notes", @@ -1001,7 +1022,32 @@ describe("question answer paths", () => { "Departure\nNotes:\nBoard at gate 4", ], occurrences: { text: "## Slide ", count: 2 }, - absent: ["Unrelated notes", "[Skipped document part", "[Extracted text truncated"], + absent: [ + "Unrelated notes", + "Harbor briefing", + "11/21/2026", + "Crew only", + "57", + "[Skipped document part", + "[Extracted text truncated", + ], + }, + { + ext: "pptx", + bounded: true, + parts: { + "ppt/presentation.xml": + '', + "ppt/_rels/presentation.xml.rels": + '', + "ppt/slides/a.xml": "

Slide text

", + "ppt/slides/_rels/a.xml.rels": + '', + "ppt/notesSlides/empty.xml": + '57', + }, + expected: ["Slide text"], + absent: ["Notes:", "57"], }, ...[false, true].map((missing) => ({ ext: "pptx", From c0e2821ccdc3518fa469eb389a6be3b338142a4e Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 21 Nov 2026 21:51:18 +0000 Subject: [PATCH 2/2] test(server): drop the PowerPoint notes table case that main already covers Co-Authored-By: Claude Opus 5.5 --- .../src/provider/userInputAttachments.test.ts | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/apps/server/src/provider/userInputAttachments.test.ts b/apps/server/src/provider/userInputAttachments.test.ts index 9b9329c1492bc..b107188136a3d 100644 --- a/apps/server/src/provider/userInputAttachments.test.ts +++ b/apps/server/src/provider/userInputAttachments.test.ts @@ -609,27 +609,6 @@ describe("question answer paths", () => { occurrences: { text: "Repeated value", count: rows ? 10_000 : 512 }, })), ), - { - ext: "pptx", - bounded: true, - parts: { - "ppt/presentation.xml": - '', - "ppt/_rels/presentation.xml.rels": - '', - "ppt/slides/a.xml": "

Slide text

", - "ppt/slides/_rels/a.xml.rels": - '', - "ppt/notesSlides/table.xml": - '

Before the table

Repeated value

', - }, - expected: [ - "Notes:\nBefore the table", - "Repeated value", - "[Extracted text truncated at document extraction limits.]", - ], - occurrences: { text: "Repeated value", count: 10_000 }, - }, ...["ods", "odt", "odp", "docx"].map((ext) => ({ ext, bounded: true,