A5 (#171): fire the muxer guard that repairs "MP4 for everything", which had never fired #183

Merged
JMR-dev merged 2 commits from test/media3-muxer-guard into main 2026-09-02 04:02:04 +00:00
JMR-dev commented 2026-09-02 02:45:45 +00:00 (Migrated from github.com)

Closes #171. Stacked on #182.

Media3Muxers' own KDoc names the defect this guards — "the router claimed five containers while the engine silently wrote MP4 for all of them" — and the repair itself was untested. Media3Engine$buildTransformer$3, the requireNotNull message lambda, was four lines and four branches at 0%: nothing had ever driven a plan whose container Media3 cannot mux, and factoryFor answers null for fourteen of the app's containers.

Weakening it does not crash. The wrong output is a playable file with the wrong container — which is why a test, not a bug report, is what catches it.

Three premises asserted rather than assumed

Same disciplines as Media3EngineEmptyCompositionTest, the sibling this joins:

  • the plan is still WebM by the time the engine sees it;
  • Media3 really has no muxer for WebM;
  • neither track was dropped — the empty-composition refusal fires earlier and is that test's subject, not this one's.

Plus its assertFalse(failure is CancellationException) guard, so an unresumed continuation cannot read as a pass.

Type and message, for the reason the ticket predicted

Replacing requireNotNull(...) with ?: DefaultMuxer.Factory() does not make the export succeed — it lets it run on and fail some other way, which a bare runCatching would accept just as happily.

Measured: that mutation fails the type assertion (Media3MuxerGuardTest.kt:79), a real AssertionError rather than a compile error, so the guard is genuinely what this test holds. The message assertion stands behind it.

Gate

Full gate green. 560 → 561 JVM tests, 0 failures. No production code changed.

🤖 Generated with Claude Code

Closes #171. Stacked on #182. `Media3Muxers`' own KDoc names the defect this guards — *"the router claimed five containers while the engine silently wrote MP4 for all of them"* — and **the repair itself was untested**. `Media3Engine$buildTransformer$3`, the `requireNotNull` message lambda, was four lines and four branches at 0%: nothing had ever driven a plan whose container Media3 cannot mux, and `factoryFor` answers null for fourteen of the app's containers. Weakening it does not crash. The wrong output is a *playable file with the wrong container* — which is why a test, not a bug report, is what catches it. ### Three premises asserted rather than assumed Same disciplines as `Media3EngineEmptyCompositionTest`, the sibling this joins: - the plan is still WebM by the time the engine sees it; - Media3 really has no muxer for WebM; - neither track was dropped — the empty-composition refusal fires earlier and is that test's subject, not this one's. Plus its `assertFalse(failure is CancellationException)` guard, so an unresumed continuation cannot read as a pass. ### Type *and* message, for the reason the ticket predicted Replacing `requireNotNull(...)` with `?: DefaultMuxer.Factory()` does not make the export succeed — it lets it run on and fail some other way, which a bare `runCatching` would accept just as happily. Measured: that mutation fails the **type** assertion (`Media3MuxerGuardTest.kt:79`), a real `AssertionError` rather than a compile error, so the guard is genuinely what this test holds. The message assertion stands behind it. ### Gate Full gate green. 560 → 561 JVM tests, 0 failures. No production code changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.