Skip to content

[CTX-1630] feat(rich): paint panel scenes from the present loop - #2784

Merged
Xuepoo merged 5 commits into
mainfrom
ctx-1630/feat-scene-present-loop
Oct 28, 2026
Merged

Xuepoo merged 5 commits into
mainfrom
ctx-1630/feat-scene-present-loop

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Priority: P1 | Area: rich | Labels: feat,P1,area:rich | Milestone: v0.2.0 | RFC: OQ-051 | Task: CTX-1630

Part of #2760 (present-loop half; do not close the issue until the reviewer agrees the integration is complete).

Summary

bitty-runtime composes the OQ-051 scene paint path into the present loop and unit-tests it end to end. It is not reachable from a shipped frame yet: no shipped build installs a scene host or binds panels until #2785 (host install + ui.rich attach), so no shipped frame paints a Scene.

  • Paint. runtime/present.rs resolves each visible panel leaf's compositor-owned content rect and live cell metrics, derives the bounded paint list, and composes it into the frame. Scene fills join the leaf fill layer, text goes through the existing overlay text seam (ScenePaint::append_into → GridRenderer::overlay_text_glyphs), image nodes stay placement references (counted, never decoded here), and the layout-derived damage is clipped to the leaf content rect.
  • Damage. Scene invalidation enters the frame descriptor through SnapshotDamage::with_extra_regions (new with_extent keeps window-space scene rects clipped to the surface). The combined present remains a full frame; the descriptor stays complete for partial planning.
  • Fail-closed. A typed ScenePaintError paints nothing, keeps the previously presented scene primitives when the surface/clip/fade/occluder set/atlas epoch are unchanged, and advances Runtime::scene_paint_refusals / last_scene_paint_refusal. Nothing is clamped.
  • Accessibility. The same paint list's lines are pushed through UiSnapshotHost::push_scene_text at paint time (kind SceneKind::Column, identity = panel id) into a per-frame scratch host, so the recorded parity evidence is exactly the painted bytes under the existing bounds. An over-bound projection refuses the whole contribution.
  • Host seam. Runtime::install_scene_host / scene_host_mut / take_scene_host install the one OQ-051 PanelRuntime; no second scene store. Runtime::scene_frame() reports per-frame views/ops/images/damage/a11y, and presented_allocations() exposes the geometry the loop painted.
  • Integration status (honest). The composition is wired and unit-tested, but two preconditions keep it out of a shipped binary, both tracked in [0.2.0] Install a production PanelRuntime scene host and attach ui.rich mounts #2785: (a) no production owner constructs or installs a PanelRuntime scene host with placement binds — Runtime::install_scene_host has test callers only (crates/bitty-runtime/tests/scene_paint_path.rs), and the app keeps a bare PanelRegistry for panel.create with no placements, so placement_panel_of cannot resolve a leaf and Runtime::scene_host() stays None; (b) bitty.ui.mount still validates through the v1 reader, so no ui.rich mount attaches a Scene to its panel. bitty-render docs, the bitty-runtime scene-path notes, and the workspace decision record now say exactly that, and nothing describes plugin rich content as shipping.

Tests

Extended crates/bitty-runtime/tests/scene_paint_path.rs (no duplicate module):

  • present_loop_paints_panel_scene_inside_its_leaf_and_projects_its_text: headless Runtime present with an installed host, a mounted rich panel, and an attached scene. Asserts painted glyphs, frame pixels changed only inside the leaf content rect (baseline runtime comparison), bounded damage, and a11y lines equal to an independently re-derived paint_scene list on the same surface.
  • refused_scene_keeps_the_previous_frame_and_attributes_the_refusal: an admitted scene whose border exceeds the paint bound is refused; the frame RGBA and a11y projection stay identical to the accepted frame, the retained primitives still paint, and the refusal is attributed with the typed error.

Gates

At head 00e50451 (worktree, CARGO_TARGET_DIR=$BITTY_WORKSPACE/.targets/ctx-1630); the only change after the previous gate run is documentation/comments in bitty-render/bitty-runtime, so no test behavior changed:

Gate Result
cargo fmt --all -- --check 0
cargo clippy --workspace --all-targets --locked -- -D warnings 0
cargo check --workspace --all-targets --locked --target x86_64-pc-windows-gnu 0
cargo check --workspace --all-targets --locked --target aarch64-apple-darwin 0
cargo test -p bitty-runtime -p bitty-render -p bitty-ui -p bitty-terminal --locked 0
RUSTDOCFLAGS="-D warnings" cargo doc -p bitty-runtime -p bitty-render -p bitty-ui --no-deps --locked 0
just status-drift OK
just scratch-paths OK

Cross-target clippy (not run by CI, which uses cargo check there) still reports pre-existing host-conditional lints in bitty-render tests and execution_jobs.rs; unrelated to this diff.

Docs: bitty-terminal-docs PR #345 records the implementation status and PR #346 restores the shipped-build caveat; the docs pin is 842e7d73 (reachable from docs origin/main).

What remains of #2760

Both preconditions are #2785: give the app a shared PanelRuntime composition root with real placement binds and install it through Runtime::install_scene_host, and route ui.rich mounts through read_rich_component → scene_bridge::mount_rich_node → PanelRuntime::attach_panel_scene. Until both land, a production build cannot paint a scene (no host, no attached scene), and the issue stays open.

@Xuepoo Xuepoo added this to the v0.2.0 milestone Oct 28, 2026
@Xuepoo Xuepoo added feat Feature P1 Priority: high area:rich Area: rich presentation labels Oct 28, 2026
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7e171e16-d976-48c7-9152-90c073d9ae87
Commits

Reviewing files that changed from the base of the PR and between 14f26fb and 00e5045.

Files selected for processing: 14
  • crates/bitty-render/README.md
  • crates/bitty-render/src/grid.rs
  • crates/bitty-render/src/lib.rs
  • crates/bitty-render/src/scene.rs
  • crates/bitty-render/tests/scene_paint.rs
  • crates/bitty-runtime/src/cw_present.rs
  • crates/bitty-runtime/src/lib.rs
  • crates/bitty-runtime/src/registry/host.rs
  • crates/bitty-runtime/src/runtime.rs
  • crates/bitty-runtime/src/runtime/cw_live.rs
  • crates/bitty-runtime/src/runtime/present.rs
  • crates/bitty-runtime/src/runtime/scene_present.rs
  • crates/bitty-runtime/tests/scene_paint_path.rs
  • docs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Wire PanelRuntime::scene_paint_for into the shipped Runtime present
path. Each visible panel leaf resolves its compositor-owned content
rect and live cell metrics, composes fills, overlay-seam glyphs, and
image placement references into the frame, and feeds bounded damage
through SnapshotDamage::with_extra_regions. A typed refusal paints
nothing and keeps the previously presented primitives for an unchanged
surface. The same paint list's lines are pushed through
UiSnapshotHost::push_scene_text so the a11y tree matches the frame.

Sync bitty-terminal-docs to the recorded implementation status.
…ilds

Every scene-path integration note now says the same thing: the present
composition is wired and unit-tested, but no shipped build installs a
scene host or binds panels until bitty#2785 (host install + ui.rich
attach), so no shipped frame paints a Scene yet. Drop the remaining
claims that implied a shipped consumer (bitty-render lib/README/scene,
cw_present, cw_live module and integration notes, scene_present).
@Xuepoo
Xuepoo force-pushed the ctx-1630/feat-scene-present-loop branch from 67aa7d4 to 00e5045 Compare October 28, 2026 16:26
@Xuepoo
Xuepoo merged commit 11bb8d5 into main Oct 28, 2026
20 checks passed
@Xuepoo
Xuepoo deleted the ctx-1630/feat-scene-present-loop branch October 28, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:rich Area: rich presentation feat Feature P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant