Files
SubMiner/backlog/tasks/task-321 - Preserve-word-audio-during-manual-clipboard-card-updates.md
T
sudacode a9625f8777 Replace grammar-ending permutations with shared matcher; preserve word a
- Extract `grammar-ending.ts` with `isStandaloneGrammarEndingText` / `isSubtitleGrammarEndingText` pattern matchers
- Replace `STANDALONE_GRAMMAR_ENDINGS` set in parser-selection-stage with shared matcher
- Replace generated phrase sets in subtitle-annotation-filter with shared matcher
- Remove stale duplicate subtitle-exclusion constants and helpers from annotation-stage
- Manual clipboard card updates now write only to the sentence audio field, leaving word/expression audio untouched
2026-05-04 00:06:27 -07:00

3.5 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority
id title status assignee created_date updated_date labels dependencies priority
TASK-321 Preserve word audio during manual clipboard card updates Done
@Codex
2026-05-03 06:22 2026-05-03 06:23
anki
mining
medium

Description

Manual Ctrl+Shift+C/Ctrl+V card updates on already-mined cards should refresh the sentence content and generated sentence media without removing or replacing the existing word/expression audio. The word is unchanged in this flow, so the configured word audio field must be left untouched while sentence audio remains forced-overwrite behavior from TASK-299.

Acceptance Criteria

  • #1 Manual clipboard subtitle update replaces the resolved sentence audio field with newly generated sentence audio.
  • #2 Manual clipboard subtitle update does not include the configured word/expression audio field in Anki field updates.
  • #3 Animated image generation still uses the existing word audio duration for lead-in sync when configured.
  • #4 A regression test covers preserving word/expression audio during manual clipboard update.

Implementation Plan

  1. Update the focused manual clipboard card update regression so generated audio is written only to the resolved sentence audio field and the configured word/expression audio field is absent from updateNoteFields payloads.
  2. Run the focused test and confirm it fails for the existing TASK-299 behavior.
  3. Change CardCreationService.updateLastAddedFromClipboard to stop merging/updating expression audio while preserving forced overwrite for sentence audio.
  4. Run the focused test; then run adjacent Anki card-creation tests if the focused gate passes.
  5. Update task acceptance criteria/final notes with verification results.

Implementation Notes

Implemented narrow manual clipboard update change in CardCreationService.updateLastAddedFromClipboard: generated audio now force-overwrites only the resolved sentence audio field and no longer writes the configured word/expression audio field. Animated AVIF lead-in still runs from the original note info before image generation, preserving existing word-audio sync behavior.

Final Summary

Summary:

  • Manual Ctrl+Shift+C/Ctrl+V card updates now leave the configured word/expression audio field untouched while force-replacing the resolved sentence audio field.
  • Updated the regression test to assert the Anki update payload omits ExpressionAudio and only merges SentenceAudio with forced overwrite.
  • Updated docs-site behavior notes and added a changelog fragment for the sentence-only manual audio replacement behavior.

Verification:

  • bun test src/anki-integration/card-creation-manual-update.test.ts src/anki-integration/card-creation.test.ts src/anki-integration/animated-image-sync.test.ts
  • bun run typecheck
  • bun run docs:test
  • bun run docs:build
  • git diff --check -- src/anki-integration/card-creation.ts src/anki-integration/card-creation-manual-update.test.ts docs-site/mining-workflow.md docs-site/anki-integration.md docs-site/configuration.md changes/322-preserve-word-audio-manual-update.md

Blocked gate:

  • bun run changelog:lint is blocked by pre-existing malformed changes/319-interjection-annotation-filter.md, which is outside this task's files.