From 1750dd8a2454cba8deed748edd109ff8be2b178c Mon Sep 17 00:00:00 2001 From: amosblomqvist Date: Wed, 28 Oct 2026 19:52:07 +0200 Subject: [PATCH] fix: keep successful file path attachments silent --- components/file-path-drop-zone.tsx | 2 +- scripts/smoke-file-paths.mjs | 3 ++- tests/file-path-drop-zone.test.tsx | 12 +++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/file-path-drop-zone.tsx b/components/file-path-drop-zone.tsx index cc2f292..9408699 100644 --- a/components/file-path-drop-zone.tsx +++ b/components/file-path-drop-zone.tsx @@ -85,7 +85,7 @@ export function FilePathDropZone({ children, className }: { children: React.Reac setNotice("Open a chat to attach file paths."); return; } - setNotice(skipped ? "File paths attached. Some dropped items had no available file path." : "File paths attached."); + setNotice(skipped ? "Some dropped items had no available file path." : ""); }} > {children} diff --git a/scripts/smoke-file-paths.mjs b/scripts/smoke-file-paths.mjs index 59037ce..13d6891 100644 --- a/scripts/smoke-file-paths.mjs +++ b/scripts/smoke-file-paths.mjs @@ -356,7 +356,7 @@ try { await blur(page); await syntheticDrop(page, ["/synthetic/collapsed-practice.pdf"]); // Practice keeps the owning hook/state mounted, but hides its field // by returning the bar. Inspect the controlled text after expansion. - await page.waitForFunction(() => document.querySelector('[role="status"]')?.textContent.includes("File paths attached")); + assert.equal(await page.$('[role="status"]'), null, "successful attachment has no confirmation bubble"); await page.locator('[data-testid="practice-dock-bar"]').click(); await page.waitForSelector(practice, { visible: true }); await expectValue(page, "`/synthetic/practice.pdf` `/synthetic/collapsed-practice.pdf`", practice); @@ -405,6 +405,7 @@ try { await expectValue(desktopPage, `read ${expectedQuoted} this`); assert.equal(await desktopPage.$eval('[data-file-path-input] [role="img"]', chip => chip.title), fixturePath); assert.equal(posts.length, beforeDesktopDrop, "actual OS-backed desktop drop must stage only"); + assert.equal(await desktopPage.$('[role="status"]'), null, "successful desktop attachment has no confirmation bubble"); assert.ok(fs.existsSync(fixturePath)); assert.deepEqual(fs.readdirSync(path.join(home, "data")).filter(name => /upload|attachment/i.test(name)), []); checks.push("Actual Electron production preload: Puppeteer-selected OS-backed File resolves exact Unicode/backtick full path; virtual File returns empty; real DataTransfer drop inserts at caret without submit or file reads"); diff --git a/tests/file-path-drop-zone.test.tsx b/tests/file-path-drop-zone.test.tsx index 8d62a24..17edaa7 100644 --- a/tests/file-path-drop-zone.test.tsx +++ b/tests/file-path-drop-zone.test.tsx @@ -124,7 +124,17 @@ test("desktop drop inserts quoted paths at the focused editor caret instead of t assert.equal(f.doc.activeElement, f.editor); assert.deepEqual(f.appends, [], "focused editor wins over the registered question field"); assert.deepEqual(f.resolved, files, "only Electron's full path, never File.name, enters the draft"); - assert.match(f.status, /File paths attached/); + assert.equal(f.status, "", "successful file attachment is silent"); + f.assertPathOnly(); +}); + +test("a successful drop clears an earlier failure without replacing it with a confirmation bubble", async () => { + const f = await fixture(); + await f.event("drop", f.transfer([f.file("virtual.pdf")])); + assert.match(f.status, /No local file paths were available/); + await f.event("drop", f.transfer([f.file("valid.pdf", "/existing/valid.pdf")])); + assert.deepEqual(f.appends, ["`/existing/valid.pdf`"]); + assert.equal(f.doc.querySelector('[role="status"]'), null); f.assertPathOnly(); });