Skip to content

feat(id-native-shell): step-2 Screen renderer, native event mapping, parity tests (#788) - #10526

Merged
dezren39 merged 3 commits into
mainfrom
queue/9341-788-contract-parity-shell
Nov 15, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/9341-788-contract-parity-shell

Conversation

@dezren39

@dezren39 dezren39 commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

F13.6 design #788 step 2 (slice): Bevy Screen renderer + native event mapping

Task 9341 · Issue #788. Step 1 landed in PR #5573. This PR is the
first step-2 slice; the design (§7) makes each step a separate
reviewable PR, and step 2's remaining piece is named below instead of
being silently bundled.

What lands

  • Bevy feature set + flake wiring: id-native-shell enables
    bevy_render / bevy_core_pipeline / bevy_text / bevy_ui /
    bevy_window / bevy_winit (x11 + wayland, default_font), and
    pkgs/id/nix-common.nix adds the system libraries those features
    link (wayland, libxkbcommon, libX11/libXcursor/libXrandr/
    libXi, vulkan-loader) to buildInputs plus the runtime
    LD_LIBRARY_PATH in the dev shell hook — the "flake system-library
    wiring" step 1's crate comment promised. (Evidence it is needed:
    without it, cargo check -p id-native-shell fails in
    wayland-sys' build script: "Package wayland-client was not found".)
  • Renderer (src/render.rs): a Bevy-independent styled render
    model (ScreenGrid: per-cell symbol, xterm-256 fg/bg mapped to
    sRGB, bold, column width) built from a validated WorldSurface —
    Screen surfaces render per-cell; Text/Form surfaces and
    surface-less views fall back to the deterministic text projection /
    legacy data, the terminal shell's own rule. ShellRenderPlugin
    presents the current view as a Bevy UI node tree (one row node per
    grid row, one TextSpan per run of equally-styled cells), rebuilt
    when the view sequence changes.
  • Native event mapping (src/events.rs): key bytes, clipboard
    paste, window-pixel resizes (converted with the font cell size and
    clamped to the contract bounds), and chat map to exactly the
    F13.1 frames the terminal builders produce. No new frame kinds.
  • Parity tests (tests/parity.rs + unit tests): native frames
    are byte-identical to the terminal builders' frames for the same
    logical inputs, and the native grid's text projection equals the
    surface's own text_projection() for a scripted
    snapshot/event/view stream.
  • Binary: main.rs now runs DefaultPlugins + the render
    plugin; the startup line states the session loop is not yet
    connected rather than implying otherwise.
  • README for the crate: status per design step, build
    prerequisites, run/test commands.

What does not land (remaining step-2 work, stays on #788)

  • The live WorldClient session loop feeding PresentedView.
  • The live-host durable-outcome parity test (same frames into a
    running host, same journal) that the design's step-2 "done when"
    pairs with the loop.

Verification

  • cargo test -p id-native-shell (nix-shell with the GUI libraries
    above): PASS — lib 21/21, parity integration 3/3, transcript
    integration 3/3, 2026-11-15 (task 9341, lane code-a).
  • cargo check -p id-native-shell clean after warning fixes
    (5m28s cold Bevy-stack check).
  • Bevy isolation: cargo tree -p id | grep -ci bevy = 0 — the
    default id build remains Bevy-free; the crate stays a
    non-default workspace member.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • New Features
    • The native shell can now open a rendered window and display screen content with text colors and styling.
    • Native key input, paste, window resizing, and chat events can be mapped to the session’s expected format.
    • The live session connection is not yet available, so the window currently opens without session content.
  • Documentation
    • Added setup instructions and notes on the native shell’s current capabilities and limitations.

@dezren39
dezren39 requested a review from a team as a code owner November 15, 2026 17:35
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T17:35:42.331614Z
We couldn’t complete this review. Comment @codex review to try again.
6426070 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The native shell adds contract-frame adapters for input events and a Bevy UI renderer for session views. The binary now starts with window and rendering plugins. The live WorldClient session loop remains unconnected.

Changes: Native shell

Layer / File(s) Summary
Native event mapping
pkgs/id/crates/id-native-shell/src/events.rs, pkgs/id/crates/id-native-shell/tests/parity.rs
Native key, paste, resize, and chat events map to contract frames. Resize dimensions convert from pixels to cells and clamp to the contract limits. Tests cover frame parity, builder errors, and dimension conversion.
Screen grid and Bevy presentation
pkgs/id/crates/id-native-shell/src/render.rs, pkgs/id/crates/id-native-shell/tests/parity.rs
Session views convert to styled screen grids and render as Bevy UI rows. The renderer rebuilds rows when the view sequence changes and clears them when the view is removed. Background and bold values remain in the model but are not applied to the UI.
Shell startup and build setup
pkgs/id/crates/id-native-shell/Cargo.toml, pkgs/id/crates/id-native-shell/src/lib.rs, pkgs/id/crates/id-native-shell/src/main.rs, pkgs/id/nix-common.nix, pkgs/id/crates/id-native-shell/README.md
The binary uses Bevy window and rendering plugins. Cargo and Nix configuration add rendering features and system libraries. Crate documentation and the README describe the shell setup and the session loop that remains unconnected.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant SessionView
  participant present_in_world
  participant PresentedView
  participant ShellRenderPlugin
  participant ScreenGrid
  participant BevyUI
  SessionView->>present_in_world: provide view
  present_in_world->>PresentedView: store view
  PresentedView->>ShellRenderPlugin: supply presented view
  ShellRenderPlugin->>ScreenGrid: convert view
  ScreenGrid->>BevyUI: provide rows and foreground-colored text spans
Loading

Possibly related issues

  • Issue 5781 in developing-today/code: The Bevy UI plugin presents a view from a Bevy-independent render model, which is a concrete example of the presenter-client role described in the issue. The PR does not implement the ECS mapping or authority rules.
  • Issue 788 in developing-today/code: The PR implements the described Step 2 components, including the screen-grid model, Bevy presenter, native event mapping, and parity tests. The live session loop and live-host parity test remain open.
Merge Risk: Moderate · up to 64260

The native shell window will not draw session content until Bevy UI rendering is enabled and a camera exists. Screen colors, stale-view handling and text projection also need fixes before the viewer is relied on. Separately, the added Wayland and X11 dependencies can break Darwin development shells for the whole id package. Fix these before merging.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.1)

Clippy execution timed out

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

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