Skip to content

HUD plugins: the lint, and --hud-lint / --hud-schema / --hud-export in the simulator - #1153

Merged
GLinnik21 merged 30 commits into
mainfrom
hud/pr5d-lint
Oct 30, 2026
Merged

GLinnik21 merged 30 commits into
mainfrom
hud/pr5d-lint

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

PR5d of the player-HUD plugin plan (docs/hud-plugins.md, "Invariants", "Menus and other HUD popovers", "Text fit: the app is the enforcement point", "Captions: the band a HUD occupies", "LLM authoring" item 2). hud_format could parse a package, prove its reachability and lay it out (PR5c); nothing yet said whether the laid-out package is a HUD the app may draw. This PR adds the lint that does, and the three simulator flags that run it. It changes no frame of classic and draws nothing.

What changes

  • appkit/src/hud_format/lint.rs (pure): lint(text, &dyn Measure, &[LintLang]) -> Vec<Finding> (and lint_with(.., &LintOptions)). It runs to the end and reports every finding, sorted by pointer: the parse and validate findings, reach, compile once per language, then the geometric checks per state x slot x language. Only a parse error (no Package to go on with) ends the run early. Measurement is the existing plx_machine::machine::Measure; the language is an argument, the app text a HUD draws comes from THAT language's catalog, and i18n::current() and every global are never read. A finding identical in all linted languages is reported once with no lang.
  • Six check modules, each one pub(super) fn check(&LangCtx, &mut Vec<Finding>): lint_zorder (I4), lint_safe (I5), lint_band (I6), lint_menus (I7 M1-M4), lint_text (I10), lint_size (MIN_CONTROL_SIZE). I4 and I5 read one census (lint_zorder::surfaces).
  • place_panel is shared. Each player menu's inline anchor_panel(.., NEED_H, PLAYER_MENU_GAP, Placement::PLAYER_MENU) call became one pub(crate) fn place_panel(anchor, size) in more_menu.rs / track_menu.rs (and NEED_H is pub(crate)). The live panel, the overscan audit and the lint all call it, so the lint cannot drift from the menu. The arguments are identical at every former call site and no behaviour changes (player_hud 73 and menu 209 pass, and classic_places_both_menus_where_the_constants_did pins bottom 764 and CTRL_RIGHT - pw against the menus' own pins). This goes beyond "visibility only" for those two files; it is a pure move and is named here to be ratified rather than reverted.
  • compile.rs: provenance accessors (CompiledState::origin, control_pointer, vstack_rect, CardOp.origin) so a finding names the package node, and ONE list of the caption band's extents (CompiledState::band_extents, Compiled::compact_band_extents) that compile() (band = the minimum top) and lint_band (the node that sets it) both read.
  • hud_format.rs / report.rs: the fourteen new codes, the finding Context (lang, state, slot, rects, the measured text), BUILTIN_CLASSIC exported. JSON gains a context object only for a finding that has one; the text line carries lang, state and slot in brackets.
  • reach.rs: the gap PR5c reported. A placed previous / next now names title.is_episode (the spec: the pair is absent for a non-episode), so the reference gets its movie form (2 valuations x 6 states = 12, was 1 x 6). R1/R2 pass for all six fixtures.
  • schema.rs, player_hud/classic.rs: the mirrored HUD_TITLE_SZ / SCRIM_H are deleted; classic's private constants are the one source (pub(crate)).
  • gfx/src/text.rs: init_fonts_headless() (SDL_ttf needs no video, window or GL) and TtfMeasure::cap_h / line_h readable headless. It refuses the system-font fallback and names the unreadable shipped face. No new extern, dynlib! symbol or struct offset (TTF_Init and TTF_RenderUTF8_Blended were already bound), so fw-compat-reviewer was not run.
  • rust-modules/src/hud_cli.rs + bin/sim.rs: plxnative-sim --hud-lint <file> [--format text|json] [--lang all|<tag>] (exit 0 clean, 1 findings, 2 usage; measured with TtfMeasure over the real fonts from PLXNATIVE_APP_DIR, never an unmeasured fallback), --hud-schema (byte-identical to site/hud/schema/1.0.json) and --hud-export builtin:classic (byte-identical to fixtures/classic.plxhud.json). The binary stays thin: the logic is a unit-tested library function, no new [[bin]]. ci/module-layers.ini places hud_cli in the application layer.
  • No Cargo.toml / Cargo.lock change, no new dependency, no ci/allow/** line, nothing under tests/fixtures/replay/, no ci/list-caps.ini change (no new MAX_*). docs/hud-plugins.md: the MIN_CONTROL_SIZE "Unverified items" line only.

The codes

code name check what it finds
HUD-E0601 text-fit lint_text app text wider than its room in some language (its box, SAFE, the control it grows into, the fixed-w vstack it lives in), or a pill or button whose label-sized rect runs past that vstack. Context: lang, the string, its width, the room, the rects
HUD-W0602 text-fit-margin lint_text it fits, but with less than CI_TEXT_SKEW to spare (0 until PR12 measures it, so it fires only through lint_with)
HUD-E0603 min-control-size lint_size a focusable control drawn under MIN_CONTROL_SIZE
HUD-E0604 compile-item lint_size the compile's own item-keyed finding, language-free
HUD-E1001 z-overlap lint_zorder I4: two interactive rects of the same z overlap
HUD-E1002 hit-self lint_zorder I4: an item does not hit-test back to itself
HUD-E1003 decor-overlap lint_zorder I4: decor overlaps a drawn interactive rect
HUD-E1101 safe-interactive lint_safe I5: a drawn or hit interactive rect leaves SAFE
HUD-E1102 safe-content lint_safe I5: a text, image, icon or rule leaves SAFE
HUD-E1103 safe-reveal lint_safe I5: a focused strip card, or the scrub-preview card's top, leaves SAFE
HUD-E1201 caption-band lint_band I6: the compact band starts above player_hud::min_controls_top_y(); the pointer is the node that sets it
HUD-E1301 menu-opener lint_menus I7 M1: a menu panel meets its opener, at rest or popped
HUD-E1302 menu-safe lint_menus I7 M2: the placed panel leaves SAFE or is cut short of its NEED_H
HUD-E1303 menu-side lint_menus I7 M3 and M4: the panel is off the side the placer reports, or adjacent openers of a start-/end-aligned segment hang their panels from different edges

Each code has an invalid fixture (an exact-once edit of classic or the reference) that yields exactly it at the pointer the test pins. None is UNIT_ONLY: HUD-E1301 is reached by an opener wider than 800 px (the placer measures PLAYER_MENU_GAP from the opener's REST rect, and the opener pops by width x 0.07 / 2 a side, so a 960 px More button pops 33.6 px across a 28 px gap).

MIN_CONTROL_SIZE = 26 px

The narrowest seat the app's own screens give a focus target: a letter of the Library jump rail at RAIL_MIN_PITCH.

  • The seat is RAIL_TRACK_W (44, screens/src/library/layout.rs:29) wide and one pitch tall (rail.rs:197-203; the focus slot, Focusable for RailPart, rail.rs:251). The pitch is RAIL_AVAIL / n clamped to [RAIL_MIN_PITCH, RAIL_PITCH] (layout.rs:235-237), with RAIL_PITCH 32 (:31), RAIL_MIN_PITCH 26 (:33) and RAIL_AVAIL 864 (:227). A listing of 34 or more labels is placed at 26 and scrolls.
  • 26, not 32: 32 is the pitch of a short alphabet (a Latin one, 27 letters with #, is 864 / 27 = 32), the most a letter is ever given; a floor the app itself undercuts would not be derived from it.
  • Not 56: the smallest standalone control face is the page header's pill at 56 (ui/src/page_header.rs:56), which would reject the reference's 52 px discs. The rail letter is the one focus target below the reference's size, so "derived from the smallest control the app's own screens place" and "admits 52" meet there.
  • appkit sits below screens, so the rail's constants are a cited literal; min_control_size_is_the_narrowest_seat pins it and compares it against every control face appkit can name. Derived, not tried on the set; the spec's "Unverified items" line says so. Not a MAX_* name, so no caps row.

Invariants I1-I13

  • Enforced by this PR: I4 (z-order census), I5 (SAFE), I6 (caption band), I7 M1-M4 (menus), I10 (text fit); plus MIN_CONTROL_SIZE and the compile's own item-keyed finding.
  • Already enforced: I2 reachability (now with the reference's movie form), I3 identity, I8 (REST_FOCUS_RULES), I9 (sizes; no palette in builtin:classic), I11 (SVG subset, the ladder warning, the default face), I13 (one-name enum) (PR5a/5b/6).
  • Left, with the PR that owns each:
    • I7 M5 (the overscan audit reads the placer): PR7, because no audit reads compiled geometry yet. Not faked here.
    • I1 (app-owned surfaces cannot be replaced or covered): the format half holds by omission in the descriptor table; readout_owns_frame and the app-drawn surfaces are PR7's (the compact HUD, Up Next and Skip renderer); the sections' logic and the Tracks / More / Timing overlays are PR8's.
    • I12 (cost per state class): cost stays reported only; the ceilings are calibrated on the TV in PR7 (compact) and PR8 (sections).
    • I10 for the playbar's two clocks (elapsed / remaining): app text with no compiled rect (the playbar places them), so nothing checks them yet. PR7, whose renderer places the playbar.
    • Menu gap, noted for PR7: the placer measures PLAYER_MENU_GAP from the opener's REST rect, so an opener wider than 800 px pops across it. HUD-E1301 finds it in a package; the renderer that adopts the placer inherits the behaviour.
    • CI_TEXT_SKEW and the registry CI that reads this JSON: PR12. The More fold: PR9.

Decisions

  • Stop rule. The driver stops only when parse returns no package. Stopping at the first reach or validate error (as first written) hid the geometric findings behind one author round, against the spec's "runs to the end and reports EVERY finding".
  • Headless fonts. The brief asked for the smallest init that loads fonts without a window; SDL_ttf needs none. A child-process hostsim test runs the real TtfMeasure over pkg/'s fonts with no GL context and lints classic in de.
  • I10 scope. Only the app's own text (tab labels, item.start at its widest digits, the numbered chapter fallback up to 3 digits, the episode kicker's "S2, E3" prefix), plus a pill or button against the fixed-w vstack around it: the compiler sizes its rect from its label whatever room the cell has, so nothing else (no neighbour to collide with) can see it. Server text is never checked.
  • I6 has one band. Compiled::band() decides whether, and the finding's pointer is the node that sets it, from the same extent list. A rule is named a rule.
  • Menu anchor. The opener's REST rect, widened to its segment's outer edge when start- or end-aligned, placed at (MENU_MAX_W, the menu's own NEED_H) in every compiled state.
  • Text report. The text line prints lang, state and slot in brackets; with --lang all a finding whose rects differ between languages would otherwise print identical lines.
  • Commit trailers. The commits carry Claude Sonnet 5.5, the model that wrote them; the squash message is the landing's.

Tests

  • make test-crate C=plx_appkit T=hud_format: the goldens (builtin_classic_passes_every_invariant, reference_passes_every_invariant, and the four other fixtures: zero findings in all ten languages), one invalid case per code, the whole-run tests (stop rule, sort, determinism, the language argument), the codes / doc / site drift tests, and the reach re-pin (every_fixture_passes_r1_and_r2_with_the_states_its_valuations_make).
  • T=player_hud: classic unchanged. T=menu: the extracted place_panel leaves both menus' own pins green. classic_places_both_menus_where_the_constants_did (in hud_format) pins the lint's placement of classic's two menus at bottom 764 and CTRL_RIGHT - pw against those pins.
  • make test-crate C=plxnative-modules T=hud_cli (the library function, exit codes 0/1/2, both formats, --hud-schema and --hud-export byte-for-byte against the site golden and the classic fixture) and make test-hostsim C=plxnative-modules T=hud_cli (adds the headless-font child-process test).
  • T=text in plx_gfx (the headless font path).
  • Red first for each fix of the review round: HUD-E1301's invalid case (the coverage test failed while UNIT_ONLY still listed it; meets_opener forced false loses the finding), the button in a 200 px vstack (no finding before the check), two findings differing only in lang (identical text lines), a rule extent labelled "ground".

Issue

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

Gates

Local, on the final head (committed tree, git status --short empty before and after, origin/main already an ancestor). Crate tests only; CI is the full gate:

  • make test-crate C=plx_appkit T=hud_format: test result: ok. 351 passed; 0 failed; 0 ignored; 0 measured; 378 filtered out; finished in 5.86s
  • make test-crate C=plx_appkit T=player_hud: test result: ok. 73 passed; 0 failed; 0 ignored; 0 measured; 656 filtered out; finished in 8.13s
  • make test-crate C=plxnative-modules T=hud_cli: test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 1100 filtered out; finished in 0.09s
  • make test-hostsim C=plxnative-modules T=hud_cli: test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 1232 filtered out; finished in 0.09s
  • make test-crate C=plx_appkit T=menu: test result: ok. 209 passed; 0 failed; 0 ignored; 0 measured; 520 filtered out; finished in 0.12s
  • make test-crate C=plx_gfx T=text: test result: ok. 58 passed; 0 failed; 2 ignored; 0 measured; 140 filtered out; finished in 0.05s
  • python3 ci/check-list-caps.py: exit 0, check-list-caps: 301 sites, every one classed: work 97, preview 15, format 44, not-a-list 145, reach(open) 0
  • python3 ci/check-localization.py: exit 0, Localization inventory: product text boundaries passed
  • python3 ci/check-module-layers.py: exit 0, check-module-layers: green — 14 layers, 1534 modules, 0 migration entries left in ci/allow/layers.txt, 0 of them into [port webos]; 0 cfg(test) items still named across layers (--report)
  • ci/check-deps.sh: exit 0, check-deps: all gates green

The simulator binary runs are the swarm integrator's, on bd8334dc8 (before the review-fix round; this lane ran no make sim): make sim exit 0; --hud-lint on classic, hero-center, minimal, palette, reference and tabs with --lang all --format json each exit 0 with "findings": []; --hud-schema | cmp - site/hud/schema/1.0.json exit 0; --hud-export builtin:classic | cmp - fixtures/classic.plxhud.json exit 0; --hud-lint with no file exit 2, --lang xx exit 2, a file that is { exit 1 (HUD-E0100), PLXNATIVE_APP_DIR unset exit 2 (cannot load fonts). The JSON those runs print is unaffected by the review-fix round (it already carried the context); only the --format text line shape changed, and no binary run was repeated on the final head.

Not run here, left to CI: make check, make check-nodef, make check-replay, the ARM build. No TV or simulator UI pass: nothing draws from the lint.

Two sentences of docs/hud-plugins.md this PR made stale are left for the doc-claim-auditor, because the brief allows one edit to that file: R1's "under EVERY valuation of the content conditions the package names" (a placed previous / next now names title.is_episode too), and the size paragraph's "the repo has no such floor today".

🤖 Generated with Claude Code

GLinnik21 and others added 29 commits October 30, 2026 05:01
…s build on)

Lands only what more than one package of the HUD lint depends on, so the
check modules, the CLI flags and the goldens can be written in parallel
against fixed names. The six check modules are empty stubs.

- Finding context: `Context { lang, state, slot, rects, text }`, `NamedRect`,
  `TextFact`, `Finding.ctx`, `Finding::with`. `Finding` and reach's `Checked`
  lose `Eq` (f32 coordinates). The JSON report gains a `"context"` object only
  for a finding whose context is not the default; `report::sorted` breaks a
  tie at one pointer by (code, lang, state, slot, message) for findings that
  carry a context, and keeps the reported order for those that do not.
- Lint driver (`lint.rs`): `LintLang`, `LintLang::shipped`/`for_tag`,
  `LintOptions` (`text_skew`, default `CI_TEXT_SKEW`), `lint`/`lint_with`:
  parse + validate, reach, then per language one compile and the six checks;
  a finding identical in every language is reported once without a language.
  `BUILTIN_CLASSIC` is exported from `hud_format`.
- Check-module contract: `LangCtx`, `StateCtx`, `state_name`, `slot_name`,
  `ctx_for`, `named`; `lint_zorder`, `lint_safe`, `lint_band`, `lint_menus`,
  `lint_text` (with `CI_TEXT_SKEW`), `lint_size` each export
  `check(&LangCtx, &mut Vec<Finding>)`.
- Invalid-case support: `lint::testing` (`Base`, `InvalidCase`, `apply`,
  `assert_case`), each check module's `INVALID` and `UNIT_ONLY`, and
  `lint_tests.rs` pinning the contract.
- Code table: the fourteen lint codes (E0601, W0602, E0603, E0604, E1001-3,
  E1101-3, E1201, E1301-3), 38 -> 52.
- Compile provenance: `CompiledState::origin(op)`, `control_pointer(control)`
  and `CardOp.origin` name the package node that produced each op and control.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e reference gets its movie form), and the schema reads classic's HUD_TITLE_SZ and SCRIM_H

The spec's command table makes the previous / next pair absent for a non-episode whatever the package
says, but reach only counted `title.is_episode` as a dimension when a `when` or a keyed value wrote the
term. The reference places the pair and writes it nowhere, so its movie form was never enumerated or
compiled and the lint would have checked an episode-only layout. `Layout::read` now treats a placed
`previous` or `next` as naming the condition, which is the one place both reach's valuations and what
`compile` receives (`Named.episode`) come from; `compile` already drops the pair when `!v.episode`.
The reference's state count is 2 valuations x 6 states = 12 (it was 1 x 6); classic (18), minimal (3),
hero-center (3), palette (3) and tabs (10) place no pair or name the condition already, so they do not
move, and R1/R2 hold for all six.

`schema.rs` mirrored `player_hud`'s private `HUD_TITLE_SZ` (54) as `HUD_TITLE_PX` and `SCRIM_H` (470) as
`SCRIM_H_PX`, with comments promising to make them one. Both are `pub(crate)` in `classic` now and the
descriptor table reads them directly (`SCRIM_H as i64` where the range type is an integer); the mirrors
are deleted. The emitted schema is byte-identical (the site golden is untouched).

The compile provenance accessors (`origin`, `control_pointer`, `CardOp::origin`) were already on the
branch from the contract freeze and are covered there.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
lint_zorder reads every compiled layout (a Skip state under both pills) into one census of
interactive targets and decor, which lint_safe reads too, so I4 and I5 see one geometry:

- HUD-E1001 z-overlap: two interactive rects of one z (or two hit rects of one hit layer)
  overlap by more than a hair; touching edges do not. The scrub grab band is the lowest stop,
  so a row or the tabs may stand over it.
- HUD-E1002 hit-self: the topmost target at the centre of each target's hit rect, and of its
  drawn rect, must be that target (highest layer, then later in draw order).
- HUD-E1003 decor-overlap: text, image, icon, rule, ground and facts ops, Up Next's still and
  caption and a strip card's content may not cover a drawn interactive rect, except a rect
  ground under its own cells and a strip card's own content over its own strip. The scrim is
  the ground behind the whole HUD and is exempt.
- HUD-E1101 safe-interactive: a control, the scrub track or grab band, Up Next's buttons, the
  Skip pill or the chapter cards leave SAFE (the cards only above or below).
- HUD-E1102 safe-content: a text, image, icon or facts box, Up Next's still or caption, or a
  strip card's content leaves SAFE (a card's content only above or below); grounds and rules
  bleed.
- HUD-E1103 safe-reveal: the focused chapter card (art plus overlay and below content) is wider
  than the strip's stretch inside SAFE, or the scrub-preview card over the bar starts above
  SAFE's top.

Each code has an exact (code, pointer) invalid case; the predicates are tested on synthetic
rects, and a census test proves both shipped layouts feed the checks real targets, bars,
cards and stand-ins, so their zero findings in all ten languages are not an empty census.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…1-M4, HUD-E1301/E1302/E1303)

lint_band: in the compact state under every slot, Compiled::band() must respect
player_hud::min_controls_top_y() (inclusive bound). One finding per package, on the node that sets the
band (a control's item, the scrub bar, /layout/up_next for the stand-ins, or under band "block" whatever
drew the highest extent), with the extent, band and limit rects.

lint_menus: both player menus are placed through their own place_panel (the shared
anchor_panel(.., Placement::PLAYER_MENU) with PLAYER_MENU_GAP) from the opener's REST rect widened to its
segment's outer edge, at (MENU_MAX_W, the menu's own NEED_H), in every compiled state. M1 menu never meets
its opener (rest or popped), M2 inside SAFE with the full need_h, M3 the rise starts on the opener's side,
M4 adjacent openers of one segment share the panel's near edge. M5 is the renderer's (PR7).

more_menu / track_menu: NEED_H is pub(crate) and each menu exposes place_panel, the one call of the placer
that its live panel, its overscan audit and the lint now share. No behaviour change.

Tests: a classic pin (both menus at bottom 764 / right CTRL_RIGHT - pw against the menus' own pins and
overscan audits), invalid cases for E1201 (x2), E1302, E1303, E1301 as UNIT_ONLY with a synthetic test,
and zero I6/I7 findings for classic, the reference and the other four fixtures in all ten languages.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…d HUD-E0603 min-control-size, and the compile's item-keyed finding surfaced as HUD-E0604 compile-item

lint_size.rs holds the two checks that were a stub.

MIN_CONTROL_SIZE is derived from the smallest focus target the app's own screens place: a letter of the
Library's jump rail, whose seat is one pitch tall and 26 px at its narrowest (RAIL_MIN_PITCH,
screens/src/library/layout.rs:33; the slot at rail.rs:197-203). The constant's doc cites every source by
file:line and says why it is 26 and not 32 (the pitch of a short alphabet), a seat and not the drawn disc,
and not the 56 of the smallest standalone control face (ui/src/page_header.rs:56), which would reject the
reference package's 52 px discs. appkit sits below screens, so the rail's constants are a cited literal; the
pin test compares it against every control face appkit can name.

HUD-E0603: a control whose smaller drawn side (ControlRect::rect) is under the floor, once per control per
language (a control's size is never state-keyed, so each state repeats the fact), with the state and slot of
the first state that places it at its smallest, a Skip state's credits layout included, and its rect.

HUD-E0604: each Compiled::findings() entry, with the keyed value's pointer, the compiler's sentence and a hint
naming the item.* term and what to key instead; language-free, so the driver tags and collapses it.

docs/hud-plugins.md: the Unverified items line for MIN_CONTROL_SIZE now gives the value and its source.

Both codes have an INVALID case on the reference (an info disc drawn at 20 px; the card gap keyed on
item.focused) and neither is UNIT_ONLY.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…etic and the right line

The doc comment said a Latin alphabet is placed at the rail's 26 px floor. It is not: RAIL_AVAIL is 864
(screens/src/library/layout.rs:221-227), so 27 Latin letters sit at the full 32 and the floor is reached by a
listing of 34 or more labels. The comment now says so, and cites the Focusable impl at rail.rs:251 (it was
:253). The value stays 26, RAIL_MIN_PITCH.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…D-W0602 text-fit-margin)

lint_text.rs now judges the app's own text in each of the ten shipped languages against the room it has,
instead of reporting nothing.

Which texts: the strings the app writes, by bind. label.chapters and label.info (the language's tab label),
item.start (the widest H:MM:SS, each digit position measured, never a tabular-figure assumption), item.title's
numbered fallback (widgets_chapters_number up to 3 digits, the spec's PR12 corpus line) and, in an episode
state, the kicker's "S2, E3 . " prefix (D10: only the server tail elides). Server text (title.main, info.title,
info.summary, a chapter's own name) is never checked. Every weight the op can draw (Live<bool>) is measured and
the widest wins. The strings come from the language's own catalog through a LocaleContext built from its tag,
never from i18n::current(). A Skip state's credits layout is walked as well as the intro one.

The room is the smallest of: the text's own box (not for a hugging label, whose rect IS its text), the right
edge of SAFE, the nearest control, Up Next button or Skip pill that starts at or right of the text on its line,
and the narrowest enclosing fixed-w vstack. A strip card's text has its card alone. E0601 when measured > room,
W0602 when it fits with less than the skew to spare (strict: exactly the skew passes). CI_TEXT_SKEW is 0.0 (the
spec leaves the margin unmeasured until PR12), so locally W0602 only fires through lint_with with a skew.

Tests: four invalid cases (card too narrow for the fallback, vstack too narrow for the kicker prefix, a label
wider than its vstack, and a W0602 case through a 47 px skew), exact-fit / one-px-over / strict-margin ends to
end, classic and all six fixtures silent in ten languages with ShippedMeasure (and a check that the silence is
not a check that looked at nothing), the credits layout, the weight, the movie/episode gate, server text, an
unshipped tag, and unit tests of judge, limits, binding and the vstack walk.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…er a unit-tested library function and a font init that needs no window

The three simulator flags the HUD plugin series promises (docs/hud-plugins.md, "LLM authoring"
item 2 and "Schema"). All of the logic is `hud_cli::run`, a pure function whose file read and text
measurer are injected, so the exit codes and the bytes are unit-tested without a file, a font or a
process: --hud-lint exits 0 with no finding, 1 with any (parse findings included), 2 for a usage
error (bad arguments, an unreadable or non-UTF-8 file, fonts that will not load) with one line on
stderr; --hud-schema prints schema_emit::emit_text(schema::CURRENT) and --hud-export builtin:classic
prints the embedded classic package, each pinned byte-identical to its committed golden
(site/hud/schema/1.0.json, fixtures/classic.plxhud.json) and neither builds a measurer. The report is
report::text or report::json_text. `main_from` is the only IO; sim.rs gains five lines before it
reads a PMS host, and no [[bin]], Cargo or dependency changes. hud_cli is a hostsim/test module of
the application layer.

The real measurer is TtfMeasure over the shipped faces, which needed two changes in gfx/text.rs:

- `init_fonts_headless` is the font half of `init_text` (TTF_Init, open the base face, publish
  TEXT_OK) without linking the text shaders, so it needs no window and no GL context; SDL_ttf starts
  FreeType and nothing else. It refuses the system-DroidSans fallback `font_at` would take: a shipped
  face that is not a readable file is an error naming it and the directory it was looked for in.
  `init_text` calls the same two pieces at the same positions, so its behaviour is unchanged.
- TtfMeasure::cap_h and ::line_h went through `text_tex`, which rasterises AND uploads a GL texture,
  so a headless lint died with SIGSEGV on its first line height (observed with a probe before the fix).
  With no text shader linked (the state only the headless init leaves) they now read the same
  rendered glyph's height and ink band straight from the surface, through the one `render_white`
  call text_tex_miss uses. Measured on the probe: widths 122/285/152/177 for Skip Intro, Russian,
  bold and umlaut strings, 10000 cap_h/line_h calls in 57 ms.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… checks do

E1003 exempts the scrim (the ground behind the whole HUD); E1102 also bounds facts boxes,
Up Next's still and caption and a strip card's content (vertically); E1201 points at the node
that sets the band; E1303 names its two forms' rects.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…the same edit

Found when the six lint packages were woven: lifting classic with a 440 px row gap also leaves
the kicker without room (HUD-E0601) and pushes Up Next's still out of SAFE (HUD-E1102), which
the checks of two sibling packages report correctly.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…guages), every lint code's invalid case, and the whole-run tests

lint_tests.rs, the last of the PR5d lint packages:

- builtin_classic_passes_every_invariant and reference_passes_every_invariant lint the embedded
  classic and the reference fixture in all ten shipped languages with the real font advances (ShippedMeasure)
  and require zero findings; the same is pinned one language at a time. The four other fixtures
  (hero-center, minimal, palette, tabs) are pinned to the exact (code, pointer) pairs they lint to, which
  is none, and to no error. This replaces the freeze's classic_and_the_fixtures_run_the_whole_pipeline test,
  which held only while the six checks were empty.
- every_new_code_has_an_invalid_case (the un-ignored contract shell): the fourteen lint codes are the whole
  of the HUD-E06/W06/E10/E11/E12/E13 families, each is the own code of an invalid case or is in UNIT_ONLY,
  an entry that has a case is stale, and the one UNIT_ONLY code is HUD-E1301.
- every lint finding of every invalid case names the fault, the fix, the state and slot and the rects or
  text it concerns (HUD-E0604 is language-free and carries no context).
- findings are sorted per report::sorted and deterministic, in document order across five pointers;
  three independent faults of three check modules are all reported in one run, and a parse error stops the run;
  one case's report::json_text is pinned inline; a language-free fault collapses to no language across
  the ten languages and carries its tag when linted alone, a language-dependent one keeps its language.

Each golden was shown red against each of the six check modules deliberately made to flag unconditionally,
and the coverage test against a dropped UNIT_ONLY entry and a re-coded case; every break was restored.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… one round reports the geometric findings too

lint_with returned after the reach stage whenever it found an error, so a package whose
More cell was gated on title.is_episode (HUD-E0801) never got its geometric checks
that round: the author fixed More, re-ran, and only then met the info disc drawn at
20 px (HUD-E0603). The spec ("LLM authoring" item 2) has the lint run to the end and
report EVERY finding. parse() returns Some(package) exactly when it found no error and
compile() is total over a package that parsed, so the only stop left is a package that
does not exist (a parse error).

Tests: a_reachability_error_does_not_hide_the_geometric_findings (red before the fix:
only HUD-E0801), and a sweep that lints one package per reach/validate rule (R1 x4, R3,
R4 x2, I3, I9) through stage 3 in all ten languages to hold the totality the change relies
on. The module doc and the stop-rule test comment say what the code does now.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…s reached from a geometric finding

Every hud_cli test injected ShippedMeasure, so nothing ran ttf_measure(),
init_fonts_headless or the glyph-band branch of TtfMeasure::cap_h/line_h
that keeps them off text_tex (a GL upload that SIGSEGVs with no context).
A regression back to text_tex would have crashed --hud-lint while CI stayed
green. A hostsim test now runs in a child process (the font switch, the
resolved app directory and the face paths are once-per-process), with
PLXNATIVE_APP_DIR pointing at pkg/: it opens the shipped faces, asserts
real line/cap heights and widths, and lints the classic in de through the
real measurer for exit 0. Shown red with no_renderer() forced false: the
child dies and the parent names it.

testlock::fresh_process gains fresh_process_with_env, which hands the child
environment variables it must START with (the parent cannot set_var without
racing other test threads); fresh_process delegates to it unchanged.

The test named "parses but fails a rule" served `{}`, which is a parse
failure. It is renamed for what it is, and a new test serves the reference
with the info disc at 20 px (lint_size's E0603 case): a package that
compiles and fails a geometric check exits 1, the unedited reference exits
0, and the JSON output is report::json_text with its context object. Shown
red with the JSON arm emitting text.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… stays inside SAFE, a vstack's room runs to its edge, a fault is one finding

Reapplied on the integrated tree from the fix lane that was held back for touching the same files.

- I4 (HUD-E1003): Up Next's buttons and the Skip pill are produced by the `up_next` object but stand where
  the segments `up_next.replaces` names stand, so a `rect` ground under such a segment underlies them too
  (`Target::standing_in`, read from `Bands::replaced`).
- I5 (HUD-E1102): a rule is neither a scrim nor a `rect` ground, and only those bleed; `content_inside` no
  longer exempts `Kind::Rule`. New invalid case "a rule runs past SAFE".
- I10 (HUD-E0601): `CompiledState::vstack_rect` records where each `vstack` was laid out; a text's room
  against a fixed-`w` vstack runs from the TEXT's own x to the nearest enclosing vstack's right edge
  (compiled x + w), not from the vstack's x. New invalid case for a label behind an image in a rect cell.
- One rule for multiplicity: `lint_zorder::same_fault` / `dedupe` (same code, language, pointer, message,
  text fact and rect x/w; y/h and rect names ignored because a bottom-anchored band stack lifts with open
  sections) is applied by `lint_text`, `lint_zorder` and `lint_safe`, so a fault shown by every state and slot
  is one finding.
- Copied literals read the constants they describe: `plx_ui::fmt::KICKER_SEPARATOR`,
  `plx_ui::consts::EDGE_TOL` (the three 0.01 tolerances and `inside_safe`), the E1102 hint's preview rise and
  SAFE margins, the E0603 hint's control-face range. The E0603 doc no longer says I10; the report
  tie-break label says "sorts first".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…'s band and the lint's naming of the node that sets it cannot drift

compile.rs now owns the single extent list. CompiledState::band_extents(block)
yields BandExtent{top,rect,what,pointer}, the pointers coming from the state's
own provenance accessors plus a private standin_origin holding the up_next
node for the two stand-ins. Compiled keeps the band:block flag it read, and
Compiled::compact_band_extents is the one iterator that compile() (band = min
top) and lint_band::highest (the node that sets it, first minimum wins) both
read. CompiledState::top and lint_band's mirrored Extent/extents/bar_top/
origin_of are deleted; lint_band no longer imports DrawOp or KNOB_GLOW_R.

The agreement test that guarded the mirror is replaced by
every_band_extent_names_a_node_on_every_fixture; extents_name_the_node_that_drew_them
is ported to band_extents.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nvalid case and UNIT_ONLY is empty

The placer measures PLAYER_MENU_GAP from the opener's rest rect, and an opener pops by width x 0.07 / 2 a side, so an opener wider than 800 px
pops across the gap to its menu. The actions cell admits min_w up to 1920: a 960-wide More opener in the Info card's button column, lifted to
y 644 by a tall card, takes the Start side and its popped rect meets the panel. The new invalid case yields exactly HUD-E1301 there; the coverage
test now requires UNIT_ONLY to be empty. Red first: with the case added and UNIT_ONLY still listing the code the coverage test failed
('has an invalid case, so its UNIT_ONLY entry is stale'); with meets_opener forced false the case yields no finding.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ck it lives in

The compiler sizes a pill or button from its label (or min_w) whatever room its cell has, so one in a fixed-w vstack could draw 120-150 px
past the vstack's end with nothing beside it for I4 or I5 to collide with: lint over all ten languages returned no finding. lint_text now
judges every pill and button's drawn rect against the enclosing vstack's right edge and reports HUD-E0601 (or the HUD-W0602 margin) at the
control's item, with the label it shows as the string, the rect's width as the measured width and the distance to the vstack's edge as the
room. A disc has a fixed face and is no label. The module doc and the E0601 code doc now say so. Red first: the new invalid case
(classic's Info column cut to 200 px with a From the Beginning button in it) yielded no finding before the check.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nd slot

report::line printed the file, pointer, severity, code, rule, message, hint and nearest but none of the finding's context, while its module
doc said a lint message names the language itself. No message does, so with --lang all a finding whose rects differ between languages
printed up to ten identical lines. The line now carries the keys of the context that are set in brackets after the message
(' [de, compact, discs]'); the rects and the measured text stay in the JSON. Red first: two findings that differ only in ctx.lang printed
the same line.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…shared EDGE_TOL

band_extents labelled a Rule extent 'ground', so under band: "block" an E1201 set by a rule said 'the highest ground of the compact
state'. DrawOp::Rule now has its own arm ('rule'). lint_band's filter for the extent that set the band read a literal 0.01 where the other
checks read plx_ui::consts::EDGE_TOL. Red first: a_rule_is_named_a_rule_and_not_a_ground failed ('ground' for the reference's rule).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…names title.is_episode

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review October 30, 2026 06:22
…face; site/hud/ triggers CI

The shipped-faces gate matched every appfont*.ttf string in text.rs, including the deliberately missing face the headless font test names. Rename that face to no-such-face.ttf.

site/hud/ is read by rust-modules/src/hud_cli.rs (include_str! of the schema golden) and by rust-modules/appkit/src/hud_format/site_tests.rs (the examples and lint reports), but ci.yml's '!site/**' excluded it, so the include_str! trigger test failed. Re-include site/hud/** after site/ci/**, and name it in the prose list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit aef53a3 into main Oct 30, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the hud/pr5d-lint branch October 30, 2026 06:39
GLinnik21 added a commit to LovelessCodes/plx-native that referenced this pull request Oct 31, 2026
Main landed the HUD plugin work (plxnative#1151, plxnative#1153, plxnative#1154): the layout compiler,
the lint and one renderer drawing from the embedded builtin:classic package.
The hand-written classic draw this PR edited is gone, so the Skip pill joining
the transport row now lives in the compiled layout.

- classic.rs, motion.rs: main's versions. The PR's join_slot / draw_discs /
  icon_hit edits targeted code main deleted; their behaviour is carried by
  the compiler (`layout.up_next.joins`, set by builtin:classic) and state.rs.
- hud_format/compile.rs: a joined Skip state keeps the five disc stops from
  the package row and puts the pill at items[BTN_SKIP], a CONTROL_GAP left of
  the run. A package that does not set `joins` still replaces the row.
- player_hud/geometry.rs: frame_state looks the Skip state up with the
  episode pair; row_len / row_command / row_enabled / row_primary treat a
  Skip pill that replaces the row as the row's one stop; new row_joined.
- player_hud/render.rs, skip_pill.rs: the Disc widget draws under a Skip
  slot; the SkipPill widget draws at its own ordinal when joined.
- player/mod.rs: neighbour walks ControlSlot::travel when the pill is joined.
- Re-recorded the Skip rows of the three frozen goldens (geometry,
  title-right, census). Every non-Skip line is byte-identical.

Co-Authored-By: Claude Sonnet 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