Skip to content

The platform supplies the media composition, and the app publishes it once - #1489

Merged
GLinnik21 merged 4 commits into
mainfrom
platform/w6b-media-composition
Nov 20, 2026
Merged

GLinnik21 merged 4 commits into
mainfrom
platform/w6b-media-composition

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Step W6b of the platform plan (discussion #1460): the platform supplies the playback composition, in two boot phases. The app publishes what it gets once, on every boot. Before, app/boot.rs called acb_init and compose_backends directly, and playback.rs and run.rs chose code paths with feature = "play-uri" gates. Now Platform carries a MediaBoot: webOS fills it with today's bodies, the desktop with the Feed host sink alone, and Platform::HOST_TEST with nothing. webOS boots the same way at the same points, with one new log line.

What changes

  • app/platform.rs
    • Platform gains media: MediaBoot { early_init: fn(&MainThread), compose: fn(&mut PlayerAdapter, controlled: bool) -> Composition }. Platform::new takes it as a fourth argument.
    • Composition { resolver: Option<ResolvePort> } derives Default, which means no resolver.
    • publish_composition(session, adapter, Composition) publishes the resolver first, then install_backends(adapter.composed_backends()).
      • It runs on every boot, for every platform, so a platform with no drivers publishes BackendSet::NONE and no resolver. The session's set and its resolver can no longer disagree.
      • It logs one new line, compose: backends=<uri+feed|uri|feed|none> resolver=<yes|no>. Every existing log line is unchanged.
    • HOST_TEST composes nothing, and the pin test covers the new field.
  • app/boot.rs: two hunks.
    • The acb_init call becomes (platform.media.early_init)(&mt). It stays on the same line, inside the same if !controlled, before ffi::boot().
    • The compose_backends block becomes (platform.media.compose)(…), then publish_composition(…), at the same site.
  • Who fills what
    • src/port.rs (webOS): MediaBoot { early_init: backends::acb_init, compose: backends::compose_native }.
    • src/platform_desktop.rs: a no-op early_init. Its compose calls compose_feed and returns Composition::default().
  • app/adapters/backends.rs
    • compose_backends is split into compose_feed (shared), compose_native, and compose_with(adapter, controlled, install_uri), which the tests use.
    • install_uri_product and install_uri_product_with_ports no longer take the session. They return Option<ResolvePort>, built only after the physical URI install succeeds.
    • The uri: product driver installation refused line moved into install_uri_product, with its text unchanged.
  • media/src/route/decision.rs
    • install_uri_preflight_port takes impl Into<Option<ResolvePort>>, so an absent resolver clears the slot, and the existing callers that pass a resolver compile unchanged.
    • A reader, uri_preflight_port(), is added for the tests.
  • playback.rs and run.rs: the ten feature = "play-uri" lines that chose a path at build time are deleted, six in playback.rs and four in run.rs. Those paths now read the published set at run time. Nothing else in either file changes.
  • Docs: Target shape 6a in docs/platform-ports.md gains an "As landed" note, and docs/module-layers.md follows.

Deviations from the plan

  • Composition is a seam, not a move. port.rs points at functions in app/adapters/backends.rs instead of owning their bodies, because those bodies name ACB, and the app crate's own ACB names leave it only in W11a. The 6a text and the W6b paragraph say so.
  • compose takes no &PlaybackSession. The only use of the session was the old resolver publication, which now happens in publish_composition. 6a records that W10 adds a read-only session parameter if a Tizen driver needs one.
  • 46 play-uri lines remain: 40 in backends.rs, 1 in a run.rs test fixture, 3 in dev.rs, 1 in lib.rs and 1 in the rig. None remain in boot.rs, production run.rs, playback.rs or platform.rs. This commit adds five gated lines to backends.rs, so the docs give the grep instead of a count.
  • Composition::NONE became Default: the constant was read only by the desktop platform, and make check-nodef failed on it as dead code.

What the simulator does differently

  • No URI driver is composed. play-uri is a default feature, so before this change the simulator composed the product URI driver over null ports. Its session set is now Feed alone, with no resolver.
  • Its log no longer has the vplane: exported window … or vplane: this device has NEITHER libAcbAPI … line, nor the uri: product binding=… and uri: display path=… lines.
  • PlaneOwner::boot(ABSENT) is no longer called. The default plane facts are the same absent facts.
  • dev::uriprobe::install no longer runs in a simulator devtriggers build.

Tests

In each case, the published set and resolver must agree:

  • a_composed_uri_driver_is_published_with_its_resolver and a_controlled_boot_composes_no_uri_driver_and_no_resolver call webOS's own compose_native, the function port.rs installs as Platform.media.compose;
  • a_refused_uri_install_publishes_neither_the_driver_nor_a_resolver drives compose_with with an injected install failure;
  • the_desktop_platform_composes_the_feed_and_no_resolver (in platform_desktop.rs) calls the desktop's PLATFORM.media.compose;
  • a zero-driver publish;
  • reading back the published resolver.

The URI boot rig's 18 calls, and install_exported_uri, now publish through publish_composition. A rig adapter is Feed plus URI, so its session set is now BOTH (it was FEED). That is the set a production boot publishes with both drivers.

Results on the committed tree at 036034f:

  • The app crate's lib tests without hostsim (make test-crate C=app), each by name: a_composed_uri_driver_is_published_with_its_resolver, a_refused_uri_install_publishes_neither_the_driver_nor_a_resolver and a_controlled_boot_composes_no_uri_driver_and_no_resolver, each test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1503 filtered out
  • make test-hostsim T=uri_boot: test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 1725 filtered out
  • make test-hostsim T=the_desktop_platform_composes_the_feed_and_no_resolver: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1753 filtered out
  • make check-nodef PLAYBACK_BACKENDS=feed: exit 0
  • The four static gates are green.

Results on b951d2a, the head before the test-only fix commit:

  • make test-crate C=plx_media: test result: ok. 2159 passed; 0 failed; 104 ignored; 0 measured; 0 filtered out
  • Full make test-hostsim, without two tests that kill the test binary (SIGSEGV) on the lane's Mac at base 8f55751 as well: 1750 passed, 2 failed. The two failures were in deeplink_route_tests, which passed on rerun: test result: ok. 9 passed; 0 failed.
  • make check-nodef PLAYBACK_BACKENDS=both|uri|feed|none: all four compile.
  • make check-replay: 6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0
  • ci/test_readonly_generated.py (22 tests) and ci/test_readonly_dependencies.py (64 tests) pass.
  • No Cargo, .cargo or certificate-pinned file changes. Both spellings of every touched path were checked against ci/proofs/*.json.

Reviews

  • fw-compat-reviewer on b951d2a found nothing. CI's firmware load matrix passes on all 9 gated releases, from 4.4.2 to 11.2.0. The binary still has 15 DT_NEEDED entries and 371 undefined symbols, as at base. acb_init still runs before ffi::boot() inside the same if !controlled, and no FFI, link directive or dynlib! changes.
  • doc-claim-auditor found three stale claims, all fixed.

On the television

On the dev TV (webOS 4.x, ACB), --guest --mock, base 8f55751 against b951d2a. Both binaries were md5-verified on the set. No key was sent and no setting changed.

  • Boot. These lines are identical and in the same main-thread order on both: vplane: ACB (webOS 4.x), ptype=10, the acb initialize/create/handle=feed lines, ff: bound …, uri: product binding=Acb mode=1 … and uri: display path=acb ready. Head adds compose: backends=uri+feed resolver=yes once, right after the display-path line. Neither build logs an installation-refused line.
  • Feed. pipe_h264_aac_mp4 passes on both: feed: presented, 24.1 fps, dropped=0.
  • URI. pipe_uri_product_hls_720p24_20m_bound passes all 10 checks on both, including uri_plane_bound, uri_presented and uri_service_playing.
  • …_bound_collapse fails identically on base and head. The check is uri_drain_warning: buffered lead fell 3 -> 2 …. This change does not cause it.
  • One line moves. The identity line, pms: server 0 version=…, comes before vplane: on base and after ptype=10 on head, 4 of 4 boots each way, including an interleaved repeat. That line comes from the serverinfo worker thread, not the main thread, so its position is a race; nothing at that point reads the version. The main thread's own order does not change.
  • The TV ran on b951d2a. The commit after it, 036034f, changes tests and one test-only cfg.

Not covered

  • check-nodef only compiles. The single-backend shapes (uri, feed, none) are not built as tests or run anywhere in CI.

🤖 Generated with Claude Code

GLinnik21 and others added 4 commits November 20, 2026 15:59
… once

Platform gains a MediaBoot: early_init runs at the old acb_init line, before the first adapter,
and compose installs the platform's drivers on the adapter and returns a Composition, the
resolver and nothing else. Compose takes no session and publishes nothing. The boot then calls one
function, publish_composition, which gives the route session the resolver and then the set the
adapter's installed drivers form, every boot, a zero-driver platform included, and logs one
"compose: backends=<set> resolver=<yes|no>" line. The set and the resolver can no longer
disagree: a refused URI install returns no resolver, and the adapter holds no URI driver.

The webOS port fills the table with backends::acb_init and backends::compose_native; the
desktop installs the Feed over the host sink and no URI driver, with a no-op early_init; the
host-test platform composes nothing. The bodies stay in adapters/backends.rs until W11a: dev and
the tests name UriProduct and its siblings, and the layer fence forbids them naming port.
compose_backends is gone, split into compose_feed (shared), compose_native and the
compose_with core the host rig drives over its own ports. install_uri_product(_with_ports) now
return the resolver instead of writing it into a session.

The ten play-uri gates in playback.rs and run.rs that only read what the installed drivers do
at run time are removed; the 41 that name ACB or the URI product stay. install_uri_preflight_port
takes a bare port or an Option, and the session has a reader for it.

The 18 URI boot rig tests now publish through the same function as the boot instead of
installing the resolver by hand; none changed its outcome. New tests cover a composed URI
driver, a refused install, a controlled boot and a platform that composed nothing, each
asserting the session's set and resolver agree.

Co-Authored-By: Claude <noreply@anthropic.com>
…ollows the desktop change

A platform that composed no URI driver returns Composition::default(). The NONE constant was
read only by the simulator's platform, so a television build that does not compile the simulator
saw it as dead code and refused to build. Three sentences that the desktop change made false are
corrected: the module-layers note that every play-uri build resolves the URI media pipe at boot,
the desktop DISPLAY constant's note about a plane boot the simulator no longer runs, and the
per-file counts of the play-uri sites that remain.

Co-Authored-By: Claude <noreply@anthropic.com>
…ition tests run the production seams

`install_and_publish_uri_product` is used only by the lifecycle rig, which `run.rs` builds under
`hostsim` and `play-feed`; a plain lib-test build found it dead. It carries the rig's own cfg now.

The success and controlled composition tests ran an injected installer, so after the move no test
reached `compose_native`, `install_uri_product` (with the refusal line that moved into it) or the
desktop's `media_compose`. The two tests call `compose_native`, as the base test called
`compose_backends`; the desktop's shape is asserted through `PLATFORM.media.compose` in
`platform_desktop.rs`, where it used to be a copy of that function's body; `compose_with` keeps the
refused-install case, the one outcome that needs an injected failure.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…orm/w6b-media-composition

`Platform` keeps its `media` field and `Services` keeps #1488's `storage: StorageHooks` group (webOS
`Helper`, the desktop `NONE`). `platform_desktop.rs` conflicted in its test module only: both the
storage pin test and the display test (with this branch's doc, since the desktop no longer runs the
plane boot) stay, beside the new `media.compose` test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@GLinnik21
GLinnik21 merged commit f7038a8 into main Nov 20, 2026
14 checks passed
@GLinnik21
GLinnik21 deleted the platform/w6b-media-composition branch November 20, 2026 14:31
GLinnik21 added a commit that referenced this pull request Nov 20, 2026
…is the platform's (#1492)

Step W5c of the platform plan (discussion #1460). Pointer and wheel input now reach the loop as `HostEvent`s, as keys and text did in W5b (#1487). The Magic Remote's cursor hide moves behind the platform's `Shell`. webOS hides and shows the pointer exactly as before. The desktop and the host-test platform hide nothing, which is what the simulator already did.

## What changes
- **`HostEvent::Pointer { x: f32, y: f32, edge: PointerEdge }`**, where `PointerEdge` is `Move`, `Down` or `Up`, and **`HostEvent::Wheel { dy: i32 }`**.
  - `decode_host_event` (`app/events.rs`) maps `SDL_MOUSEMOTION`, `SDL_MOUSEBUTTONDOWN` and `SDL_MOUSEBUTTONUP` to `Pointer`, and `SDL_MOUSEWHEEL` to `Wheel`.
  - x and y are logical coordinates, from `plx_base::surface::to_logical`. At 1920x1080 that is the identity. Because they are floats, `HostEvent` keeps `PartialEq` but loses `Eq`.
  - `decode_wheel_dy` keeps the existing wheel-offset handling and its comment. Under hostsim it reads the float at +32 and rounds it; otherwise it reads the `Sint32` at +20.
- **The plan proposed `Pointer { x, y, buttons, shown }`. This lands without `buttons` and `shown`:**
  - The loop never read which button was pressed: the edge is the SDL event type alone, whatever the button. `the_edge_is_the_event_type_whatever_the_button_bytes_say` pins that.
  - Whether the pointer is shown is the pointer machine's own `cur_hidden`, not event data.
- **`ingest_host_event`** (`app/run.rs`) handles both events through `ingest_pointer_{motion,down,up}` and `ingest_wheel`. Effect order, the recorder rows (`enc_pointer`, and `("wheel", 0, dy)` after the 250 ms debounce) and the drop of real input under a controlled replay do not change.
- **The cursor hide.** `app/boot.rs` gives up `hide_cursor`, `cursor_is_transparent`, `show_cursor_after_motion`, `hide_through`, `show_through`, `SHOWN_CURSOR`, `CursorDoor` and `cursor_door` to `rust-modules/src/system.rs`. `system` already sits in `[platform webos]`, so no module is added.
  - `Shell` gains `hide_pointer`, `show_pointer_after_motion` and `hide_is_cursor_swap`.
  - `WebosShell` forwards each one to `system`. `DesktopShell` and `HostShell` are no-ops and answer `hide_is_cursor_swap` false. A test-only `SwapShell` counts its calls and says true.
  - Callers in `input.rs`, `playback.rs` (through a new `Bridge::shell()`) and `run.rs` reach the hide through the shell.
  - Apart from the cfg lines, the television's code paths are unchanged. The hostsim gates and arms are gone, the three wrappers are safe `fn`s, and `wl_sym` is renamed `self_sym`.
  - `SHOWN_CURSOR` moves with no new ledger line.
  - `boot.rs` keeps the pre-`SDL_Init` cursor sleep hint (`webos3_cursor_sleep_hint`, `cursor_sleep_hint`, its own `self_sym`) and its source-order pins.
- **`feature = "hostsim"` occurrences.** The ones on the moved cursor functions go from 13 to 0. Across the touched files the count goes from 99 to 89:

  | file | before | after |
  |---|---|---|
  | `boot.rs` | 52 | 39 |
  | `run.rs` | 27 | 26 |
  | `events.rs` | 8 | 12 |

  `events.rs` rises by one production `cfg!` in `decode_wheel_dy` and three test-only gates.
- **Carried from #1487's review:**
  - The `press()` helper's vacuous `armed` assertions now observe the real press with `is_live`, with a direction-key control.
  - The "minted by `plex_run`" prose is fixed. The main-thread token is minted in `enter_application`. The fix covers `base/src/task.rs`, `media/src/player/{adapter,mod}.rs`, `dev.rs`, `docs/async-model-decision.md`, `docs/agent-reference.md` and `docs/remote-keys.md`.
  - The `docs/agent-reference.md` fuzz wording is fixed.

## Tests
- **Decode:**
  - `pointer_event_tests`: the edge and position; the edge ignoring the button bytes; the synthesized bytes round-tripping; the wheel offset at +20; the FIFO token's television-shaped wheel decoding to 0 under hostsim; and, under hostsim, a fractional trackpad tick rounding to whole ticks.
  - `host_event_tests`.
- **The loop** (`lifecycle_regression_tests`, hostsim):
  - pointer and wheel take the paths their SDL events took;
  - the D-pad motion gate;
  - OK-as-click under a cursor swap, and its button-up;
  - the D-pad hiding the pointer through the shell, and a motion showing it again;
  - the recorder rows;
  - the wheel FIFO token;
  - the controlled-replay drop.
- **The hide door:**
  - `system::cursor_door_tests`, five tests, not gated;
  - `input::pointer_hide_tests`;
  - the shells' own tests in `platform.rs` and `platform_desktop.rs`.
- **Mutations.** 21 mutants were applied one at a time, and each was killed by the test aimed at it.
  - No mutant exists for the three one-line `WebosShell` forwards or for the `sync_back_cursor` call in `playback.rs`, because the host cannot observe them.
  - Three more call sites are moved verbatim but no test guards them:
    - the idle-over-video hide in `run.rs`'s `playback_tick` (`shell.hide_pointer()` after 3000 ms without motion);
    - `host_background`'s `sync_back_cursor`;
    - `controlled_key_input`'s `note_cursor_motion`.

    `SwapShell` could now observe them, but no test drives those paths on it. Deleting any one of them fails no test.

Results on the committed tree at 17d0574, after merging main at f7038a8 (W6b #1489, which contains #1488 and #1490):
- Full hostsim suite, without the two tests that kill the test binary on the lane's Mac at base too: `test result: ok. 1781 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out`
- Default-feature suite, the same way: `test result: ok. 1514 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out`
- `make test-hostsim T=uri_boot`: `test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 1754 filtered out`
- `make test-crate C=plxnative-modules`:
  - `T=port::tests`: `test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1513 filtered out`
  - `T=pointer`: `test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 1497 filtered out`
  - `T=cursor_door`: `test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 1510 filtered out`
- `make check-nodef`: exit 0. `make lint` was exit 0 on b7ec914; the only edit since the merge is a test-only line.
- `make check-replay`: `6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0`
- The merge needed one fix: `SwapShell::platform()` passes `MediaBoot::HOST_TEST` to W6b's four-argument `Platform::new`. `the_host_test_platform_answers_nothing_and_says_so` destructures all four `Platform` fields.

Results on b0ad245, before the merge:
- Full hostsim suite, without the two tests that kill the test binary on the lane's Mac at base too: `test result: ok. 1774 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out`
  - The skipped tests are `player_owner_events_record_and_replay_through_the_actual_app_host` and `an_unregistered_product_screen_uses_generic_navigation_and_actual_store_effects`.
- Default-feature suite, the same way: `test result: ok. 1509 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out`
- `make check-replay`: `6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0`
- `tests/keytable.json` is unchanged.
- `ci/check-deps.sh`, `ci/check-module-layers.py`, `ci/check-ledger-ratchet.py` and `ci/check-statics.sh` are green.
- `ci/test_readonly_generated.py` and `ci/test_readonly_dependencies.py` pass.
- No change under `ci/`, to any Cargo file or `.cargo`, or to `rust-modules/src/lib.rs`.
- `fw-compat-reviewer`: no findings. It graded the source only. The same `SDL_*` symbols are looked up in the same order, with the same hide method per firmware release. The 3.x releases sit below the graded floor.
- `doc-claim-auditor`: five findings, all fixed.

## Not covered
- **No television run.** Not checked on a set: the pointer hide and show on a 3.x set against a 4.5+ set, the `WebosShell` forwards, and the Back sync in `playback.rs`.
- **The `wheel:<dy>` FIFO token.** It builds the television's +20 layout, so under hostsim it decodes to 0. This was already true before this PR, and a test now pins it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant