Repository navigation
Player lifecycle: transport contract and foreground drivers leave the machine's file; machine shape gate - #1003
Merged
Merged
Conversation
…fecycle.rs Sans-IO lifecycle PR B, behaviour-preserving. lifecycle.rs keeps the machine (events, effects, state, step, accessors) and its tests; two new modules take the rest as a pure move: - player/transport.rs: paused, set_paused, commit_viewer_resume_for_load, transport_target, viewer_paused, set_transport_paused, resume_if_paused and their tests (the hostsim pause-contract tests too). - player/foreground.rs: drive_foreground, poll_foreground_flight, poll_foreground_load, park_pending_foreground_flight, their shared loop, ForegroundActuator, ForegroundActivation, ForegroundPollOutcome and FlightLanding. Not pure moves: the module docs, three machine helpers widened to pub(super) (ForegroundEffect::awaits_answer, PrepareAnswer::of_outcome/of_start), doc links and use blocks re-pointed, `lifecycle.state` -> `lifecycle.state()` at three sites in the moved hostsim tests, and the app::lifecycle re-export split in three. Callers keep their names through app::lifecycle. Ledgers (the honesty rule: a relocation lowers no pin on its own): the three lifecycle.rs player::TX lines leave ci/allow/globals/media.txt because the machine now reads none. In the same diff the globals rule is widened to the transport's readers (transport::paused, transport::viewer_paused, preview::paused; bare after an import, renames refused), which seeds three preview::paused reads in screens/src/detail/mod.rs as a coverage expansion with correct counts. Globals total: 98 - 3 + 3 = 98, PINNED_LEDGER_TOTALS unchanged. The player::TX spelling stays pinned to lifecycle.rs as a zero-guard. The wall gate also covers lifecycle.rs now (no hit when it joined). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…chine-shape.py ci/machines.ini lists the machines whose shape is gated, in list-caps.ini's [file::symbol] style with paths relative to rust-modules/; the first entry is ForegroundLifecycle. ci/check-machine-shape.py (wired into check-python-steps.txt with its unit test) fails on a pub, pub(crate) or pub(super) field of a listed struct and on a stale entry, and REPORTS, never fails on, the number of bool and Option<..> fields per machine: a report-only flag ratchet. docs/sans-io.md gets the status line, the globals row and TX bullet for the transport readers, and a "Machine shape" section. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
#990 deleted the data-person ledger files and set the pins to workers 22 and globals 97. Take those, and restate this diff's pin comment and the docs/sans-io.md sentence as the change's own net effect (-3 deleted, +3 seeded, net zero) instead of naming a total other lanes move. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The import halves of the globals rule for the player's pause readers had no
left word boundary, so `use crate::scrub_preview::*;` (or any `..._transport`
module) made every bare `paused` token in that file a registry read. Both
halves (and the awk prefilter) now want a non-identifier character before
`transport::` / `preview::`.
The self-test plants a `scrub_preview::*` glob and a `hud_transport::{..}` /
`my_preview::{paused}` group beside a `paused` local and requires no site;
it failed on the unanchored patterns (phantom `::paused` sites) and passes now.
Also corrects the lifecycle.rs-zero-guard test's docstring: the machine reads
no TX at head.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…i says what the gate reads lifecycle.rs's module doc justified its location by the player machine, the trailer transport and the claim hold all naming it. At head only the player machine does; the transport (and its users) are transport.rs's doc. foreground.rs said "the only change to the machine's file", which ignored its doc. machines.ini said only the section name is read, but event and effect are printed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: ci/check-deps.sh (the gate wall line and its comments keep both widenings: media/src/player/lifecycle.rs and data/src/subsearch.rs) and tests/test_harness.py PINNED_LEDGER_TOTALS (the sums at the resolved tree: workers 19, globals 95, forks 60, fxlanes 11; this branch's net-zero comment kept). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…w are The globals ledger headers copied the rule's spelling list, which this branch widened to transport::paused, transport::viewer_paused and preview::paused, so every copy was false. They now point at ci/check-deps.sh's globals rule instead (no tool or test parses those header lines; only line 1, the count, is read). route/flight.rs: the foreground restore's resume is drained by the driver player::foreground::poll_foreground_flight, not by the machine in lifecycle.rs. transport.rs: resume_if_paused carries its provenance (app/playback.rs). 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.
Closes #1002
rust-modules/media/src/player/lifecycle.rsnow holds only theForegroundLifecyclemachine. The player transport contract and the per-frame drivers that run the machine moved out verbatim:player/transport.rs:paused,set_paused,viewer_paused,transport_target,set_transport_paused,resume_if_paused,commit_viewer_resume_for_loadand their tests, the hostsim ones included;player/foreground.rs:drive_foreground,poll_foreground_flight,poll_foreground_loadandpark_pending_foreground_flight, withForegroundActuator,ForegroundActivation,ForegroundPollOutcomeandFlightLanding.app::lifecyclere-exports the same names, so callers keep their paths. This is lifecycle PR B of the Sans-IO series and follows #977, which made the machine astep(event)machine with private state.The move
git diff --color-moved=zebraover the three files classes 569 added and 571 removed lines as moved. The rest of the diff in them is:pub(super), because the drivers inforeground.rscall them:ForegroundEffect::awaits_answer,PrepareAnswer::of_outcomeandPrepareAnswer::of_start;useblocks;.statespelled.state()at three sites in the moved hostsim tests, becausetransport.rscannot reach the private field.No test function and no other statement changed. Caller path edits are in
preview.rs,pump.rs,claim_hold.rs,app/lifecycle.rsandapp/run.rs.Ledgers
ci/allow/globals/media.txtlifecycle.rsplayer::TXlines deletedci/allow/globals/screens.txtPINNED_LEDGER_TOTALSunchanged at 19/95/60/11 (workers/globals/forks/fxlanes),main's totalsA relocation must never lower a pin by itself, so the deleted lines come with a widened
globalsrule:ci/check-deps.shnow also sees the moved readerstransport::pausedandtransport::viewer_paused, pluspreview::paused. It sees each one qualified, bare after an import, in a braced group or by glob. Ause … asrename is refused.src/app/andmedia/. A transport-only widening would therefore have found nothing, and the pin would have dropped by three on a pure move.preview::pausedis the pause reader that a scanned machine does call, and it isTX.pausedbehindoccupies(). The three seeded lines are its real reads inscreens/src/detail/mod.rs(draw,preview_tick,collapse_full_trailer), and all three exist onmaintoday. Seeding them is the coverage expansion; nothing was added to make a site pass.player::TXspellings stay pinned tolifecycle.rsas a zero-guard: the machine now reads noTX.use crate::scrub_preview::*;would have turned every barepausedlocal in its file into a phantom site. A negative test pins this.lifecycle.rsjoins thewallgate with no hit.Machine shape
ci/machines.inilistsmedia/src/player/lifecycle.rs::ForegroundLifecycle.ci/check-machine-shape.pyfails on anypubfield of a listed struct and on a stale entry, and reports the flag counts without failing on them:It is wired into
ci/check-python-steps.txtwith its 14-case test.Build benchmark
make build-benchran 3 interleaved runs per scenario on an Apple M4 with 10 cores and rustc 1.99.1. The base is9bc127faf, themainthis branch merged at the time. Both change runs carried the tool's host-load warning, because other lanes were building (load 10 to 37 on 10 cores).plx_basecbuf.rs (non-incr)plx_machinelandgate.rsplx_platformdevcaps.rsplx_gfxoverdraw.rsplx_netstream_redirect.rsplx_uidwell.rs (control: does not rebuildplx_media)plx_plexretry.rsplx_telemetrywindow.rsplx_datatape.rsplx_sessionscripted.rsplx_mediaunits.rsplx_appkitskip_pill.rsplx_screensclock_readout.rsplx_uilib.rs (non-incr)Medians are shown; the per-run min and max are in the lane's record. The two incremental rows were skipped because
target-fastwas absent.No row moves outside load noise:
No speed-up or slowdown is claimed.
One of run 1's three unit-suite runs failed
app::bridge::library_route_tests::the_crumb_root_pops_to_the_library_and_up_from_it_is_the_movies_pill. That test passed alone 25 of 25 times, in the full suite 4 of 4, in bothmake checkpasses and in every later suite run. This PR touches no code that test binary runs, apart from re-export lines. Filed as #1001.Gates
This PR's CI is the gate for the tree it merges:
a8849ea48, which mergesmainat e99c685 (#999). The merged tree was not compiled locally.Before that merge, the full local gates ran on the committed tree
ccbf99abd(then onmain9bc127f), withgit status --shortempty before and after each:make check: exit 0. Every Rusttest result:line reads0 failed, and the harness ran 543 tests, OK. check-deps readworkers (22 sites),globals (97 sites),forks (60 sites),fxlanes (11 sites), "all gates green";check-machine-shape: ok.make check-nodef: exit 0, no warnings.make check-replay: "3 fixtures, 6 replays, 0 failures". Every replay readverdict=SAMEwith every*_diffs=0, and no fixture file changed.make(ARM):pkg/plxnativelinked.The merge with
mainhad two conflicts:ci/check-deps.shwallline, which keeps both widenings (main'ssubsearch.rsand this PR'slifecycle.rs);PINNED_LEDGER_TOTALS, recomputed from the area files'# count:headers.On the merged head, the gates that run no cargo:
ci/check-deps.sh: exit 0, withworkers (19 sites),globals (95 sites),forks (60 sites),fxlanes (11 sites)and "all gates green".ci/test_check_machine_shape.py: 14 tests, OK.ci/check-machine-shape.py: ok.Doc fixes
A doc-claim audit found two sentences this change made false. Both are fixed here:
ci/allow/globals/*.txtheader. It listed theglobalsrule's spellings by hand, so the widened rule had left all eleven copies stale. The line now points at the rule inci/check-deps.sh. No tool parses that line. This is why the diff touches nine globals area files whose entries did not change.route/flight.rs's module doc. It now names the driver that drains the foreground flight,player::foreground::poll_foreground_flight.transport.rs's doc onresume_if_pausedalso gains its provenance: it came fromapp/playback.rs, and module-layer step L12 moved it intolifecycle.rsbefore this PR moved it on.Not in this PR
--guest --mockbackground and foreground cycle, reading the Park and DidForeground outcomes in the log.🤖 Generated with Claude Code