From 38da4079425cb82f080632e9a440714d305b400a Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 25 Apr 2026 09:37:13 +0000 Subject: [PATCH] fix(export): split bulk-export toast across success / partial / all-failed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Phase 9 bulk export utility had a single success toast that was emitted even when zero of N writes succeeded — "Exported 0 of 5 transcripts to folder/" reading like the user just deliberately exported nothing. Branch on the result count: - 0 of N: error toast pointing at the console for write failures. - N of N: success toast. - M of N: warn toast — partial export, with the same console pointer. Single-file save (`saveTranscriptAsMarkdown`) was already correct: explicit success on save, error on failure, silent on user-cancelled — left untouched. https://claude.ai/code/session_0189xUb6ie6t9qHkzatGZ9Rb --- src/lib/utils/saveMarkdown.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/lib/utils/saveMarkdown.ts b/src/lib/utils/saveMarkdown.ts index 4117837..bd88540 100644 --- a/src/lib/utils/saveMarkdown.ts +++ b/src/lib/utils/saveMarkdown.ts @@ -90,11 +90,24 @@ export async function exportTranscriptsToDir( console.error("exportTranscriptsToDir write failed", path, err); } } - toasts.success( - written === items.length - ? `Exported ${written} transcript${written === 1 ? "" : "s"} to ${basename(dir)}` - : `Exported ${written} of ${items.length} transcripts to ${basename(dir)}`, - ); + if (written === 0) { + // All writes failed — surface as an error instead of "Exported 0 + // transcripts" success toast which reads like the user just bulk- + // exported nothing on purpose. + toasts.error( + "Couldn't export transcripts", + `0 of ${items.length} written to ${basename(dir)}. Check the console for details.`, + ); + } else if (written === items.length) { + toasts.success( + `Exported ${written} transcript${written === 1 ? "" : "s"} to ${basename(dir)}`, + ); + } else { + toasts.warn( + `Partial export to ${basename(dir)}`, + `${written} of ${items.length} transcripts written. Check the console for the failures.`, + ); + } return written; }