Skip to content

HUD plugins: reachability, the More folds and the package invariants, and classic as a package - #1142

Merged
GLinnik21 merged 2 commits into
mainfrom
hud/pr5b-reach
Oct 29, 2026
Merged

GLinnik21 merged 2 commits into
mainfrom
hud/pr5b-reach

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

PR5 part 2 of the HUD-plugin plan (docs/hud-plugins.md): the package-level checks that need no geometry, over a parsed Package, and classic as a package.

hud_format::check(&Package) -> Checked { findings, folds, states }:

  • Reachability (hud_format/reach.rs, pure). States are (open sections, slot) under every valuation of the content conditions the package names (chapters.present, title.is_episode; a condition it does not name holds; transport.paused counts as holding either way). modal opens one section at a time, inline any subset of the laid-out sections. Edges are the app-owned ones: OK on a placed, enabled toggle_section, BACK, and the slot changing involuntarily. Per D7 the slot is only Discs while a section is open.
    • R1 open_more (opening More's root) is placed in the root state under every valuation. MIN_CONTROL_SIZE is a geometric bound and belongs to the compiler (PR5c): presence only is checked here and no value is invented.
    • R2 the folded commands are returned as data (the key-less commands no reachable state places under every valuation in which they are enabled), never as a finding. open_tracks is one command whose tab is an opening address; toggle_stats and the Options switch never fold.
    • R3 a toggle_section {section: s} control needs a band whose when holds panel.s.
    • R4 what the parser cannot see of "Up Next is whole": replaces is non-empty and names segments of the package, band names a band.
  • Invariants (hud_format/validate.rs): I3 identity (band, segment and control ids are unique per kind), I9's no-palette rule for builtin:classic, I11's Skip-ladder warning.

Decisions

  • Already enforced by the parser, so not repeated (a second check is a second copy of a rule): I8 (REST_FOCUS_RULES: E0106/E0103), I13 (layout.anchor is a one-name enum: E0201), I9's sizes (E0201, HUD_TITLE only on title.main: E0106), I11's default (E0303), R4's two buttons and countdown (required keys of layout.up_next: E0103). Each has a row in reach_tests::parse_rows asserting the parser's own code and pointer.
  • builtin:classic is not reverse-DNS, so the brief's "parses with zero findings" needed the id pattern to accept it. Pattern::ReverseDns now accepts exactly that one literal (schema::BUILTIN_CLASSIC_ID), tests include near-misses (builtin:Classic, builtin:other, builtin:, xbuiltin:classic, a trailing space). That the id parses does not make a file the built-in: whether a package IS the built-in must come from where it was loaded (compiled in), and the storage/sideload PR must refuse that id on any path that takes files from outside (noted in docs/hud-plugins.md next to the id rule). I9 only restricts the id (no palette), it grants nothing. For PR6's schema emitter: the id pattern accepts this literal besides reverse-DNS names.
  • R1 requires the open_more that opens More's root (no page, or page: root): a control opening only Quality or Speed is not More's home of Stats and the folds.
  • Folds are computed from the package's own controls; a folded More row is not an edge of the graph, so a section's content can fold when its opener is missing although the folded section row would reach it. The row is redundant then, never missing.
  • Fold order is the plan's command table order; More lists them after Quality and Speed and before Options.
  • I11's warning is for a by_interval map that lacks a rung of the viewer's Skip ladder (SkipInterval::LADDER, read from plx_media::route); no by_interval at all is one face for every interval and is clean.

Codes added

Code Rule Rule of the plan
HUD-E0801 more-in-root R1
HUD-E0802 opener-has-section R3
HUD-E0803 up-next-whole R4
HUD-E0901 identity-unique I3
HUD-E0902 builtin-no-palette I9
HUD-W0903 face-ladder-complete I11

E06 stays reserved for the compiler's text-fit codes.

fixtures/classic.plxhud.json

The whole built-in HUD as a package: the plan's layout block (every number from "Classic, element by element"), plus the chapters and info section bands the table describes, with the tabs band's gap_before keyed on panel.chapters / panel.info. id builtin:classic, no palette, no faces. It is a test fixture here; PR7 embeds it and PR6's --hud-export prints it.

Where the table leaves a value implicit:

  • playbar: the plan's block writes { "w": "fill" } but the table requires fill, track, thickness, clock_size. Taken from draw_playbar / SB_H: fill: TEXT_PRIMARY, track: RAIL_TRACK, thickness: 8, clock_size: CAPTION. Everything else is the parser default.
  • Top-level version 1.0.0, name Classic, author PlxNative, license GPL-3.0-or-later (the crate licence); no $schema.
  • Chapters strip: w: fill, art {bind: item.thumb, crop: cover}; the name text max_lines: 1 (classic elides it) with its ink keyed on item.focused (TEXT_SECONDARY, focused TEXT_PRIMARY, from chapters_panel.rs); the time CAPTION in TEXT_SECONDARY. No w on the card's texts, no overlay.
  • Tabs band gap_before under panel.chapters: 43, 949 - 684 - (162 + 26 + 34), taking the timestamp as a zero-height origin as label_ys does today. UNVERIFIED against the compiler: PR8 computes it from the strip's box. Under panel.info it is the table's 45.
  • Info band: title info.title TITLE bold TEXT_PRIMARY, max_lines: 1; synopsis LABEL TEXT_SECONDARY (leading 29, max_lines: 2 from the table); facts size: CAPTION (from draw_chip_row); rect radius: 28, h: 236, gap: 34, pad: 28, bleed: 16 from the table; the actions' two controls are widget: button, size: 70 (the table's item_h) with the parser's default rest/focus.

Tests

hud_format/reach_tests.rs (module path contains hud_format):

  • builtin_classic_passes_package_invariants: parses with zero findings, check reports none, nothing folds.
  • The reference passes and its folds are exactly from_beginning and go_to_detail (its unplaced open_tracks {tab: audio} does not fold); the minimal package passes.
  • One invalid package per rule asserting code and JSON pointer: R1 (More when: title.is_episode, More absent, More only opens a page, More's band shown only in a section), R3, R4 (three cases), I3 (control, band, segment), I9, I11; parser rows for I8, I13, I9 sizes, I11 default, R4's buttons and countdown.
  • Folds: Previous/Next not placed fold, placed only under chapters.present fold too, placed for episodes only do not; open_tracks one command; a section without an opener folds its row; toggle_play, seek, toggle_stats, open_more never fold.
  • State counts: 18 for classic, 6 for the reference, 3 for the minimal package; the answer is deterministic.
  • Red first was observed in the one way that fits a new module: with the R1 check and the fold test disabled, 8 of the 15 tests fail; restored, all pass.

Pure: no IO, no globals, no cfg(test) fork in production code, no new dependency, no Cargo change, no ledger line, no MAX_* constant.

Gates

Local, as required (PATH="$HOME/.cargo/bin:$PATH" make test-crate C=plx_appkit T=hud_format, on the committed tree, git status --short empty after):

test result: ok. 136 passed; 0 failed; 0 ignored; 0 measured; 364 filtered out; finished in 8.11s

python3 ci/check-module-layers.py: green. This PR's CI is the full gate (make check, make check-nodef, the ARM build were not run locally).

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

Review

Review verdict was FIX FIRST; head after the round is 530a257d0.

  1. MAJOR, fixed (red first): a section the package never lays out still folded into More, and the row would open nothing (the minimal example got Chapters and Info rows). Layout::enabled now requires a laid-out section for a toggle_section fold. The minimal test, which pinned the wrong answer, now expects only previous, next, open_tracks, from_beginning, go_to_detail; a new test (a_section_row_folds_only_for_a_section_the_package_lays_out) lays out Chapters only and expects only that row. Both failed before the fix (test result: FAILED. 14 passed; 2 failed).
  2. MINOR, fixture value kept, marked as a placeholder: the chapters gap_before of 43 leaves out the timestamp line. A one-line text's box is its rung's line height, which is a runtime font measure that I cannot compute here, so no certain value exists; the plan's Chapters-strip row now says the number is a placeholder until PR8 recomputes it from the compiled strip box.
  3. MINOR, fixed: docs/hud-plugins.md now says classic's file already has the section bands and keyed gap, that the playbar carries fill/track/thickness/clock_size (the plan's block and table row said otherwise), and that I3 is unique per kind.
  4. MINOR, fixed: PR10's Goal and Verify now require refusing the id builtin:classic from every source that is not compiled in.

Gates (after the review round)

PATH="$HOME/.cargo/bin:$PATH" make test-crate C=plx_appkit T=hud_format, on the committed tree, git status --short empty before and after:

test result: ok. 137 passed; 0 failed; 0 ignored; 0 measured; 364 filtered out; finished in 5.50s

origin/main had not moved (no merge needed). This PR's CI is still the full gate.

🤖 Generated with Claude Code

GLinnik21 and others added 2 commits October 30, 2026 00:33
… and classic as a package

`hud_format::check(&Package)` walks the HUD's state graph (the open sections x the Discs / Up Next /
Skip slot, under every valuation of the content conditions the package names) and reports R1 (More is
placed in the root state), R3 (a section opener has a band), R4 (what Up Next replaces and where it is
drawn exists) as findings and R2 as data: the key-less commands no reachable state places under every
valuation in which they are enabled, which the app will fold into More. `validate.rs` adds I3 identity,
I9's no-palette rule for the built-in and I11's Skip-ladder warning; the invariants the parser already
enforces (I8, I13, I9's sizes, I11's `default`, R4's buttons and countdown) are not repeated and have
rows asserting the parser's own codes.

New codes: HUD-E0801 more-in-root, E0802 opener-has-section, E0803 up-next-whole, E0901
identity-unique, E0902 builtin-no-palette, W0903 face-ladder-complete.

`fixtures/classic.plxhud.json` is the whole built-in HUD as a package (the plan's layout block plus the
chapters and info section bands and the tabs band's keyed gap); `builtin_classic_passes_package_invariants`
parses it clean and finds nothing to fold. Its id, `builtin:classic`, is not reverse-DNS, so the id
pattern accepts that one reserved literal besides reverse-DNS names (`schema::BUILTIN_CLASSIC_ID`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…More; the plan says what PR5b shipped

Review of #1142. The fold decision asked only whether a `toggle_section` command was enabled, so a package with
no section band (the published `minimal` example) would have got Chapters and Info rows in More that enter a
state where nothing is drawn. A section row now folds only for a section the package lays out; the minimal
test pinned the wrong answer and now expects the others, with a case for one laid-out section.

`docs/hud-plugins.md` now agrees with the code: classic's file already has its section bands, the playbar
carries the four keys the table requires, I3 is unique per kind, the chapters gap of 43 is a placeholder until
PR8 computes it from the strip box, and PR10 must refuse the id `builtin:classic` from outside sources.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review October 29, 2026 21:43
@GLinnik21
GLinnik21 merged commit a51d70e into main Oct 29, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the hud/pr5b-reach branch October 29, 2026 21:52
GLinnik21 added a commit that referenced this pull request Oct 29, 2026
Merged PR5b (#1142): reachability, the package invariants, classic as a package. The schema's
reverse-DNS regex now accepts the one other id the parser accepts, `builtin:classic`, so the
schema accepts classic.plxhud.json; the agreement test walks classic with the valid corpus and the
regex pin covers the built-in id and its near misses. The published examples are held to PR5b's
`check` (zero findings) instead of a second reachability walker of this PR's own.

The parser now reads `schema::GAP_TOP_PX` and `schema::BUILTIN_FACE_PREFIX` instead of keeping its
own copies of the same two constants (behaviour unchanged). The plan and the emitter's module doc
list every keyword the schema uses (`$ref`/`$defs`, `description`, `default`, `title`), and the
site tests' doc names the CI path-filter gap. The schema golden is re-blessed (the id's doc string
changed on main).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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