Skip to content

HUD authoring: tools/hud-dev, and a dev-source HUD re-fetched on Play - #1241

Merged
GLinnik21 merged 6 commits into
mainfrom
hud/pr15-authoring
Nov 5, 2026
Merged

GLinnik21 merged 6 commits into
mainfrom
hud/pr15-authoring

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

PR15 of the HUD-plugin series (docs/hud-plugins.md, "PR15. Authoring tools"): an author can edit a HUD on a Mac and see each build on the TV.

  • tools/hud-dev (Python standard library; runs on macOS's /usr/bin/python3 3.9). It takes a HUD source folder or a .plxhud, packs it with tools/hud_package.py (the simulator's --hud-pack; no second packer), lints it with plxnative-sim --hud-lint whenever a file's mtime changes, and serves the last CLEAN bundle on 0.0.0.0:<port> (default 8731). A source with findings is printed (file, pointer, hint) and not served; the previous clean bundle stays up. It prints http://<RFC 1918 address>:<port>/<name>.plxhud and a one-line TV recipe, refuses to start on a machine with no RFC 1918 address, and logs one line per request (client, path, version served).
  • Store: a package installed from a development source (Address::dev_source) now records that address (installed.json from; Entry::dev_source).
  • Page: on the Player HUD page, Play on the focused row of such a package sends the same HudCmd::Fetch(address) that "Install from address" sends. The existing offer dialog follows and OK installs; the confirmation is kept.
  • Docs: the PR15 line and the installed.json description in docs/hud-plugins.md; a "Developing a HUD on the TV" recipe in site/hud/AUTHORING.md (with "remove the dev install before installing the registry one"); the tools/hud-dev entry in docs/agent-reference.md; the Play row in docs/remote-keys.md.
  • tests/test_hud_dev.py is registered in ci/check-python-steps.txt. No Makefile, Cargo.toml or make target changed, no new string, no new worker, global or cfg(test) fork, and no ci/allow/** line moved.

Decisions

Version counter. hudpacks::Semver is numeric MAJOR.MINOR.PATCH only (no pre-release, and the manifest version pattern is the same), so 1.2.0-dev.7 cannot be ordered and the comparator cannot express a dev counter without changing app code. The tool therefore raises the PATCH of the copy it serves: author's patch plus max(now - 1767225600, 1) (seconds since 2026-01-01), and never below the previous served patch + 1. A clock seed rather than a counter that starts at 1, so a restart of the tool still lands above what the set already holds. Never below the author's own version; the author's files are never edited. No second ordering rule was added. Consequence, accepted and not worked around: the dev patch outranks a later published release that only raises the patch (a dev build installed as 1.0.26000000 makes the published 1.0.4 NotNewer, so the TV refuses it). The ordering is unchanged; instead site/hud/AUTHORING.md and tools/hud-dev's own printed instructions say to remove the dev install before installing the published version, by the page's existing Remove row (the row named after the HUD, detail "Remove"). The app does have a way to remove an installed HUD.

The key: Play (the remote's play key, wcode 450, legacy 19/402; consts::Key::Play). The settings surface owns input, so a Play press reaches SettingsScreen::step and is forwarded to the top page; the global ladder's key_play never sees it there. The page has no secondary action for a Choice row besides the Right-at-edge arm (form_right_target), the colour keys are deliberately unbound (docs/remote-keys.md), and the HUD rows' own Right/OK meanings must stay. Play reads as "play this build", and it is a no-op everywhere else on the page: on a non-dev row, on Classic, on a Remove or address row, while a fetch or package operation is busy, or while a prompt is open. tools/hud-dev prints the key.

Address recording. No address was recorded before: Record held sha, source, time and the two formats. So the store now persists a dev-only from. It is written only when the install's source is Source::Address and the address is a dev source; on read it is parsed again with address::parse and dropped if it is not a dev address or sits on a record of another source (fail closed, the package stays listed and the index writable). An index without from is the bytes it always was.

Caveat recorded, not worked around: IndexRecord is deny_unknown_fields, so an older build reads an installed.json holding a dev from as read-only. Anyone who installed from a private-LAN http:// address can reach that (an author running tools/hud-dev, most often). The older build lists no dev HUD and cannot remove it, so the dev install is removed on a newer build before going back (stated in the recipe).

Design choice: the page reuses HudCmd::Fetch, so the Bridge, the runner and the event set are unchanged; the existing refusals (NotNewer, AlreadyInstalled) already surface through settings_hud_already(), so no new string.

Verified here

Red first for the store (a dev install records its address and no other install does; the address is read back from disk and the next fetch goes to it; an install from elsewhere forgets it; an address the store would not have written is dropped) and the page (Play on a focused dev row emits the effect; non-dev, Classic, busy and open-prompt rows send nothing). tools/hud-dev was mutation-checked: removing the version bump, serving despite findings, widening the address check to loopback, and dropping the clock seed each fail the suite. Along the way the tests found that HTTPServer.server_bind does a reverse DNS lookup of 0.0.0.0 (35 s on this Mac under another interpreter), now skipped and pinned by a test.

make test-crate C=plx_data (nothing under rust-modules/data changed after this run):

test result: ok. 1503 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 13.38s

make test-crate C=plx_screens:

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2002 filtered out; finished in 0.00s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2002 filtered out; finished in 0.00s
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2002 filtered out; finished in 0.00s
test result: ok. 2003 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 35.78s

tests/test_hud_dev.py, /usr/bin/python3 3.9.6 and Homebrew 3.13 (stub simulator, loopback port 0, real HTTP GET): Ran 39 tests in 8.584s / OK and Ran 39 tests in 8.737s / OK.

Static gates, all green: check-list-caps: 339 sites, every one classed: work 102, preview 14, format 70, not-a-list 153, reach(open) 0; Localization inventory: product text boundaries passed; check-module-layers: green; check-deps: all gates green; ci/test_shipped_faces.py (2 tests OK); ci/test_ci_workflows.py (80 tests OK); ci/test_ci_split.py (16 tests OK); make lint exit 0; CARGO_INCREMENTAL=0 cargo check --lib for plx_data and plx_screens finished clean.

Review round

pr-reviewer (five MINOR findings) and doc-claim-auditor (five contradictions) ran once over origin/main...HEAD; every realistic finding was fixed in e851b1c: the default route's address is listed first (a VPN that routes 10/8 had its tunnel address printed as the TV address), a finding with a null file prints as the package, control characters in a request line are written out before logging, the redundant prompt guard of the Play arm was removed and its test now keeps the dev row focused, the firewall wording follows docs/agent-reference.md's own netcond paragraph, the offer is quoted as the TV draws it, the older-build caveat names the right remedy, and the lab port in a comment is the real one. A CI run on the first push failed host python/shell/C gates because a test replaced time.sleep for the whole process and the interrupt landed inside the lint subprocess of a slow runner; the loop now waits in its own pause() and the test patches that.

Verified on the TV

On the set at e851b1c4b (a debug build, the default tvdev profile, booted --guest --mock with the mock's identity read before any key), with tools/hud-dev serving a scratch copy of the minimal fixture from the Mac over the home network:

  • A dev install seeded by hand (the bundle in packs/ and an installed.json record with source: address and the dev address in from). The Player HUD page listed it with its Remove row, so the store read from back.
  • Play on Classic made no request.
  • After renaming the source, tools/hud-dev re-linted it and served the next, higher version. Play on the dev row fetched that build (the tool logged the TV's GET), and the offer dialog showed it as a development source, Unreviewed, with Cancel focused by default.
  • Install replaced the package: the row showed the new name, the app itself rewrote installed.json with the new sha and kept from, and only the new pack remained in packs/.
  • The Remove row took the install out, and the page went back to Classic, Browse HUDs and Install from address.

Not verified on the TV

Typing an address into "Install from address". The remote harness's text token reaches only the Search field, and the system keyboard cannot be driven from outside, so that step needs a person at the remote.

No issue tracks the HUD-plugin work; none was opened for this PR.

🤖 Generated with Claude Code

GLinnik21 and others added 6 commits November 5, 2026 05:38
tools/hud-dev bundles a HUD source (a folder or a .plxhud) with the native
packer, lints it with plxnative-sim --hud-lint on every change, and serves the
last clean bundle over http on the Mac's RFC 1918 address, printing the address
the TV's "Install from address" takes. A source with findings is printed and not
served. Every clean change is served under a strictly higher patch version (the
store's comparator is numeric MAJOR.MINOR.PATCH only), seeded from the clock so
a restart still lands above what the set holds.

The store now records the address of a package installed from a development
source (installed.json "from", dev addresses only, dropped on read otherwise),
and Entry::dev_source hands it back. On the Player HUD page, Play on the row of
such a package sends the same HudCmd::Fetch "Install from address" does, so the
existing offer dialog and its confirmation follow. No new string, worker, global
or fork.

Docs: the PR15 line, the installed.json layout, a "Developing a HUD on the TV"
recipe in site/hud/AUTHORING.md, the tools list, the Play row of remote-keys.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…talling the published version

A dev build's patch outranks a later release that only raises the patch, so the TV refuses the published one as not newer. The ordering is unchanged; the tool's printed instructions, its docstring, site/hud/AUTHORING.md and the PR15 paragraph now name the page's existing Remove row.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… longer patches time.sleep

A test that replaced time.sleep with an interrupt also replaced the sleep inside the subprocess wait of a build, so on a slow runner the interrupt landed inside the lint call before the first bundle was served (CI: host python/shell/C gates, test_it_prints_the_address_and_the_recipe_builds_and_stops_on_interrupt). The loop now waits in pause(), and the two command tests end it there.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…st log, prose that overclaimed

tools/hud-dev lists the default route's address first (a VPN that routes 10/8 no longer prints its tunnel address as the TV address), prints a finding with a null file as the package, writes control characters of a request line out instead of sending them to the terminal, and names the lab receiver's real default port in its comment.

The Player HUD page drops the open-prompt guard of the Play re-fetch: the prompt takes the key in step() first, the test now keeps the dev row focused and pins that nothing is fetched.

Prose: the firewall is described as allowing /usr/bin/python3 by default and dropping other pythons until the prompt is clicked (as the netcond paragraph says); the offer is quoted as the TV draws it; the older-build caveat names the right remedy (an older build cannot list or remove the dev HUD) and says anyone installing from a private-LAN http address can reach it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The dev loop was run on the television with a dev-source install seeded by
hand: Play on its row fetched the next tools/hud-dev build, the offer named a
development source, Install replaced the package with the address kept, and
Remove took it out. Typing an address into "Install from address" was not
verified, because the remote harness cannot type into that field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review November 5, 2026 06:08
@GLinnik21
GLinnik21 merged commit 951db62 into main Nov 5, 2026
23 checks passed
@GLinnik21
GLinnik21 deleted the hud/pr15-authoring branch November 5, 2026 06:08
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