Skip to content

Fix #1007: don't export empty audio folders; trim + gate the warning modal#1074

Open
sampjvv wants to merge 4 commits into
mainfrom
1007-no-empty-export-folders
Open

Fix #1007: don't export empty audio folders; trim + gate the warning modal#1074
sampjvv wants to merge 4 commits into
mainfrom
1007-no-empty-export-folders

Conversation

@sampjvv

@sampjvv sampjvv commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Closes #1007.

Problem

On an audio export that includes a file/chapter with no audio: the wizard wrote an empty per-book folder containing only a NOTICE.txt, and the step-2 "Files Without Audio" warning could be dismissed (X / click-outside) without acknowledging it.

Testing also surfaced an inconsistency: a book is one .codex file and chapters are milestones within it. The warning/NOTICE logic was per-file, but the exporter silently drops per-chapter — so an empty chapter inside an audio-bearing book vanished with no feedback at all.

Changes

1. Trim the warning modal (projectExportView.ts) — drop the now-inaccurate "…their exported audio folders will be empty" / "…will produce empty output…" wording from the shared warning popup; keep the header + "The following files have no audio/text translations." + file list.

2. Stop writing the empty folder + NOTICE.txt (exportHandler.ts) — delete generateMissingContentNotices() (the only code creating the per-book folder + NOTICE.txt), its call site, and the now-unused analyzeNotebookContent import. reporter.complete() is unchanged.

3. Report skips in the completion summary instead — file and chapter level (audioExporter.ts) — per book, track which selected milestones produced audio. A whole no-audio book → "Skipped (no audio): N book(s) — …"; selected-but-empty chapters → "Chapters skipped (no audio): GEN 1; …" (book-prefixed, capped at 6). These flow through the existing extraMessages → completion summary, so there's no new plumbing. Only chapters that were selected but produced no audio task count (download failures stay in their existing category; the whole-book opt-out is excluded).

4. Require explicit OK to dismiss the warning (projectExportView.ts) — the warning is a full-screen blocking modal; removing the X button and the click-outside dismissal leaves OK as the only way out, so the export can't proceed until it's acknowledged. Applies to both the audio and text warnings (shared popup). No keyboard/Escape bypass exists for this popup.

Verification

  • tsc --noEmit + eslint + npm run compile clean.
  • New tests (src/test/suite/export/audioSkipSummary.test.ts): book-level (no NOTICE.txt written + skip line in the summary) and chapter-level (an empty selected chapter is reported as skipped, not silently dropped). Existing exportCancellation test still passes — 3 export tests green.
  • Manual: (a) mixed text-only + text+audio export → trimmed modal, no NOTICE.txt, skipped books/chapters listed in the summary; (b) the warning modal has no X and ignores click-outside — only OK dismisses it.

Note: the warning-modal changes are in the extension's wizard HTML string (built by npm run compile), which has no DOM test harness in the suite — verified manually.

🤖 Generated with Claude Code

…modal

When an audio export included a file/chapter with no audio, the wizard wrote an
empty per-book folder containing only a NOTICE.txt, and the step-2 warning modal
could be dismissed (X / click-outside) without acknowledging it.

- projectExportView: trim the "Files Without Audio" / "Files Without Text"
  warning text (drop the now-inaccurate "empty folder/output" wording + shared
  note), and require an explicit OK to dismiss the warning (remove the X and the
  click-outside dismissal) so the export can't proceed unacknowledged.
- exportHandler: delete generateMissingContentNotices() — the only code that
  wrote the empty per-book folder + NOTICE.txt — plus its call and the now-unused
  analyzeNotebookContent import.
- audioExporter: report what was omitted for lack of audio in the completion
  summary instead — at book (whole file) AND chapter (milestone) level — fixing
  the inconsistency where an empty chapter inside an audio-bearing book was
  dropped silently with no feedback.

Tests: book-level (no NOTICE.txt + skip line) and chapter-level skip-summary
cases; existing export cancellation test still passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sampjvv

sampjvv commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up edge cases — "Files Without Audio" warning (out of scope for this PR)

Flagging for @LeviXIII to look into. The no-audio warning only fires the moment you click the Include Audio option, so it can be bypassed when the selection changes afterward. Two cases it misses:

  1. Deselecting the audio chapters → no warning. Export a book that has audio (no warning, correct). Then on the chapter-selection step, deselect the only chapter(s) that actually contain audio. The remaining selection has no audio, but you get no warning — you just export "0 audio files." → Should warn, on the chapter step, when the current selection contains no audio at all.

  2. Re-selecting files after the format is set → no warning. Pick a book with audio, choose Include Audio (warning logic runs, nothing to flag), advance. Go back and add a no-audio book to the selection. Because the audio format is already remembered, you can advance straight through with no warning about the no-audio book. → Should re-check (and warn) whenever the file selection changes, not just on the audio-option click.

Common thread: the warning is a one-shot trigger; it should re-evaluate whenever the file or chapter selection changes (i.e. gate on "current selection has no audio," re-checked at each step).

LeviXIII and others added 2 commits July 2, 2026 12:10
…ing back

The step-2 "Files Without Audio" warning only ran inside the audio option's
click handler. Because the audio option is deliberately remembered across
back-navigation (unlike text formats, which are cleared and re-clicked), a
user could select an audio book, choose Include Audio, go back, add a
no-audio book, and advance with no warning at all.

Track the file-selection signature at the time the check last ran, and on
arrival at step 2 from the file step re-run the check when the audio option
is still selected and the selection changed. Unchanged selections are not
re-warned (the modal was already acknowledged with OK).

Follow-up to the #1007 fixes; scenario 2 from the PR #1074 edge-case comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sampjvv

sampjvv commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Update: scenario 2 (re-selecting files after the audio format is already set) is now fixed in this PR (53c7aba) — arriving at step 2 from the file step re-runs the no-audio check when the audio option is still selected and the file selection changed. An unchanged, already-acknowledged selection is not re-warned. Scenario 1 (chapter-level deselection) remains open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

We shouldn't export empty folders when exporting

2 participants