Skip to content

The simulator runs on its own platform - #1486

Merged
GLinnik21 merged 5 commits into
mainfrom
platform/w4-desktop-platform
Nov 20, 2026
Merged

GLinnik21 merged 5 commits into
mainfrom
platform/w4-desktop-platform

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Step W4 of the platform plan (discussion #1460): the simulator becomes its own platform. It no longer runs the television's service tables through hostsim arms in system.rs, port.rs, webos*.rs and keymanager.rs. A new platform_desktop supplies its own tv::Services, Shell and FrameProbe. The television's code is now always compiled, and the linker strips it from the simulator because nothing reaches it. webOS is unchanged, and the simulator boots to Home with its replay fixtures identical.

What changes

  • src/platform_desktop.rs (new, [platform desktop] in ci/module-layers.ini) never names port, system, webos or keymanager.

    • Services:
      • The named NONE groups for the hooks a desktop host has nothing for: probe_device, repair_native_video, device_files, system_locale, sound_output, poll_home, uri_media, and all of secure (SecureHooks::NONE, mode: Durable). Before, the simulator ran the webOS bodies of some of these, and they failed or answered nothing on a Mac. The visible differences are listed below.
      • Its own bodies for the hooks the simulator really ran:
        • start_capability_probe, which publishes the DV probe (ProbeSource::Host);
        • go_home, which keeps both log lines verbatim, with no worker thread and no trigger legs;
        • deliver_toast (Sent{None, NoBus}, "no system notifications on this host");
        • sink/display_sink (HOST_SINK under play-feed, else NoSink, as before).
    • Shell and FrameProbe are explicit no-ops. The entry installs no activator and no clear probe.
    • Its entry run(&CStr, u16) -> c_int returns the code. bin/sim.rs, already an allowed exit_now owner, ends the process. The run_application returns its exit; only the executable entry ends the process #1479 scan and its owner list are unedited.
  • The fence falls from 102 lines to 0. These are the lines naming feature = "hostsim" in system.rs, port.rs, os/webos.rs, os/webos/{caps,toast,jail_repair}.rs, os/keymanager.rs and os/webos/video_sink.rs. Per file, base to head: 53→0, 7→0, 22→0, 8→0, 5→0, 5→0, 2→0, 0→0.

    • The 77 negated television gates lose their hostsim term.
    • Of the 25 positive ones:
      • 5 move to platform_desktop.rs: the two SINK arms, the two opaque-region stubs and the sink table's test.
      • 9 stand-ins are gated any(test, feature = "test-support"), which test builds use, and port.rs's DISPLAY becomes cfg(test).
      • 6 frame-probe stubs are gated not(devtriggers).
      • 4 are attributes or statements.
  • The dev-trigger DV override (dvcaps0/dvcaps1, the precedence and the publish-with-log line) moves from webos/caps.rs to the neutral os/src/devcaps/dv.rs. The webOS probe and the desktop probe both end in it, so the simulator keeps the triggers and the webos-caps line without a copy.

  • CI:

    • simulators.yml's macOS job gains "Link the macOS app's feature set": --no-default-features --features hostsim,play-feed, in debug, the harder dead-strip case, in its own target-sim-ci-macapp. Its comment says it guards the dead-strip reliance until W7 takes webos out of the desktop build.
    • ci/test_sim_backend.py holds simulators.yml to its play-feed rule.
    • The stale ci.yml comment saying nothing else compiles the simulator feature set now names what does.
    • ci/check-deps.sh's sink rule follows the moved arms.
    • .gitignore gains rust-modules/target-sim-ci*/.
  • Prose that put the simulator on the television's tables or on port::plex_run now says it has its own platform:

    • docs/module-layers.md (the L15-L15d cells, L15b item 2, the sink rule, the entry, and what hostsim selects now);
    • docs/agent-reference.md;
    • docs/macos-app.md, ci/mkmacapp.py;
    • fuzz/Cargo.toml;
    • app/mod.rs, app/boot.rs and os/src/tv.rs.

    rust-modules/Cargo.toml's hostsim comment stays as it was, although it still lists "the wayland/glib calls that have no host equivalent". The ci/proofs certificates pin that file byte for byte, so it is not edited here. docs/module-layers.md says what the feature selects now and notes the stale comment, which W7 rewords when it re-seals. fuzz/Cargo.toml lies outside the certified workspace and is corrected here.

    • os/src/webos.rs, play-feed/src/ffi_host.rs, app/adapters/{backends,hostsim}.rs, app/exit.rs.

No ledger line, and ci/allow/layers.txt stays empty. No new App field.

What the simulator now does differently

Nothing in tests/, tools/, ci/, .agents/ or the replay fixtures reads any of these, and check-replay is unchanged. Older simulator logs such as docs/measurements/offline-picker-sim-{green,kid,nocache}-2026-09-06.log still show the removed lines.

  • The device probe (probe_device NONE). The simulator ran the webOS probe. It logged three lines that are now gone:

    • webos: /var/run/nyx/os_info.json unreadable (…) — version unknown;
    • webos: …/device_info.json unreadable (…) — model/board unknown;
    • devjail: soc= rtkmem=n/a.

    It also published Probe{Unreadable, Unreadable}, so the simulator's Sentry probe context now reads unprobed/unprobed where it read unreadable/unreadable.

  • The surface grab (grab_surface no-op). The webOS shell's grab logged FB bits: … and wm sdl=… subsys=0 … on the simulator, and recorded the wm_query crash step. Desktop does none of this.

  • Device files (Files::NONE). The first devcaps: line's error text changes:

    • before: devcaps: /etc/umediaserver/device_codec_capability_config.json unreadable (No such file or directory (os error 2)) — assuming the 49SM9000PLA profile
    • after: … unreadable (entity not found) — assuming the 49SM9000PLA profile
  • The secure store (SecureHooks::NONE). The keymanager stand-in logged session protection: no usable key manager; using the 0600 file fallback at sign-in, and that line is gone. A sign-in through the mock plex.tv still stores the plaintext session in state/session.json with no sealed key, as the harnesses (tests/controlled_bootstrap.py, tests/playback_navigation_sim.py, tools/hud_preview.py) expect.

  • Toasts. The line reads toast: no system notifications on this host — … where it read toast: no LS2 bus off-device — {identity} call to luna://com.webos.notification/createToast not sent. The outcome is the same: Sent{None, NoBus}.

  • The DV capability probe. It runs synchronously on the main thread, with no dv-caps-probe worker. It answers unknown at once (webos-caps: … answer=unknown stage=host, the same line as before), and the dvcaps0/dvcaps1 dev triggers still apply.

  • Native-video repair. It answers Failure::Unsupported directly. Before, the simulator reached the same answer through validated_install, which rejects any directory that is not an on-device install path.

  • The plxnative-gohome trigger is not read on desktop. go_home logs gohome: request mode=auto, then the no-LS2-bus line, as before.

  • X-Plex-Platform. Desktop publishes no Platform, so it stays the webOS default the simulator sent before. Changing it is not this PR's job.

Tests

Base d166f5fcb against head, on the committed tree:

Suite Base Head
app hostsim (the built binary, with the two macOS-only no-GL SIGSEGV tests skipped) test result: ok. 1726 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out test result: ok. 1726 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out
make test-hostsim C=plx_media test result: ok. 2478 passed; 0 failed; 104 ignored; 0 measured; 0 filtered out test result: ok. 2478 passed; 0 failed; 104 ignored; 0 measured; 0 filtered out
make test-crate C=plx_os test result: ok. 460 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out test result: ok. 460 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  • Discovered tests (--list), base against head: app 1728/1728, media 2582/2582, plx_os 460/460. No test was lost. Two moved with their code: port::tests::the_simulator_port_display_is_the_host_sink_the_acb_init_reads is now under platform_desktop::tests, and webos::caps::tests::dv_caps_override_precedence is now devcaps::dv::tests::dv_caps_override_precedence.
  • make check-replay: 6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0.
  • make sim-macos-shot against tests/mock_pms.py reaches Home.
  • make macapp builds: arm64, 11 bundled libraries, signature ok.
  • Links:
    • make sim-macos and the macapp feature set link locally in release and debug.
    • nm -u shows no Wayland, LS2, ACB, Starfish or luna symbol in any simulator binary or in the app.
    • On the first push, simulators.yml's Linux and macOS jobs (--gc-sections and -dead_strip) were green.
  • Python and static gates: ci.test_sim_backend (3), ci.test_test_crate (13), ci.test_platform_axis (22) and tests/test_harness.py DepGates (91) passed. ci/check-module-layers.py, ci/check-ledger-ratchet.py, ci/check-statics.sh and ci/check-deps.sh are green.
  • fw-compat-reviewer: SAFE.
    • plx_launch_args and acb_on_event are still not exported.
    • The television's tables (port, system, webos, keymanager) contribute 0 symbols to the macOS binary.
    • Residual risk: a future desktop path into a television arm would link silently against desktop SDL. The new link step guards the link, and W7's crate split removes the reliance.
  • doc-claim-auditor: its 11 findings are fixed, except the pinned rust-modules/Cargo.toml comment described above.
  • make check-python-rest (all 145 steps, including the certificate gates ci/test_readonly_generated.py, ci/test_readonly_dependencies.py and ci/check-machine-shape.py) is all ok on the final head.

Not run here: make check, check-nodef, the ARM cross-build and the fuzz link. This PR's own CI gates them, and fuzz.yml runs because fuzz/Cargo.toml changed.

build-bench

make build-bench ARGS='--only noop,leaf,app --runs 3', base d166f5fcbac0 then head 3069d8f53c82, run one at a time under the exclusive lock. M4, 10 cores, rustc 1.100.0.

Scenario Base median (min–max) Head median (min–max)
No-op host test build 0.1 s (0.1–11.5 s) 0.1 s (0.1–4.5 s)
Edit leaf (plx_base cbuf.rs), non-incremental 42.9 s (38.2–49.8 s) 48.0 s (44.7–48.2 s)
Edit leaf (app coldstart.rs), non-incremental 15.6 s (15.1–17.1 s) 15.0 s (14.9–18.6 s)
  • The unit counts match: 35/190 rebuilt for the plx_base row and 1/190 for the app row.
  • The plx_base gap is inside the base's own spread. Head ran straight after base, with load average 5.1 at its start.
  • The no-op max is the first-round warm-up.

🤖 Generated with Claude Code

GLinnik21 and others added 3 commits November 20, 2026 13:35
…always compiled

The simulator and the macOS app are no longer the webOS port with its answers faked. A new module,
`platform_desktop`, states every hook the application reads from its platform: the shared NONE groups
of `plx_os::tv` wherever a host has nothing to say (the key manager, the settings service, the
device files, the URI media pipe), the Feed backend's host sink when the build has one, and its own
bodies for the three things a host does answer: the capability probe, the root press and the toast.
`src/bin/sim.rs` names it, so a desktop executable no longer references the television's tables.

With nothing on a desktop reaching them, the `hostsim` term leaves all 102 fenced cfg lines in
`system.rs`, `port.rs`, `webos.rs`, `webos/{caps,toast,jail_repair}.rs` and `keymanager.rs`. The
television's arms are now compiled into every build, the simulator's included, and the linker drops
what nothing reaches. The stand-ins that tests rely on stay, gated on `test` and `test-support`.
The frame-probe stubs are re-gated on `devtriggers` alone, and the simulator's two opaque-region
stubs and its `SINK` arms move to the desktop platform.

The dev triggers that force the Dolby Vision answer (`dvcaps0`, `dvcaps1`) and the probe's one log
line move from `webos::caps` into the neutral `devcaps::dv`, which the webOS probe and the desktop
probe both end in, so the simulator keeps both without a copy.

`ci/module-layers.ini` places `platform_desktop` and adds its `[platform desktop]` section, and
`ci/check-deps.sh`'s sink rule follows the moved sink arms.

Co-Authored-By: Claude <noreply@anthropic.com>
…op platform

The simulator's television code is now compiled in every build and only the linker keeps it out
of the executable, so the macOS simulator job links the shape `make macapp` ships
(`--no-default-features --features hostsim,play-feed`, in debug, in its own target tree) and says
why: it guards the dead-strip reliance until the platform crates split. `ci/test_sim_backend.py`
scans `simulators.yml` for the same `play-feed` rule it holds for the other simulator builds.

`ci.yml`'s comment that nothing else compiles the simulator feature set was stale before this
change; it now names what does. `.gitignore` lists the `target-sim-ci*` trees that job builds
into, and the `ci/mkmacapp.py`, `ci/test_sim_backend.py` and `docs/macos-app.md` prose names the
desktop platform where it said the simulator swaps the television's sink in.

Co-Authored-By: Claude <noreply@anthropic.com>
…t has its own platform

`docs/module-layers.md` told a reader that the simulator runs the same `port.rs` tables with
`hostsim` arms, that the stand-ins in `webos` and `keymanager` are what it executes, that it
enters through `port::plex_run`, and that W4 was planned. Each of those is now the other way
round, so the L15 to L15d status cells, the L15b item 2 paragraph, the sink rule's path list and
the entry description follow `platform_desktop`.

The same claim sat in `app/exit.rs`, `play-feed`'s `ffi_host`, `app/adapters/{hostsim,backends}.rs`,
four comments of `webos.rs` that put the simulator on the webOS probe, the `hostsim` feature's
comment in `rust-modules/Cargo.toml`, and the fuzz package's account of why `hostsim` is the one
configuration a host executable links: the television's externs are compiled in every build now and
only the linker keeps them out, which those lines say instead.

Co-Authored-By: Claude <noreply@anthropic.com>
@GLinnik21
GLinnik21 marked this pull request as ready for review November 20, 2026 11:34
GLinnik21 and others added 2 commits November 20, 2026 14:40
…ndency certificate pins them

The previous commit reworded a comment in `rust-modules/Cargo.toml` (the `hostsim` feature) and two in
`fuzz/Cargo.toml`. `ci/readonly_generated.py` reads the certificate under `ci/proofs/` and pins every
`Cargo.toml`, `Cargo.lock` and `.cargo` config byte for byte, so those three comments turned
`make check-python-rest` red (`check-machine-shape.py`, `test_check_machine_shape.py`,
`test_transition_arguments.py`, `test_readonly_dependencies.py`). A comment is not worth a certificate
review, so both files return to the bytes `main` has, and the certificate is not re-sealed.

Those comments therefore still say, for now, that `hostsim` is the only configuration a host executable
can link because the television build declares symbols only the television's own libraries define, and
that the feature switches the wayland and glib calls. The television's arms are compiled into every
build today and only the linker keeps them out. The platform crates' split changes both files and
re-seals the certificate, and rewords them then.

Co-Authored-By: Claude <noreply@anthropic.com>
…e old `hostsim` arms now names both entries

`app/mod.rs` (the module doc and two comments) and `app/boot.rs` said the entry that ends the process is
`port::plex_run`. That is the television's; the desktop executable ends it in `src/bin/sim.rs` after
`platform_desktop::run`, and each of those lines now names both. `Services::HOST_TEST`'s comment in
`os/src/tv.rs` called the arm it replaced `cfg(any(hostsim, test))`; the arm is
`cfg(any(test, feature = "test-support"))`.

`fuzz/Cargo.toml` is not a member of the certified workspace, so its two comments get the wording the
last commit gave them before the certificate forced it back: `hostsim` selects the host configuration of
the layers below, the television's declarations are compiled in every build, and the linker keeps them
out of a host executable. The fuzz package does not depend on `plxnative-modules`, so it no longer lists
the desktop platform among what `hostsim` selects. `ci/test_readonly_dependencies.py` and
`ci/test_readonly_generated.py` pass with the edit.

`rust-modules/Cargo.toml`'s comment on `hostsim` stays as it is, because the certificate pins that file;
`docs/module-layers.md` says in the L15b item 2 paragraph what `hostsim` selects now, that the
television's wayland and glib calls are compiled either way and dropped by the linker, and that W7
rewords the comment when it re-seals.

Co-Authored-By: Claude <noreply@anthropic.com>
@GLinnik21
GLinnik21 merged commit 8f55751 into main Nov 20, 2026
15 checks passed
@GLinnik21
GLinnik21 deleted the platform/w4-desktop-platform branch November 20, 2026 12:28
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