mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
The inline-audio feature splits one invariant across two lanes: the desktop client strips audio metadata before upload, and the relay validates the stripped shape. Both sides have to agree on exact bytes, so both sides should test against the same evidence rather than against separately-invented synthetic packets. Adds a generator for the fixtures that actually discriminate, a four-instrument checker for a candidate stripper, and an independent oracle for the canonical Ogg page layout. Fixtures are generated by ffmpeg rather than committed: they are deterministic, and bigart.ogg is 127 KB of synthetic album art that does not belong in git history. Two fixtures encode findings that are easy to miss: - mpeg2_22k.mp3 / mpeg25_11k.mp3 have frame syncs FF F3 and FF E3. infer 0.19.0's is_mp3 matches only ID3 magic or the MPEG-1 sync FF FB, so these files are recognised solely by their ID3 header. Strip it and infer::get() returns None, which silently downgrades a valid mp3 to a generic attachment with no player and no error. Any acceptance path keying on infer for mp3 has this bug. - bigart.ogg's Vorbis comment packet exhausts one page's 255 lacing values and continues onto the next, so the comment cannot be excised in place; the header region must be demuxed and re-paginated with sequence numbers renumbered and page CRCs recomputed. check_strip.sh runs four instruments because the obvious two are not sufficient: an Ogg rewrite that dropped continuation pages left 58 KB of payload in place while still decoding cleanly and still reporting the correct duration. Only the PCM comparison catches a lossy strip, and only the marker grep catches a strip that did nothing -- so the marker check reports itself blind when its negative control is absent rather than passing vacuously. verify_contract.py is written from RFC 3533 rather than from any particular stripper, so it does not grade its own homework. Harness self-tested against known-broken inputs before use: a no-op copy fails on the marker check, and the dropped-continuation-page Ogg bug fails on decode, duration, and PCM. Known-good strippers pass all fixtures. Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com> Co-authored-by: Dawn <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@buzz.block.builderlab.xyz>