Repository navigation
Playback contract crate, BackendRunner and attempt-metrics reducers (unwired) - #1268
Merged
Merged
Conversation
…ics reducers (unwired), workspace and package lists Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…k-deps scans, docs The pr-reviewer's blockers and minors against carve/p1: - Makefile RUST_INPUTS lists rust-modules/playback-contract (ci/check-rust-inputs.py). - tools/build-bench.py HOST_TEST_ARGS and the unit-suite prose name plx_playback_contract; ci/test_build_bench.py's fake cargo reports its artifact, and ci/test_test_fast.py counts the `-p` crates instead of hard-coding the number. - ci/list-caps.ini classes the contract's MAX_FEED_AHEAD_NS, subtitle WINDOW_NS and fingerprint, and media's MAX_ATTEMPT_HISTORY. - ci/check-deps.sh scans playback-contract/src like every other layer crate and puts the contract and the four unwired reducers (attempt_metrics, attempt_view, backend_startup, backend_metrics) in MACHINES, the contract in FORK_SCOPE. No ledger line changes. - ci/test_build_not_always_dirty.py LIB_ARGS, the CI source-lines budget (--src, its prose in check-build-budgets.py and build-budgets.json) and every quoted unit-suite `-p` list in the docs name the contract. - docs/module-layers.md describes the playback_contract layer and its data/media edges; docs/sans-io-guide.md lists the new machine files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
#1265 added FailureKind::ServerStopped. The server ending the session is not the backend's refusal, so it maps to an unknown presentation failure and arms no backend fallback. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Nov 7, 2026
…nto lane/merge-1265 #1265 lands where integ keeps that code: the neutral parts (timeline reply, terminal-for-the-logical- playback, recovery cancel, read-out) stay in media; the physical Feed parts (deferred cleanup of an in-flight native Load, the off-frame release of the stopped engine) are play-feed's, reached through `FeedStop::stop_begin(terminal)`. A server stop is terminal for whichever backend plays: the backend-neutral `route_start::retire_if_server_stopped` releases a Feed engine or a URI attempt. #1268's paths take integ's side (integ is the superset); `backend_metrics.rs` gains main's `ServerStopped` arm, and the contract's `RuntimeFailure` gains the variant. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
plx_playback_contract(rust-modules/playback-contract/), the backend-neutral playback vocabularythat the later URI-first PRs build on, and lands five pure reducers in
plx_media::playerthat nothingcalls yet.
plx_base, new layer[playback_contract]): the playback commands andreadouts, the time, track and subtitle types, the
BackendStatemachine, the adaptive-session types, theUriDriverport, the Feed port traits (FeedSeek,FeedLoad,FeedOpen,FeedStop, andFeedControloverthem) and the adaptive
FeedPort, with their test fakes (test-support).plx_media::player, with unit tests and no callers:backend.rs(BackendRunner),backend_startup.rs,backend_metrics.rs,attempt_metrics.rs,attempt_view.rs. They arepub mod, sothere is no dead-code warning to suppress. They land before the PR that wires them (P3+P4) so that PR
reviews wiring, not 80,000 characters of new reducer.
plx_data'sTrackNamesandplx_media'sabr::units::MediaTimeMsbecome re-exports of the contract's types (same path, same fields).[playback_contract]inci/module-layers.ini, the twoci/machines.inientries,ci/check-deps.sh(the crate and the four reducers are machine code; noci/allow/ledger line is added or changed),ci/list-caps.ini,Makefile(UNIT_SUITE, the lab,hostsim and
test-fastlines,RUST_INPUTS),tools/build-bench.py, the Python pins that quote thoselists,
.github/workflows/ci.yml, and the docs that quote the unit-suite-pline.Behaviour: none. No production code constructs a
BackendRunner,BackendState,AttemptMetricsor anycontract port; the two re-exports are the same types under the same paths.
This is the first PR of the URI-first series carved from the
integ/uri-firstintegration branch. Every paththis PR owns is byte-identical to that branch (
git diff integ/uri-first HEAD -- <the 23 paths>is empty);shared files (Makefile, CI scripts and lists, docs) carry only the hunks this PR's crate and files need, found
by sweeping each shared file's integration diff for them.
Content size (non-whitespace characters,
tr -d '[:space:]' | wc -c, base 4bf133d -> head)playback-contract(src/**/*.rs).rs+ Cargo.toml)media(changed files;src/**/*.rswhole crate 5,517,473 -> 5,626,119)data(track_names.rs1,649 -> 179,Cargo.toml+51)Cargo.toml/Cargo.lockAlmost all of it is new code (contract +177k, reducers +108k) with its tests.
datashrinks becauseTrackNamesmoved into the contract; the 2,451 in CI/tools is thecheck-deps.shscan lists andlist-caps.inisections.Duplicates this PR adds beside live
mediadefinitions (not fixed here)The contract carries the vocabulary that later PRs move out of
media. Until then both copies exist; byte-identitywith integ forbids editing either side here, and
mediadoes not use the contract copies (outside the five newreducers and the
abr/units.rsre-export, nothing inmedianames the contract). Each pair is removed by the series PR that switchesmediato thecontract (named below: P2 the codecs move, P3+P4 the neutral orchestration with the play-feed move):
subtitle.rs(WINDOW_NS,SCAN_NS,fingerprint,Anchor,ReadCfg,RunEnd,SideStop,pacing_parks,playhead_of,delta_*,judged_clock)media/src/ff_subside.rsff_subside.rskeeps only the transport and imports these from the contract)subtitle.rsSpecmedia/src/player/subside.rs:51feed.rsconstsMAX_FEED_AHEAD_NS,AUDIO_SLACK_NS,AQ_VIDEO_BYTES,AQ_AUDIO_BYTES,PRES_NONE;SampleBufmedia/src/player/engine.rs:3127(and neighbours),:157ci/list-caps.initherefore carries bothMAX_FEED_AHEAD_NSsections until then)readout.rsABR_MODE_*,ABR_ACTION_*,RuntimeFailure(pub(crate)in media);feed.rsSeekModemedia/src/player/mod.rs:316, :1117and theABR_*constsreadout.rsRefusalPath,PlaybackState;feed.rsHlsUserPause,HlsUserResume,HlsPauseCompletion,HlsPlayCompletionmedia/src/player/shared.rs:21, :363-:478feed.rsPcmFormatmedia/src/route/decision.rs:5828feed.rsDolbyHdrInfo(identical fields)data/src/metadata.rs:652(the data layer's own copy)playurl.rsPlayUrl,PlayDovimedia/src/player/playurl.rs:43, :110adapter.rs/engine.rsswitch toplx_playback_contract::playurl)video.rsRat,Mastering,ContainerHdrmedia/src/player/vp9_hdr.rs:35-:51play-feed)Documentation that names paths which exist only after a later PR
The contract's and reducers' doc comments describe the final layout. These sentences name a crate or file P1 does
not add (they are comments, not links; nothing breaks):
playback-contract/src/feed.rs:24(play-feed/src/readout.rs)playback-contract/src/playurl.rs:3, :21, :112(plx_play_feed::playurl,plx_play_feed::audio_payload_codec, media'sfeed_openonce it moves)playback-contract/src/subtitle.rs:136, :145(plx_play_feed::side_reader,SideReaderPort)playback-contract/src/uri.rs:58(plx_play_uri)media/src/player/backend.rs:943, :946(the play-uri backend rig,UriBackend::picture_step,play-uri/src/picture_gate.rs)media/src/player/backend_metrics.rs:348(PlayerAdapter::observe_backend_condition, P3)playback-contract/Cargo.toml[package.metadata.plx] mount: read by integ'sci/check-module-layers.py(P7); main's gate ignores it and derives the layer from the package name.docs/module-layers.md(the new paragraph) says theBackendRunnerand attempt reducers are "written against" the contract; they have no caller until P3+P4.Not fixed in P1 (follow-ups on integ, found by the same review)
BackendKind,BackendSet, Starfish-shaped fields infeed.rs).Backendenums (attempt_view::Backend, the contract'sBackendKind, the reducers' local one).ci/check-build-budgets.py --graph --srcnever listed the contract on integ; P1 adds it (and the three proseplaces that enumerate the crates). Integ should take the same edit.
Verification
make checkon the committed tree (41b4e6b,git status --shortempty before and after):==== check: 126 steps — all ok (323s wall, ...) ====,==== check: harness — ok (416s) ====, exit 0. Its unit passes includeplx_playback_contract:test result: ok. 40 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out(default features and hostsim) andplx_media:test result: ok. 2135 passed; 0 failed; 84 ignored(default),2369 passed; 0 failed; 84 ignored(hostsim);bash ci/check-deps.sh:check-deps: all gates green.ci/test_build_bench.py44 ok,ci/test_ci_split.py16 ok,ci/test_test_fast.py9 ok,ci/test_build_budgets.py21 ok;ci/check-rust-inputs.py,ci/check-module-layers.py(15 layers),ci/check-list-caps.py(342 sites),bash ci/check-deps.sh(all gates green).make test-hostsim, the TV,make(ARM cross-build).Build cost
make build-benchon one Apple M4 (10 cores), base4bf133d57then this branch at41b4e6bc5(the only later commit is adocs line), 3 interleaved runs per scenario, medians. The two incremental rows were skipped on the branch run (a full run exceeded
two hours on this machine). Another job was building during both runs (the tool warns load > 10 cores), so differences of this size
are noise; the branch adds one small leaf crate that only
dataandmedianame.No-op: both sides rebuild the same one unit (
app crate rebuilt: mixed, 1/181 units on main, 1/183 here), a pre-existing marker.Unit suite: 11,893 passed on main, 11,975 here (the contract's 40 and the reducers' tests). ARM archive 118.4 MiB -> 118.5 MiB.
Related: #1064
🤖 Generated with Claude Code