Skip to content

ui.rich style table follow-ups from the #3175 review (double border, latent clamp, silent no-op, docs) #3176

Closed

Description

@Xuepoo

Follow-ups from the independent review of #3175 (merged as a64c283c, style table on ui.rich). None were blocking; all are real and should be tracked so they do not rot.

Priority: P2 | Area: ui | Labels: fix,P2,area:ui | Milestone: v0.1.0

Findings

  1. Two borders paint on one node. Block.border (cells, cap 8) and the new style.border (px, cap 16) can both be set on the same node; the reviewer measured a Rounded op plus the 4-op cell frame. A separate stroke key was rejected by scene-style-primitives-candidate.md:157-159 for exactly this reason. Needs either a documented composition rule or a typed refusal. Evidence: crates/bitty-lua/src/ui_style.rs, crates/bitty-runtime/src/scene_bridge.rs.
  2. Latent silent clamp. crates/bitty-lua/src/ui_style.rs:395 uses u16::try_from(*count).unwrap_or(cap) — unreachable today, but on the contract's central path a silent clamp is the failure mode the caps are supposed to prevent. Replace with the typed rejection path.
  3. Band/overlay style is a silent no-op. The additive-minor rule (lua_ui_parity::unknown_properties_are_tolerated) means style on a band/overlay mount is accepted and ignored, so a plugin author believes it took effect. Keep the tolerance, add a one-shot non-fatal diagnostic.
  4. Docs now false. bitty-terminal-docs/specifications/scene-style-primitives-candidate.md:385 and lua-ui-composition-reconciliation.md:189 still describe ui.rich as shipping no style key; safe-mode flattening is now plugin-reachable. Sync both, and link this issue.
  5. DuplicateField wording. That error is unreachable from a real plugin (Lua collapses duplicate table keys before the bridge sees them); adjust the message/doc so it does not imply otherwise.
  6. Node-cost test gap. The integration-level "flat declaration costs nothing" test stayed green under a mutant that wraps flat styles; only the unit test caught it. Add a node-count assertion at the integration layer.

Acceptance

Each item either fixed with a test that fails on the pre-fix tree, or explicitly rejected with the reason recorded in the owning contract.

Activity

  1. added
    fix
    area:ui
    P2
    on Nov 15, 2026
  2. Xuepoo commented on Nov 15, 2026

    @Xuepoo
    ContributorAuthor

    All six findings from the #3175 review are now resolved. Closing.

    # Finding Resolution Evidence
    1 Two borders paint on one node Typed refusal: a Block carrying both border.width > 0 (cells) and style.border > 0 (px) fails E_UI_COMPONENT_INVALID before anything is mounted. Zero width never collides, so each spelling alone still works; no shipped plugin declares a style table, so nothing breaks. Rationale recorded in ui_style.rs / ui_rich.rs / scene_bridge.rs and consistent with scene-style-primitives-candidate.md §157-159 (a second border mechanism on one node is the defect). bitty#3179 (0f4d64b7) — a_block_refuses_a_second_border_on_the_same_node, a_second_border_on_one_node_is_refused_before_anything_is_painted
    2 Latent silent clamp at ui_style.rs:395 unwrap_or(cap) removed; the u16 conversion is the check and shares one refusal site with the cap check. Proved unreachable at the pre-fix head, then proved hazardous by restoring the clamp + deleting the guard (cap test fails with a clamped value). Tests pin u16::MAX+1, 1e9, i64::MAX, i64::MIN. bitty#3179
    3 Band/overlay style is a silent no-op Tolerance kept (unknown_properties_are_tolerated); the reader now returns UiTolerated and the mount/update/overlay paths report once per VM generation through a defaulted HostServices::ui_style_ignored, latched after the mount lands. Never fires on the terminal rich path where style is honoured. bitty#3179 — negative tests pin surface naming and the one-shot latch
    4 Docs now false Both records corrected and the landed wire shape recorded (caps, closed token set, typed refusal, band/overlay inert, safe-mode flattening now plugin-reachable but unwired). bitty-terminal-docs#431 (specifications/scene-style-primitives-candidate.md, specifications/lua-ui-composition-reconciliation.md)
    5 DuplicateField wording Message and docs now state that Lua collapses literal table keys, so the arm is a type-boundary guard, not a plugin-reachable path (reviewer confirmed it is genuinely unreachable from a plugin). bitty#3179
    6 Node-cost test gap Integration test now asserts reader count_nodes/depth and bridged SceneNode::count_nodes() against the unstyled tree. A scratch mutant that wraps flat styles fails the new assertion (no wrapper node: left 2, right 1) while the pre-fix paint-list-only body stays green. bitty#3179 — lua_ui_style_vocab.rs:216

    Merge evidence: #3179 merged 0f4d64b7 after an independent review lane (verdict APPROVE on head d30a302b, mutation proof included) with 19 checks pass / 2 skipped / 0 fail / 0 pending; #431 merged as a docs-only PR after just check (fmt, markdownlint, links, metadata, language, agents, hygiene, svg, actionlint) returned 0.

    Non-blocking nits the reviewer left behind (not tracked here; they ride with the files): the stale header at lua_ui_style_vocab.rs:16-19 still describes the pre-item-3 reader behaviour, and the style_count message's "marshalled table" phrasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:uifix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions