fix(photon): make packaged voice transcoding deterministic - #65836
fix(photon): make packaged voice transcoding deterministic#65836redeye1011 wants to merge 6 commits into
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Makes packaged voice transcoding deterministic. Larger diff due to test/refactor scope. No security concerns.
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the clean-install final-hop failure. The premise is present on current main: plugins/platforms/photon/sidecar/package.json:15-17 installs only spectrum-ts, while package-lock.json:595-602 shows ffmpeg-static is merely its optional peer.
Problems
tests/test_packaging_metadata.py:160-181adds a Python source-shape test that readspackage.jsonand workflow text.AGENTS.md:1327-1329requirespackage.json/package-lock.jsonassertions in the JS suite, andAGENTS.md:1380-1384bans source-shape tests. This duplicates the behavior-oriented packaged artifact coverage added intests/test_wheel_locales_e2e.py:61-117.
Suggested changes
- Remove the new metadata test (and
jsonimport), keeping the wheel/sdist artifact smoke. If a direct package manifest assertion is required, place it in Vitest.
Automated hermes-sweeper review.
| assert "include plugins/platforms/photon/sidecar/*.mjs" in manifest | ||
| assert "include plugins/platforms/photon/sidecar/*.json" in manifest | ||
|
|
||
| package = json.loads( |
There was a problem hiding this comment.
This new Python test reads and asserts package.json/workflow source shape. AGENTS.md requires package-manifest assertions in Vitest and bans source-shape tests; the packaged wheel smoke added in tests/test_wheel_locales_e2e.py already validates the runtime behavior. Please remove this metadata check or move any manifest-only assertion to JS.
What does this PR do?
Makes Photon/iMessage voice replies deterministic on clean installs.
spectrum-tsalready transcodes non-M4A voice bytes before upload, but itsffmpeg-staticpeer is optional and the Photon sidecar did not install it. That leaves first-hop installs dependent on a systemffmpeg. After a successful transcode, Spectrum also preserves the source filename (for example,reply.mp3) while uploading M4A bytes, which iMessage can render as a broken or zero-duration audio attachment.This PR exact-pins Spectrum's supported static ffmpeg peer as optional and extends the sidecar's existing fail-loud Spectrum patch so transcoded voice uploads always use an
.m4afilename. Supported hosts get deterministic conversion; unsupported architectures retain Spectrum's system-ffmpeg fallback instead of failing the whole Photon install. The patch migrates existing installs that already have the older mixed-attachment marker and remains idempotent on subsequent starts.This is complementary to draft PR #65322: that PR improves adapter-level voice normalization and fallback behavior; this change makes Spectrum's final upload hop deterministic on current
mainand when the host has no system ffmpeg.Related Issue
Related: #65322 (companion fix; does not close it)
Type of Change
Changes Made
ffmpeg-static@5.2.0as an optional sidecar dependency and lock its transitive tree as optional.patch-spectrum-mixed-attachments.mjsto rewrite Spectrum's post-transcode upload filename to.m4a.reply.mp3becomesreply.m4aat the upload boundary.How to Test
cd plugins/platforms/photon/sidecar && npm cinode --input-type=module -e 'import p from "ffmpeg-static"; console.log(p)'resolves an installed binary.scripts/run_tests.sh tests/plugins/platforms/photon/ -qscripts/run_tests.sh tests/test_packaging_metadata.py -qscripts/run_tests.sh -m integration tests/test_wheel_locales_e2e.py -qscripts/run_tests.sh -qVerified locally:
npm ciapplied the patch to the real@spectrum-ts/imessage@8.0.0install.@spectrum-ts/core/authoring.ensureM4aand the installed static ffmpeg succeeded.npm cisucceeded, installed Spectrum, and cleanly omitted the optional static binary.123 passed.2 passed.41,950 passed, 27 failed; those 27 failures exactly matchorigin/mainacross the same six unrelated files in this configured profile, and no Photon tests failed.npm auditfindings are unchanged fromorigin/main: 17 moderate, 0 high, 0 critical.Supply-chain note
ffmpeg-static@5.2.0is Spectrum's declared optional peer. Its npm install hook downloads a GPL-3.0-or-later platform binary from the package's GitHub release; the npm lockfile verifies the package tarball, not that downloaded binary. This PR does not redistribute that binary, adds no npm audit findings, adds the sidecar lock to recurring OSV scans, and keeps the dependency optional so unsupported or failed downloads preserve Spectrum's system-ffmpeg fallback. Maintainers should explicitly confirm that trade-off before merge.Checklist
Code
Documentation & Housekeeping
cli-config.yaml.example: N/ACONTRIBUTING.md/AGENTS.md: N/A; no architecture or workflow changeci-reviewedScreenshots / Logs