Skip to content

plex's session persistence reads the platform's storage authority instead of the build's CPU - #1491

Merged
GLinnik21 merged 11 commits into
mainfrom
platform/w8a-plex
Nov 20, 2026
Merged

GLinnik21 merged 11 commits into
mainfrom
platform/w8a-plex

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Part of step W8a of the platform plan (discussion #1460). plex's session persistence now follows the storage authority the platform states (#1488). Before, it was fenced by all(target_os = "linux", target_arch = "arm", not(feature = "hostsim"), not(any(test, feature = "test-support"))), which means "32-bit ARM Linux", not "a webOS television". webOS behaves as before. Every other platform keeps the files arm it already took. On x86_64, the Tizen emulator build's CPU, that fence was already false.

What changes

Counts in rust-modules/plex

before #1490 main, before this PR after
target_arch = "arm" 21 19 0
target_os = "linux" 21 19 0
feature = "hostsim" 21 19 0
ci/allow/forks/plex.txt lines 33 31 12

Tests

  • Fake-transport tests in migration_tests.rs drive the Helper arm on every host, with the authority passed as a parameter. There is no process-global override.
    • Positive Helper tests cover load and clear.
    • Write, migrate, commit and bootstrap are covered through an unavailable transport. The helper fake cannot accept a positive commit outside a device.
  • plx_plex lib tests went from 823 to 828.

Results on the committed tree at a637194, after merging main at 3923286:

  • make test-crate C=plx_plex: test result: ok. 828 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  • make test-crate C=plx_os T=tv: test result: ok. 79 passed; 0 failed; 0 ignored; 0 measured; 383 filtered out
  • make test-crate C=plxnative-modules T=port::tests: test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1501 filtered out
  • make test-crate C=plxnative-modules T=app::adapters::session: test result: ok. 35 passed; 0 failed; 0 ignored; 0 measured; 1468 filtered out
  • make test-crate C=plx_session T=auth: test result: ok. 353 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  • make test-hostsim T=app::adapters::session: test result: ok. 35 passed; 0 failed; 0 ignored; 0 measured; 1718 filtered out
  • make test-hostsim T=the_desktop_table_keeps_the_account_in_files: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1752 filtered out
  • make check-nodef: exit 0
  • ARM cargo check --target armv7-unknown-linux-gnueabi for plx_plex and for the app crate with play-uri,play-feed: both exit 0
  • 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 (22 tests) and ci/test_readonly_dependencies.py (64 tests) are OK.
  • No Cargo.toml, lock, .cargo or certificate-pinned source changes.

Prose left for one follow-up

The review found two stale sentences in prose this PR edits. Both are left for one docs PR, after a doc-claim audit of the whole W8a series (#1488, #1490, this PR):

Not covered

  • The television. The ARM evidence is a cargo check, so there is no link and no size figure. Both arms now compile into the ARM binary, so a small size change is possible and unmeasured.
    • The device check: on a --guest --mock boot, session: authority read reason=miss still appears, the identity line is unchanged, and no session.json appears under the state root.
  • Device-only paths. clear_for_erase's Helper branch has no transport seam, so it, and the telemetry sweep after a durable clear, run only on a device.
  • Read order. A read before run_application installs the services would see Files. The platform states where the account's records live: tv::Services.storage #1488's pin holds install_services() first in run_application. Nothing earlier that we found reads plex::session: port::plex_main's storage activator and clear probe, or main.c's crash and launch-argument entries. That was checked by reading the code, not by a test.

🤖 Generated with Claude Code

GLinnik21 and others added 11 commits November 20, 2026 15:59
…orage

The session, the install's preferences and the consent record live in the LS2/DB8 storage helper
on a webOS television and in files everywhere else. The persistence layers chose between the two
with `all(target_os = "linux", target_arch = "arm", not(feature = "hostsim"), not(any(test,
feature = "test-support")))`, which is "32-bit ARM Linux", not "a television": a Tizen ARM build
would select the helper with none behind it.

`tv::Services` gains a fifth group, `storage: StorageHooks { authority }`, in the new
`os/src/tv/authority.rs`. `Authority::Helper` is webOS (`port.rs`); `Authority::Files` is the
desktop platform, `Services::HOST_TEST` and any platform with no helper (`StorageHooks::NONE`).
`tv::authority::authority()` reads the installed table, and an uninstalled process reads `Files`
like every other group's host-test answer. There is deliberately no test override: the layers that
read it take the authority as a parameter, so a test passes whichever one it grades.

Nothing reads the value yet; the plex and telemetry lanes re-key their fences to it next. Tests pin
the host-test answer in the destructuring test of `tv.rs`, the webOS and desktop tables, and the
order `run_application` installs the services before it enters the application: an uninstalled
television would read `Files` and write a plaintext session file.

Co-Authored-By: Claude <noreply@anthropic.com>
…ad of the build's CPU

The session record, the install's preferences and the sign-out sweep chose between the LS2/DB8
storage helper and the record files with `all(target_os = "linux", target_arch = "arm",
not(feature = "hostsim"), not(any(test, feature = "test-support")))`: "32-bit ARM Linux", not "a
television". A Tizen ARM build would have selected the helper with none behind it, and the helper's
real transport waits 12 s on a Linux host before it answers `Unavailable`. The 21 sites now read
`plx_os::tv::authority::authority()` (webOS states `Helper`; the desktop, a host test and a platform
with no helper state `Files`).

`persistence.rs`'s dispatchers (`load`, `commit_data`, `commit_cleared`, `write_session`,
`migrate_session`, `bootstrap`, `cleanup_after_confirmed_clear`, `cleanup_temporaries`) keep their
public signatures and read the authority once, then call a `*_via(authority, helper, ..)` form that
takes the authority and the helper's transport as parameters. The helper arm therefore runs on every
host over an in-memory backend or a closure, and the files arm over a transport that fails the test if
it is touched; there is no process-global override. The previous canonical JSON wrapper is a migration
source only under `Helper` (`migration_candidates`, replacing `insert_arm_canonical_wrapper`); under
`Files` it is the store itself. `FileMigration` calls the file arms directly. The private
`load_helper`, `commit_session`, `commit_clear` and the unused `commit_session_with_authority` are
gone with the only cfg arm that called them.

In `session.rs` the `ACCOUNT_CLEAR_CLEANUP` hook and its installer are compiled everywhere, and
`clear_for_erase` runs the telemetry sweep only under `Helper`: an unset hook still reads as retired,
so `app/boot.rs` and telemetry follow in their own changes. `install_preferences` asks
`keeps_language_file(authority, mode, redirected)`, the same expression with the same answer under
every authority and mode that existed.

`ci/allow/forks/plex.txt` falls from 33 lines to 12 (deleted lines only). The `hostsim` feature stays
declared in plex's `Cargo.toml` until W8c; nothing in plex reads it any more.

Co-Authored-By: Claude <noreply@anthropic.com>
… what reads it

`session_persistence_tests.rs` described the migration-candidate set as "plus the pre-DB8 canonical
JSON wrapper on ARM", and `docs/platform-ports.md` F44 said `install_preferences::candidates` and
`clear_for_erase` key on the ARM cfg and that the ARM canonical write is cfg'd out of host tests. Both
are the pre-W8a state: plex reads `tv::authority::authority()`, and the helper arm is the one every
host runs over a fake transport.

Co-Authored-By: Claude <noreply@anthropic.com>
… a television, and the order pin is exact

Review of the foundation found three things the first commit got wrong or left weak.

On webOS the helper is the canonical store, but the app's own files are not absent there: the session
layer writes a marked fallback (`save_legacy_fallback_locked`) whenever a commit to the helper is not
durable, serves it as transient state while the helper cannot answer (`read_legacy_filtered_locked`),
and the legacy files an older build left are migration inputs. `tv::authority`'s module doc and the
`Helper` variant said no file is ever written and a helper outage is never papered over; they now say
what the code does. The platform-ports bullet follows.

The order pin in `port.rs` asserted only that the install precedes `exit::entry`. It now asserts that
`platform.install_services();` is `run_application`'s first non-comment statement, counts the call and
`tv::install(` across every source file of the application crate (not just `app/mod.rs`), and fails
when a statement is inserted above the install, when a second call is added, and when `tv::install` is
called a second time. Each of those three mutations was run and fails for its own assertion.

`authority.rs` and the `port.rs` test docs spoke as if a reader of the value already existed. They now
state what the value says and what it is for.

Co-Authored-By: Claude <noreply@anthropic.com>
Under the storage helper the persistence dispatchers never answer from the
canonical record files, but session.rs keeps its marked fallback (written when a
commit is not durable, served as transient while the helper is down) and the
legacy migration inputs, exactly as before. The module guide and the helper-down
test said no file is ever used; they now say what the dispatcher layer does and
name the fallback as the one file a television writes beside DB8. The test is
renamed to match: a_helper_authority_never_answers_from_the_record_files_when_
the_helper_cannot_answer.

Co-Authored-By: Claude <noreply@anthropic.com>
… the mode that decides first

Under the storage helper a sign-out whose helper clear is not durable also writes
the install-preferences file (an unmarked language.json beside a session
candidate, read back into the Locked and Cleared states), so the app's own files
there are three kinds, not two. And the authority is not the whole answer for the
session record: secure::mode() decides it first, so under MemoryOnly (where Tizen
starts) the session lives in memory and no credential store is touched, whatever
the authority says. Prose only; no code changed.

Co-Authored-By: Claude <noreply@anthropic.com>
…d the mode read before the authority

The guide's storage-authority bullet named the marked fallback and the legacy
migration inputs. clear_for_erase also writes the install-preferences file when a
sign-out's helper clear is not durable, and secure::mode()'s MemoryOnly is read
before the authority; both are said now, to match the authority's own docs.

Co-Authored-By: Claude <noreply@anthropic.com>
…#1490)

#1490 ungated ACCOUNT_CLEAR_CLEANUP and install_account_clear_cleanup in
session.rs with the same text this branch carries, so that file merges without a
hunk. The forks ledger for plex keeps this branch's 12 lines: both PRs delete
the same two lines, and this one deletes the rest of its 21, so `# count: 12` is
the real line count after both.

Co-Authored-By: Claude <noreply@anthropic.com>
…real transport, and the test docs sit on their tests

The module doc and the plex guide said NativeTransport is only ever named by the
dispatchers' public forms. Two helpers with no _via seam name it too:
reset_cleared_language(), which clear_for_erase calls under the storage helper
and which only a device exercises, and helper_commit, which no longer has a
caller in this crate. Both sentences now say so. The paragraph about the shared
candidate assembly had been left above the temporaries test; it is back on
the_candidates_a_platform_searches_follow_its_authority, and the temporaries
test carries its own sentence. base::paths::persistent_state_root's doc said
"the canonical ARM adapter uses helper-owned DB8"; the choice is the platform's
statement, so it says that. Prose only; no code changed.

Co-Authored-By: Claude <noreply@anthropic.com>
@GLinnik21
GLinnik21 merged commit f78ce7d into main Nov 20, 2026
14 checks passed
@GLinnik21
GLinnik21 deleted the platform/w8a-plex branch November 20, 2026 14:45
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