Repository source: docs/plans/audio_files/audio_files_step3_development_plan.md
Audio files: Step 3 development plan
Step 2 approved and committed (a8bb6cd). No scope has been added since.
Storage changes: none. No read-model table, column or index. The audio reference is a line in the signed post body, as Image-v1: is. The queue reads it from the stored post body, which the read model already holds. Audio files live outside Git in their own folder beside the image store, the same kind of file storage as images. (Step 1 should have carried this line too; its answer was the same.)
Concepts touched
Audio attachment: new entry
docs/concepts/audio_attachment.md(Stage 7).Media embed: changed (local file in the play bar, Download).
Music section: changed (uploads are tracks; queue order).
Image serving: used unchanged as the pattern.
Completion Contract
Normal entry: a member opens the composer's … menu, taps "Attach audio", picks an MP3 or M4A of three minutes or less, and posts.
End-to-end outcome: the post shows the play bar in the thread and on
/tracks/. It plays and seeks on an iPhone, Download saves the signed bytes, and the Friday queue plays this fortnight's uploads first.Recovery: a wrong type, a file over three minutes or one over 8 MB is refused before upload with "Export as MP3 or M4A, three minutes or less", and the draft keeps its text. The server refuses the same files when scripts are off or the check is bypassed.
Deployment check: Ilya turns the flag on for mitrapclub and posts a voice memo from his iPhone.
Release: the flag is off by default everywhere; nothing changes until it is turned on.
Key Risks
High risk: iPhone Safari won't play or seek audio unless the server answers byte-range requests. Validate in Stage 3 with a range test and in Stage 7 at iPhone size. Mitigation: range support is part of the serving route from the start.
Reading the length on the server: MP3 and M4A store it differently. Validate in Stage 1 with fixture files of both, including variable-bitrate MP3. Mitigation: if the length can't be read, refuse the file rather than guess.
Disk: give audio its own store cap (512 MB and 512 files, shown in Tools). Validate with a store-full test.
Backups: image backups exist, audio is not in them yet. Mitigation: Tools says so plainly; added later as a to-do.
Stage 1
Goal: the audio reference, validation, storage and permission, with nothing visible yet.
Dependencies: none.
Expected changes: new flag
FORUM_AUDIO_CONTENT_ENABLED(Authoring group, off by default). AnAudio-v1:reference (hash, type, bytes, seconds, optional title) parsed from the body likeImage-v1:. A validator that checks MP3/M4A by content, not by name, enforces 8 MB and reads the length (three minutes at most). An audio store beside the image store with its own caps. The approved-member upload rule reused from images.Verification approach: unit tests with small MP3 (fixed and variable bitrate) and M4A fixtures, plus WAV, an over-length file, an over-size file and a renamed text file.
Risks or open questions: length parsing edge cases (above).
Canonical components/API contracts touched:
ImageReferencepattern,ImageStorepattern,FeatureFlagRegistry.
Stage 2
Goal: posting with an audio file, through the same write path as images.
Dependencies: Stage 1.
Expected changes: the write service and text API accept one audio attachment with a post, check the signature covers its reference, store it and remove it with the post.
get_profilegainsAudio-Upload-Allowed.llms.txtmentions it. quill.py--audiostays out of scope.Verification approach: write-path tests for accept, refuse (guest, flag off, bad file, store full) and removal.
Canonical components/API contracts touched:
LocalWriteService,ApiTextController,LlmsTxtRenderer.
Stage 3
Goal: serving the file so phones can play, seek and download it.
Dependencies: Stage 1.
Expected changes: an audio route by hash with the right type, year-long immutable caching like images, byte-range answers, and
?download=1sending it as a download under a readable name.Verification approach: tests for full, partial (range) and download answers, and unknown hashes.
Canonical components/API contracts touched: the image serving route pattern,
public/.htaccess(read only, to confirm no static rule catches it).
Stage 4
Goal: "Attach audio" in the composer.
Dependencies: Stages 2–3.
Expected changes: an "Attach audio" item in the … menu next to Attach image, only while the flag is on and the member may upload. The page checks type, length and size before upload and shows the message. A plain file field works without scripts.
Verification approach: browser check with and without scripts; the draft keeps its text on refusal.
Canonical components/API contracts touched:
image_compose_fields.php,image_upload.jspatterns, the composer's … menu.
Stage 5
Goal: the play bar for uploads, in threads and on
/tracks/.Dependencies: Stage 3.
Expected changes: the media-embed renderer draws the same bar for an
Audio-v1:post: play/pause, seek line, elapsed and total time, Download. The inline player script drives a native audio element and keeps the one-player-at-a-time rule. Without scripts the browser's own controls show. An upload counts as a playable track on/tracks/.Verification approach: renderer tests; browser check that play, seek and the one-at-a-time rule work.
Canonical components/API contracts touched:
MediaEmbedRenderer,media_embed_inline_player.js,MusicPageController(rows).
Stage 6
Goal: the Friday queue order.
Dependencies: Stage 5.
Expected changes: the queue (slides and
added.txt) plays uploads from the past 14 days first, then everything else, each newest shared first.#playnextkeeps working as today.Verification approach: a test with dated uploads and links checking the order and that additions arrive in the right place.
Canonical components/API contracts touched:
MusicPageController::slides(),playable(), the additions route.
Stage 7
Goal: iPhone check and documentation.
Dependencies: Stages 1–6.
Expected changes: a browser check at iPhone size with a real voice-memo M4A: attach, post, play, seek, download. New concept page
audio_attachment.md; updates to media embed and music section entries. Manual steps for Ilya's check after deploy.Verification approach: the checks above, the smoke set and tests for changed files. The full suite is left to Ilya. A real Safari run waits for Ilya's phone.
Canonical components/API contracts touched:
docs/concepts/,tests/browser/.
— Claude · 2026-12-04 UTC
Approval
Approved Step 3 on 2026-12-04 by Ilya, by voice while driving ("Approve step three").