From 473f39bd905320436c3d27e545ccb1433774744c Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Tue, 1 Dec 2026 17:37:32 +0000 Subject: [PATCH] Record audio discovery and naming decisions --- docs/roadmap/audio-inputs.md | 118 ++++++++++++++--------------------- 1 file changed, 48 insertions(+), 70 deletions(-) diff --git a/docs/roadmap/audio-inputs.md b/docs/roadmap/audio-inputs.md index 62e9544..2ef0694 100644 --- a/docs/roadmap/audio-inputs.md +++ b/docs/roadmap/audio-inputs.md @@ -1,6 +1,6 @@ # Multi-Format Audio Inputs and Shared Discovery -Status: Core direction agreed; discovery and naming decisions remain open +Status: Agreed scope; implementation pending ## Goal @@ -78,8 +78,12 @@ Preserve these established behaviors: - Keep the existing local and S3 duplicate-basename rules distinct. - Preserve ordinary unambiguous speaker IDs and prepared names. -Same-stem collisions across different extensions are addressed by the open naming -decision below. This scope adds no content-based audio deduplication. +Detect remaining same-stem collisions across different extensions during shared +discovery, after applying existing prepared-name disambiguation. Identify both +source paths and ask the operator to select one encoding or give the recordings +distinct names. Preserve stem-based speaker IDs rather than adding automatic +renaming for cross-extension collisions. This moves an existing transcription +failure earlier; it does not add content-based audio deduplication. ### Regular files, without a codec allowlist for explicit sources @@ -88,11 +92,36 @@ not have a `.flac` suffix or belong to a Narratio-maintained codec allowlist. Existing path rules remain applicable; this decision adds no blanket symlink prohibition or unrelated filesystem hardening. -Automatic directory and S3-prefix discovery must use a consistent policy for -selecting candidate audio and handling sidecars. That policy remains open below. S3 discovery deals with object entries; local regular-file checks apply to local sources and materialized copies rather than inventing filesystem types for S3. +### Broad extension filtering for automatic discovery + +Use one shared, case-insensitive extension filter when scanning a local audio +directory or S3 prefix. The initial discovery set is: + +```text +.aac .aif .aifc .aiff .alac .amr .ape .au .caf .flac +.m4a .m4b .mka .mp2 .mp3 .mp4 .oga .ogg .opus .snd +.wav .wave .weba .webm .wma .wv +``` + +These suffixes identify candidates, including common audio-bearing containers; +they do not guarantee backend decoding or the presence of a valid audio stream. +Keep the set in one central, discoverable location in the shared audio-selection +owner. Preserve existing enumeration scope and directory-marker handling. + +Automatic scans ignore nonmatching entries such as `ignore.txt`, unfamiliar +suffixes, and extensionless files. Explicit local file selections remain +extension-agnostic, as do already registered manifest audio inputs. The discovery +set is not a universal codec-validation rule. Document its scope, including that +S3 currently selects by prefix and therefore uses this filter; no new S3 override +or per-object selector is introduced by this feature. + +Automatic scans in preparation, inspection, preparation reuse, and transcription +must use the same filter. This supports mixed-content source directories without +submitting obvious sidecars and avoids divergent format lists among consumers. + ### Carry selected audio through the whole pipeline Remove FLAC-only acceptance checks from transcription, including its manifest @@ -131,7 +160,7 @@ in local and S3 discovery. Implement the approved regular-file check consistentl for local recordings. Resolve same-source duplicates and the existing basename disagreement through the shared selection owner. -Apply the chosen automatic-discovery policy to source discovery and transcription's +Apply the shared extension set to automatic source discovery and transcription's fallback enumeration. Manifest-registered audio is already explicitly selected; it should not encounter another extension-based gate. @@ -141,14 +170,16 @@ Primary areas: `internal/stage/prepare.go`, ### Speaker identity and prepared destinations -Apply the chosen same-stem policy consistently before transcription dispatch. -Account for prepared filenames as well as original source paths: checking original -stems alone must not reject the distinct same-basename inputs that preparation -already disambiguates successfully. +Detect unresolved same-stem ambiguity consistently during shared discovery, +before transcription dispatch. Account for prepared filenames as well as original +source paths: checking original stems alone must not reject the distinct +same-basename inputs that preparation already disambiguates successfully. Keep speaker mappings, raw transcript paths, and checkpoint keys consistent with -the resulting IDs. Retain errors that identify ambiguous sources if early -rejection is selected; preserve actual format suffixes if naming is extended. +the existing IDs. Report both ambiguous sources and direct the operator to select +one encoding or rename recordings. Preserve actual format suffixes and the +established disambiguation of identical full basenames. Do not silently choose +an encoding or extend automatic naming to the unresolved cross-extension case. Use existing reporting paths to make any derived names understandable to operators. Primary areas: preparation's destination naming, `buildTranscribeJobs`, source @@ -183,11 +214,14 @@ Use representative offline behavior tests with real temporary files and fakes at the transcription/storage boundaries: - Preparation and inspection agree for explicit mixed-format sources and for - directory/S3 discovery, including sidecar behavior under the selected policy. + directory/S3 discovery. Automatic scans recognize the shared suffix set + case-insensitively and ignore nonmatching sidecars; explicit files with other + suffixes or no extension are not rejected solely by their names. - Non-FLAC audio registered in the manifest reaches transcription. Fallback discovery follows the same candidate-selection policy. - Duplicate resolved paths are rejected, distinct same-basename local recordings - remain usable, and cross-extension same-stem cases follow the selected rule. + remain usable, and unresolved cross-extension same-stem cases fail during + discovery with both sources identified, before transcription is dispatched. - Copying and S3 materialization retain the selected bytes and suffixes; upload and replay retain the multipart filename and payload. - A partial mixed-format transcription can retry without repeating previously @@ -216,59 +250,3 @@ raw audio. This roadmap concerns workflows that actually select and transcribe audio. Neither roadmap requires completing the other first. Remote execution checkpoints, new audio-size caps, additional format conversions, and live-stream input support are outside this scope. - -## Open Decisions - -### Automatic directory and S3-prefix discovery - -Explicit file selection can be extension-agnostic. Automatic discovery still -needs a policy: current filtering ignores sidecars such as `ignore.txt`; simply -removing that filter would select them too. - -**Recommendation:** Treat the configured audio directory or prefix as a collection -of intended audio selected by the operator. Select regular local files and ordinary -S3 object entries, retaining existing enumeration scope and directory-marker -handling, without an extension filter. Let the backend reject a non-audio entry. -Use explicit local file selection when the surrounding directory contains other -material. - -This is the least complex extension-independent rule, works for unfamiliar -suffixes and extensionless recordings, and avoids maintaining a codec registry. -The tradeoff is an operator-visible change: sidecars previously ignored can now -be submitted and cause transcription failure. An audio-only source convention is -a proposed operational contract requiring approval, not an already agreed -restriction on source directories. - -**Alternative:** Use a shared, broad audio-extension discovery filter, including -the named common formats, while leaving explicit file selection unrestricted. -This preserves convenient mixed-content folders and avoids submitting obvious -sidecars. However, unfamiliar suffixes can still be silently excluded, the list -needs maintenance, and S3 currently offers prefix selection rather than an -explicit per-object list. Supporting arbitrary suffixes there would need an -operator override or another selection mechanism. Those additions require an -explicit scope choice; a discovery filter should not become a universal codec -validation rule. - -### Same speaker stem across different audio extensions - -`speaker.mp3` and `speaker.wav` both derive speaker ID `speaker`. This ambiguity -must be handled consistently even though both formats are acceptable. Current -transcription already rejects the duplicate ID. - -**Recommendation:** Preserve current stem-based speaker IDs and detect remaining -ambiguities during shared discovery, after applying existing prepared-name -disambiguation. Identify both source paths and ask the operator to select one -encoding or give recordings distinct names. This moves an existing failure -earlier, preserves established speaker mappings/checkpoint identities, and avoids -new automatic naming behavior for a pair that may be two encodings of the same -recording. It preserves the existing acceptance of distinct local sources with -the same full basename; their prepared names are already disambiguated. - -**Alternative:** Extend deterministic prepared-name disambiguation to collisions -in derived speaker IDs, preserving each format suffix. This accepts both recordings -without manual renaming and can reuse the existing naming technique. It adds -identity/naming cases, requires source-to-ID visibility for speaker mappings, -and may transcribe duplicate encodings that the operator did not intend as -separate sources. Preserve existing unique IDs and decide how this applies to -local and S3 inputs before adopting it; do not merge recordings or choose one -encoding silently.