Skip to content

feat(id-native-shell): live WorldClient session loop feeding PresentedView (#788) - #10536

Merged
dezren39 merged 1 commit into
mainfrom
queue/9341-788-live-session
Nov 15, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/9341-788-live-session

Conversation

@dezren39

@dezren39 dezren39 commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

What

Step 2 remainder for F13.6 (issue #788), following merged PR #10526: the live WorldClient session loop feeding the renderer, plus the live-host durable-outcome parity test.

  • session::run_session (exported as id_native_shell::run_session): sends the join frame, splits the client stream (reader in its own task — frame reads are not cancel-safe, the same split the CLI join pump uses), validates and folds every host frame into SessionState, publishes each new view on a channel, and routes outbound frames to the session world via route_frame (byte-identical to WorldClient::send_json on a with_world client). Ends on host close, a contract/host refusal, or outbound-channel close; returns the final state.
  • Binary: --node <id> --capability <cap> [--world <name>] [--addr <ip:port>] [--no-relay] (the id world join parameters) starts the session on a background thread; a Bevy system drains published views into PresentedView. Without a target the window opens session-less and the announce line says so. The outbound sender is held in a resource for the app lifetime; Bevy keyboard/clipboard capture wiring on top of the existing events mapping is follow-on presentation work.
  • tests/live_session.rs: serves a real host in-process (tic-tac-toe installed), plays one game through BOTH the native loop (ann: 0, 1, 2) and a terminal-style raw WorldClient (bo: 3, 4), then asserts on the host journal exported via the admin fixture recorder: inputs land as identical durable Input events at sequences 2-6 and the recorded records equal the live world records. Oracle is the journal, not either client.
  • Hygiene in passing: the session test module gets the same unwrap/expect allow its sibling test modules already carry, so the crate clippy gate can pass for this crate.

Tests

  • cargo test -p id-native-shell — PASS: lib 21/21, live_session 1/1, parity 3/3, transcript 3/3 (nix develop shell).
  • cargo clippy -p id-native-shell --all-targets --no-deps — PASS, 0 errors.
  • cargo tree -p id | grep -ci bevy — 0: the default id build still pulls no Bevy (isolation rule holds; new deps are native-shell-only, dev-deps are test-only).
  • Note: full-workspace cargo clippy -p id-native-shell --all-targets (without --no-deps) currently fails in id-core (canonical_cbor.rs unwrap_used, 3 errors) on unmodified main code — pre-existing, untouched by this PR.

Issue #788 stays open: steps 3-4 (rich surfaces) remain conditional on the design Q1 decision.


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 join a live world when provided with connection details, display updated views, and send input to the host.
    • The app can also open without a live session, and reports its session status at startup.
    • Connection options include world selection, direct addresses, and relay control. Invalid or incomplete options produce an error with usage guidance.
  • Documentation
    • Updated the running instructions with session connection options and no-session behavior.

…dView (#788)

Step 2 remainder: run_session joins a live host (split-stream reader task, contract-validated frames folded into SessionState, views published to the renderer, outbound frames routed to the session world), the binary wires it behind --node/--capability and drains views into PresentedView, and tests/live_session.rs proves durable-outcome parity against a live host (one tic-tac-toe game played through both the native loop and a terminal-style raw client; host journal as oracle).
@dezren39
dezren39 requested a review from a team as a code owner November 15, 2026 19:16
@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-15T19:16:19.186235Z
We couldn’t complete this review. Comment @codex review to try again.
9c59ee7 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 optional host-session connection arguments and a session loop. It routes frames, processes host updates, and sends received views to the renderer. A live-host integration test checks alternating inputs and durable outcomes.

Changes: Native Shell Live Session

Layer / File(s) Summary
Session runner and public API
pkgs/id/crates/id-native-shell/Cargo.toml, pkgs/id/crates/id-native-shell/src/session.rs, pkgs/id/crates/id-native-shell/src/lib.rs, pkgs/id/crates/id-native-shell/README.md
Adds Tokio dependencies and the public run_session entry point. The runner sends a join frame, processes host frames, routes outbound frames, and publishes views. The README describes the session loop.
Shell connection and view wiring
pkgs/id/crates/id-native-shell/src/main.rs, pkgs/id/crates/id-native-shell/README.md
Adds session argument parsing, host connection setup, a background session thread, and renderer view updates. Startup output distinguishes connected and disconnected operation.
Live-host session validation
pkgs/id/crates/id-native-shell/tests/live_session.rs, pkgs/id/crates/id-native-shell/tests/parity.rs
Adds a live-host test that alternates inputs between native and terminal clients, then checks the resulting events and durable records. Updates parity-test documentation to distinguish its scope.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant NativeShell
  participant parse_args
  participant connect
  participant WorldClient
  participant Host
  participant run_session
  participant drain_session_views
  participant PresentedView
  NativeShell->>parse_args: Parse session options
  NativeShell->>connect: Connect using parsed options
  connect->>WorldClient: Establish host connection
  NativeShell->>run_session: Start session with WorldClient
  run_session->>WorldClient: Send routed join frame
  WorldClient->>Host: Exchange session frames
  Host->>WorldClient: Return host frames
  WorldClient->>run_session: Provide host frames
  run_session->>drain_session_views: Publish session views
  drain_session_views->>PresentedView: Replace presented view
Loading
Merge Risk: Low · up to 9c59e

The new session loop works for the shipped binary's single-connection use. Edge cases remain for programmatic callers: cancelling a session leaves a background reader running, ending one session can close sibling sessions on a shared connection, and a stalled host write can delay error reporting. These are worth tightening but are unlikely to block 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