Repository navigation
Rename the bottom layer crate plx_platform to plx_os - #1474
Merged
Merged
Conversation
`plx_platform` becomes `plx_os`, `rust-modules/platform/` becomes `rust-modules/os/`, the layer
`[platform]` becomes `[os]`, the fence keyword `[port X]` becomes `[platform X]` and `SRC_PLATFORM`
becomes `SRC_OS`. No behaviour change. The inner `tv` module stays.
The rewrite is `tools/rename-os-layer.py` (stdlib, run with -I), shipped for the open PRs and the
release lines that still carry the old names:
- forward (idempotent) and `--reverse`, which rewrites only the sites the forward pass writes;
- `--reverse-patch FILE`, the backport route: a post-rename `git diff` is rewritten hunk line by hunk
line (the enumerated sites are per file) so `git apply` accepts it on a line with the old names;
- `--check`: every old-name site in the three spellings (the package, the path incl. the bare
`platform/..` and `../platform` forms, the layer token) plus every enumerated literal site, and
every quoted "platform" in both quote styles is classified (a JSON key, a Sentry field,
sys.platform) or fails; a quoted platform in a list of layer names is never a keeper (the
report.rs and release-config-check.py lists, N1);
- `--equivalence BASE`: HEAD against script(BASE) and BASE against reverse(HEAD), allowing only
(a) the two certificates and their pin lines, (b) Cargo.lock as a sorted-line multiset,
(c) a .rs hunk with the same token multiset, (d) the tool, its test and its two lines in ci/check-python-steps.txt.
`ci/test_rename_os_layer.py` (16 cases, synthetic trees and a throwaway git repo) is wired into
`ci/check-python-steps.txt`. rustfmt was not run: there is no fmt gate and no line needed a reflow.
Cargo.lock: the script renames the package, then cargo (a plain `make test-crate`, offline) re-sorts
it: `plx_os` sorts before `plx_owp`, so that one package block moved above it. The lines are the
same multiset as origin/main's with plx_platform spelled plx_os, so no version moved (`--equivalence`
checks exactly that), and `cargo metadata --offline --locked` accepts the committed lock.
Certificate re-pins (both reviewed; every changed hash is a consequence of the rename):
ci/proofs/platform-generated-enums.json (keeps its name), pinned by ci/readonly_generated.py
CERTIFICATE_SHA256 1b3b34fa...6503 -> ac7a32d9...60c3
I18N_SOURCES[1] (the reviewed variant of os/src/i18n/mod.rs; its only change is the comment path
platform/build_support/catalog.rs) 2c978e3a...4d52 -> 7119e673...b463
changed: package, module, the key platform/ -> os/ for 5 sources and the manifest key; hashes of
os/Cargo.toml, os/src/lib.rs, os/src/i18n/mod.rs, build_support/install_identities.rs, the lock
and the manifests of the root, appkit, data, media, play-feed, play-uri, plex, screens, session,
storage, telemetry, ui and os. Unchanged: os/build.rs, os/build_support/catalog.rs, machine/*.
ci/proofs/serde-json-immutable.json (serde_json 1.0.154, archive checksum verified), pinned by
ci/readonly_dependencies.py
CERTIFICATE_SHA256 915ab64b...6540 -> dc193808...2fc4f
changed: lock_sha256, the same 13 manifest hashes and the manifest key platform -> os, and the
lib_sha256 of the owners os, data, media, net, play-feed, plex, session, storage and telemetry
(their lib files name the layer in a doc comment or a #[path]).
Verified here: `--check` 0 sites left; `--equivalence origin/main` ok; ci/test_rename_os_layer.py,
ci/test_readonly_{generated,dependencies}.py, test_module_graph, test_build_bench,
test_no_host_staticlib, test_storage_package_isolated, test_check_machine_shape, test_ci_split,
test_cargo_seed, check-module-layers (0 migration entries), check-list-caps, check-localization,
check-deps.sh (all green); cargo check --workspace --locked; make test-crate C=plx_os (442 passed).
Not run here: make check, check-nodef, the ARM cross-build, build-bench, a TV boot.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…/../platform"; --reverse-patch names its weak rewrites Two findings from the review of PR #1474, both in the tool and its test. --check: the old patterns needed `base platform` / `machine platform` or a quoted "platform", so `for c in net platform gfx`, `--only machine,platform` and `base -> platform -> ui` passed unseen, and the bare-path rule's lookbehind rejected a `/` before `../` (`"/../platform/src"`). BARE_OLD/NEW and UP_OLD/NEW now start after a `/` that directly precedes a `../`, and a new class, "3 layer token in a separator list", flags `platform` beside a layer name with a space, comma, `>` or `-` between them. Two hits on the head tree are not the layer and are named in SEP_KEEP (path + line regex + label): the Plex client-identification field list in docs/plex-api-design.md and the prose "machine, platform API" in session/src/auth/owner.rs. The class finds three real stale spellings the forward pass does not rewrite (docs/module-layers.md:112, docs/watchlist-plan.md:112, rust-modules/base/src/eventlog/scrub.rs:1079), so `--check` on this head reports 3 sites, not 0. They are not classified away; fixing them touches files outside this commit and is left to the PR's owner. --reverse-patch: a weak pattern (backticked `os`, a quoted "os" in a layer list, `base os`, `+ os machine base`, `os::member`, `os/` in a directory list) rewrote an `os` that may be the operating system back to `platform`, in every file outside NATURAL_OS, without a word. rewrite() takes weak=False to skip them; reverse_patch compares both ways per hunk line and prints every line the weak patterns changed to stderr as `file:line: old -> new` (new-side line, old-side for a `-` line), plus a count. Hunk line counts now decide what is a hunk line, so a removed `--- x` line is no longer read as a file header. Tests: one case for the check class (and `/../`), two for the report (weak lines named, strong-only patch silent); the shared runner swallows stderr. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…(graph row, two layer lists)
`--check`'s separator-list class found three places that still named the layer
`platform` and that no general rule reads: the layer graph's own row in
docs/module-layers.md (`os` keeps the `machine base` column where it was), the layer
list in docs/watchlist-plan.md ("base, machine, os. NOT net") and the comment above
the log-scan roots in rust-modules/base/src/eventlog/scrub.rs ("the machine, net, os,
gfx, ... layers"). Each is a per-file LITERALS entry in tools/rename-os-layer.py, so
the forward pass writes it, `--reverse` undoes it and `--check` flags the old text;
the three files are the script's output, not hand edits, and `--equivalence` holds.
One line changes in each file. None of the three is pinned by a certificate or a
`ci/readonly_*` digest.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…; --check sees a table cell and `platform layer/crate`
The re-review found two table cells that still said `platform` (docs/module-layers.md:121 and the layer
cell of docs/watchlist-plan.md:119). Rather than patch those two, every standalone `platform` or
`Platform` left in the tree (675 lines in 244 files, minus dated records, the tool and its test, the
platform-webos/-desktop/-tizen names, `plx_platform_*`, `[platform X]` and `app::Platform`) was read and
classified. 91 lines name the layer and are rewritten, each by a per-file LITERALS entry of
tools/rename-os-layer.py run by the script (the forward pass writes them, `--reverse` restores them
exactly, `--check` flags the old text). 584 lines are not the layer and stay: the Plex `X-Plex-Platform`
fields, the Sentry/manifest `"platform"` field, Python's `platform` module and `sys.platform`, TrueType
name-record platform ids, the webOS "platform release" in the release notes, the OpenAPI JSON key, the
dated records, and prose about the host or TV platform ("the platform bus", "a platform difference").
Eight more lines hold the layer's own constants (PLATFORM_LEAF, PLATFORM_LEAF_FILE, PLATFORM_PACKAGE,
PLATFORM_CRATE, the "PLATFORM layer crate" docstring): OS_*.
`--check` gains two classes: a table cell that is the layer's name (`| platform |`) and `platform layer`
/ `platform crate` (also possessive). Against the previous head's text they flag exactly the two cells
the review found and the `platform crate` / `platform layer` prose; on this tree they report 0 sites
with no keeper needed. The tool's docstring no longer says layer prose is left alone.
The reverse leg of `--equivalence` caught a defect in the new entries: a reverse run (and a forward dry
run) reads files that still sit under rust-modules/platform/, but LITERALS is keyed by head paths, so the
five entries under rust-modules/os/ never matched and `--reverse` left "the os layer" behind.
rewrite() and `--check` now look a file up by head_name(rel). The fixture gains
rust-modules/platform/build.rs; against the previous tool the suite failed 4 cases (the reverse round
trip and the three equivalence cases that run the reverse leg).
ci/test_rename_os_layer.py: the `/` before `platform/` assertions use real fixtures
(`rust-modules/platform/src` keeps its own class, `x/platform/src` is not flagged), the prose line has no
layer neighbour and `data platform` is asserted as a separator hit, and one case covers the cell and
noun classes (20 cases). The fixture's natural-`os` file no longer says "the platform layer".
Certificates (reviewed; every changed hash is a consequence of five edited files):
ci/proofs/serde-json-immutable.json, pinned by ci/readonly_dependencies.py
CERTIFICATE_SHA256 dc193808...2fc4f -> 47228bf8...2fec9
changed: the manifest hashes of rust-modules/Cargo.toml, os/Cargo.toml and storage/Cargo.toml (a
comment or the crate description names the layer); nothing else.
ci/proofs/platform-generated-enums.json (keeps its name), pinned by ci/readonly_generated.py
CERTIFICATE_SHA256 ac7a32d9...460c3 -> 55e6b3ac...7a718
I18N_SOURCES[1] (the reviewed variant of os/src/i18n/mod.rs; two doc comments) 7119e673...b463 ->
867bb410...37e1
changed: the same three manifest hashes, os/Cargo.toml, os/build.rs (a doc comment), the i18n variant.
Verified here: ci/test_rename_os_layer.py (20), ci/test_readonly_{generated,dependencies}.py (22, 64),
test_build_bench (46), test_build_not_always_dirty (10), test_storage_package_isolated (7),
release-config-check-test (75/75), check-module-layers, check-list-caps, check-localization;
`make test-crate C=plx_plex T=t_account` (prefs_tests.rs renames a local; 2 passed).
Not run here: make check, check-nodef, the ARM cross-build, a TV boot.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GLinnik21
marked this pull request as ready for review
November 20, 2026 04:49
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
GLinnik21
added a commit
that referenced
this pull request
Nov 20, 2026
The first W4 rule moved all 14 positive lines that name no test term. Read one by one, only 4 of them are host arms: six are frame-probe no-op stubs that every TV build without devtriggers compiles, a RELEASE build included, three are dead-code attributes on TV items, and one is a statement inside a TV function. The simulator table's own test (`port.rs`, all(test, hostsim, play-feed)) names a type that exists only under hostsim and moves with the table. The rule, the Test line and the platform-crate list now say 77 television gates, 10 seams, 6 stubs, 4 lines that stay and 5 host arms that move, which add up to the 102. Also: L15c no longer lists Wave R as planned (it landed as #1474), and the plan records that; the H7 and H8 bullets pin the README to e8da14c; "363 arms" reads "363 `hostsim` cfg lines"; F44 cites the `MACHINES` and `FORK_SCOPE` lines of `ci/check-deps.sh` at e9924f0 once and the same way; the W9 retail run takes the same dev-token shape as the emulator MVP, with the plex.tv sign-in a follow-up, because the loopback-only override cannot be reached from a retail set; and the L15c-to-L15h text states which workstreams are steps of the table instead of a "no layer rule" reason the table itself contradicts. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Nov 20, 2026
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.
First step of the platform plan from discussion #1460 (webOS, the desktop simulators and Samsung Tizen as separate platforms in one repo). The bottom layer is renamed before anything else, so the later PRs and the plan document use the final names.
What changes
plx_platform→plx_os,rust-modules/platform/→rust-modules/os/, layer[platform]→[os], fence keyword[port X]→[platform X],SRC_PLATFORM→SRC_OS. The innertvmodule stays. No behaviour change.tools/rename-os-layer.py(stdlib, run with-I), shipped for the open PRs and the release lines:--reverse(a tree), plus--reverse-patch FILE(a backport's diff, rewritten to the old names so it applies on a release line);--check: every old-name site in all three spellings, plus every prose use of "platform layer"/"platform crate", separator lists and table cells, classified or failing;--equivalence BASE: HEAD against script(BASE), and BASE against reverse(HEAD). The only differences it allows are the two certificates and their pins,Cargo.lockre-sorted, reflow, and the tool itself.ci/test_rename_os_layer.py(20 cases) is wired intoci/check-python-steps.txt.platformin the tree was swept once (675 hits: 91 name the layer, 584 do not), so--checkcovers the whole class rather than the sites reviews happened to find.platform/…paths becomingos/…, manifest and lock hashes, and certified sources whose only change is a comment or the package name.ci/readonly_generated.py:1b3b34fa…→55e6b3ac…; its current i18n snapshot2c978e3a…→867bb410…(MACHINE_SOURCESunchanged).ci/readonly_dependencies.py:915ab64b…→47228bf8….Cargo.lock: the same lines as main, withplx_osre-sorted beforeplx_owp. No version moves.After it merges
plx_os::…where earlier ones namedplx_platform::…. Sentry groups Rust events by in-app function names, so an existing issue whose top frames are in this crate can open as a new issue after the next release.ci/proofs/platform-generated-enums.json. Renaming it is left for a separate change.Open PRs and release lines
Rehearsed on #1387, #1407 and
release/v0.10. Recipe for an open PR:git merge origin/main, with this PR merged;python3 -I tools/rename-os-layer.py;python3 -I tools/rename-os-layer.py --check;Merging first gave 0 conflicts on #1387. Running the script first gave 2 mechanical conflicts. For a backport, run
--reverse-patchon the post-rename diff beforegit apply.Build inputs
Measured base
8230e3232against head9d5360cc0. The commits after it change comments, test strings, the crate description, build-bench's constant names and the tool, and no build input.RUST_INPUTS: 1500 files on each side, identical after the rename.STORAGE_INPUTS: 16 on each side, identical.make -s print-bench-config print-playback-config print-rust-codegen print-rust-toolchain print-disk-entries: byte-identical output.Cargo.tomldiffers only by the rename.build-bench
Same Mac (Apple M4, 10 cores), one sitting, 3 interleaved runs per scenario, rustc 1.100.0. Both target dirs are on an external build volume, so absolute times include that disk. Head printed three load warnings (gfx run 1, telemetry run 1, os run 3); base printed none. The table pairs base's
platformrow with head'sosrow.Every row's base and head ranges overlap except the non-incremental hub edit, where head is faster. The units rebuilt per scenario are the same on both sides (35, 27, 23, 9, 19, 7, 15, 13, 9, 5, 7, 5, 3, 1 and 7 of 190).
* The no-op row is wrong on both sides, and the cause is already on
main. The ARM row touchesrust-modules/src/lib.rs(tools/build-bench.py:646) and nothing restores its mtime, so the no-op runs after it recompile the app crate. The first no-op after warm-up rebuilt 0 units: base 10.1 s, head 12.9 s.The unit-suite scenario has no row on either side. On this Mac,
plxnative_modulesandplx_screenstest binaries die with SIGSEGV inside macOS libGL (glClearColorfromgfx::frame_clear,glUniform4ffromgfx::draw_ramp). It happens identically on base, twice, and on head. The cause is not determined. It is not this change.The tool's target-dir sizes print 0 MB because
du -skdoes not follow symlinked target dirs. Real sizes, base → head:target3171 → 3255 MB,target-fast5203 → 5309 MB,target-storage74 → 74 MB.Television
Three boots of plain
makebuilds on the dev set: head, base, and base again for the noise floor. Each ran under its own 6-minute lease, with--guest --mockagainst the synthetic PMS, the identity lines checked first, and no keys sent. Each binary's md5 matched on the host, in the app directory and at/proc/<pid>/exe.Each log was cut from
install:to the first idle Home heartbeat (78 lines each) and normalised. The only lines that differ beyond what also differs between the two base boots:imgcache: cap=is 12,288 bytes higher on head. The cap is half the free space plus what the cache holds, and head's binary is 23,540 bytes smaller, which frees six 4 KiB blocks (24,576 bytes); half of that is 12,288. No log line names either crate.Gates
17425b0a5.--check0 old-name sites;--equivalence origin/mainok;make test-crate C=plx_os442 passed;ci/check-module-layers.py0 entries;ci/check-deps.shgreen. The gate regenerated both certificates at9d5360cc0and they were byte-identical to the committed files; the later pins are checked by CI's readonly steps on17425b0a5.17425b0a5: 0 blockers, 1 major (this description lacked the build-bench table, now added) and 1 minor.🤖 Generated with Claude Code