Repository navigation
[CTX-1419] fix(ui): keep overlay pill chrome and inherit root declaration (#2191) - #2392
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 30 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review — PR #2392 ([CTX-1419] overlay pill chrome parity)
Verdict: NEEDS-FIX (2 blocking, 2 NIT). Reviewed head 74755874, diff limited to
crates/bitty-runtime/src/runtime/band_host.rs and crates/bitty-runtime/src/runtime/present.rs.
Blocking
- False geometric claim.
present.rs:4952documentsOverlayPill::width_pxas "Pill width in
pixels (at least one cell)", butwidth_pxcomes frompx_span_usize(text_cells, cell_w)
(present.rs:390-392), which returns0whentext_cells == 0. For exactly the case the PR
claims to fix — the empty composer buffer,styled_text("", …)— the new fallback fills a
0 px-wide rect with no glyphs, so the body's "always keeps its one-cell default fill" is not
what the code does. Fix by clampingwidth_pxtocell_w(making the claim true), or correct
the doc and the PR description. - The regression test does not pin the claim.
present.rs:5497-5519
(styled_empty_overlay_row_keeps_pill_chrome) asserts rect count, fill color and
any_needs_draw, but never the rect width — the one-cell property that motivates the fix is
unverified. It does fail without the change (rect count 0), so it guards existence only.
NIT
band_host.rs:167-196—BandInherited::ofcomputesregionwith parentNone, thenlayered
recomputes and discardsown.region; harmless but reads as ifown.regionwere load-bearing.present.rs:4221-4225now propagates the root'son_click/on_scroll/regioninto every
overlay row'sBandRun; intended band parity, overlay paint never consumesregion, but no test
in this diff covers the data-shape change.
Verified correct
The fallback is reachable only when nothing paints (the run loop continues on
span.is_empty() || cells == 0, present.rs:4047-4068), so painted_any cannot be set
spuriously; no double-paint when some runs do paint. BandInherited::layered (band_host.rs:220)
reproduces the old own.or(inherited) / bold / click→scroll→ancestor ordering exactly, and
removing the eight-arg flatten_into (plus its too_many_arguments allow) is a simplification,
not a capability change. Hygiene clean: two claimed files only, no hardcoded host values, English
only, named constants (BAND_ACCENT_ANSI_INDEX) instead of literals.
Reviewer: guard tick (independent agent), recorded via comment because this environment shares one
GitHub identity.
…tion Independent review of #2385 found two style defects on the overlay surface: - A styled row whose flattened runs paint no cell (empty text under `bold`/`fg`, or every span clipped away) painted nothing at all, breaking the CTX-1143 fail-open pill chrome on a surface that holds keyboard capture. The unstyled path and the styled fallback now share `paint_overlay_pill`, so a live surface always keeps one default fill. - `overlay_scene_rows` flattened each direct child of a `Column`/`List` root independently, so the root's own `fg`/`bg`/`bold`/bindings never reached the rows, unlike a band container declaration. `band_host` now exposes a crate-internal `BandInherited` snapshot and `flatten_band_runs_under`; the overlay flattens each row under the root's declaration, so "nearest declaration wins" is identical on both hosted surfaces. No node kind, property, capability, slot, or error code is added. Regression tests: `styled_empty_overlay_row_keeps_pill_chrome`, `overlay_root_declaration_reaches_rows`. Refs #2191
…ation
CI `Quality gates (1)` failed on the one-cell-width follow-up with
`clippy::useless_conversion`: `CellMetrics::{width,height}` are already `u32`,
so the new pixel assertions wrapped them in `u32::from`. Drop both wrappers
and keep the assertions (the one-cell width and one-row height claims are the
point of the test).
Review nits:
- `BandInherited::layered` takes the region identity from the node's own
declaration and falls back to the ancestor instead of recomputing it and
discarding `own.region`.
- `overlay_root_declaration_reaches_rows` now pins the root click binding and
region identity reaching the row run (data only; overlay routing stays
band-only).
Refs #2191
8dcb888 to
41f396f
Compare
Review dispositions + CI fix (head
|
Xuepoo
left a comment
There was a problem hiding this comment.
Review verdict resolution — PR #2392
The independent review recorded NEEDS-FIX (2 blocking, 2 NIT) against head 74755874.
Both blocking items are addressed on the current head 41f396f6:
- Zero-width pill.
present.rsnow computespx_span_usize(text_cells.max(1), cell_w)
and theOverlayPill::width_pxdoc reads "never narrower than one cell; a row that clips
to zero text cells still reserves its one-cell chrome" — the doc claim and the code agree.
Landed in841413c0("give the empty overlay pill a one-cell width"). - NITs. Root-declaration propagation and conversion cleanups landed in
41f396f6.
Gate state at 41f396f6: 13 checks pass, 0 fail, 0 pending
(Quality gates (1)/(2), Linux X11 + Wayland, Windows, macOS, MSRV 1.85, Supply chain,
Analyze (actions)/(rust), Extension pin drift, VM tier (PR) all green).
Merged on green CI + recorded reviewer verdict resolution, as the guard tick found no
outstanding blocking item.
Priority: P1 | Area: ui | Labels: fix,P1,area:ui,area:plugins | Milestone: v0.1.0 | RFC: chrome-surface-api-candidate.md / chrome-band-contract-candidate.md | Task: CTX-1419
Goal
Land the two overlay style defects found by the independent review of #2385 (merged as
cd6b0724). No node kind, property, capability, slot, or error code is added.Fixes
bold/fg, or every span clipped away — painted nothing while the surface held keyboard capture. The unstyled path and the styled fallback now sharepaint_overlay_pill, so a live surface always keeps its one-cell default fill. Regression:styled_empty_overlay_row_keeps_pill_chrome.overlay_scene_rowsflattened each direct child of aColumn/Listroot independently, so the root's ownfg/bg/bold/bindings never reached the rows, unlike a band container declaration.band_hostgains a crate-internalBandInheritedsnapshot andflatten_band_runs_under, and the overlay flattens each row under the root's declaration;flatten_band_runsbehavior is unchanged for bands. Regression:overlay_root_declaration_reaches_rows.Verification
cargo fmt --all --check— pass.cargo clippy --workspace --all-targets --locked -- -D warnings— pass.cargo clippy -p bitty-terminal --features dev-tools --all-targets -- -D warnings— pass.cargo test -p bitty-runtime --test lua_ui_parity— 11 pass.cargo test -p bitty-runtime --lib -- plugin_overlay_paint_tests— 14 pass (12 parity + 2 regressions).cargo test -p bitty-runtime --lib -- runtime::present— 46 pass;-- band_host— 15 pass.cargo test -p bitty-runtime --test chrome_bands_render --test plugin_ui— 13 / 18 pass.cargo test -p bitty-lua— all suites pass.boldoff inflatten_intostill fails the parity matrix; disabling the overlay bold branch still failsbold_overlay_text_double_strikes_glyphs.CI
Quality gates (1)failed on8dcb8880withclippy::useless_conversion(CellMetrics::{width,height}are alreadyu32); the wrappers are removed and the assertions kept.Scope and docs
This PR closes the two parity defects above. It does not complete the full #2191 contract: headed dogfood evidence for a plugin-composed capsule, multi-row band layout, overlay hit-test/routing, terminal-wide
SCN-4/SCN-5aggregation, the per-frame node cap, and the candidate one-surface-per-edge rule remain open, so this staysRefs #2191.Docs (
bitty-plugins-docssdk/reference/ui.md,bitty-terminal-docsspecifications/chrome-surface-api-candidate.md,bitty-manualapi/ui.mdEN + zh-CN) pin to this PR's merge SHA; the pin lands after merge.