feat(scene): wire useSceneTrace into App so real sessions emit frames#958
Merged
Conversation
Closes the last open Stage 0 item from #947 — a real session running with REASONIX_SCENE_TRACE=path/to/frames.jsonl now writes one frame per state change to the trace file. The Rust binary from #953 can read this trace and replay decoded SceneFrames end-to-end. The frame today is a one-line summary (card count, busy/idle, activity label), not a full lowering of the Ink tree. That's intentional: lowerInkToScene only handles Ink primitives, and the App tree is mostly stateful components. A full automatic lowering is blocked on either (a) finishing #565 so the render tree is decomposable, or (b) adding a function-component expansion helper — both bigger pieces of work. What this PR gets us anyway: a wired producer, the boundary proven on real data, and a stable shape for the Rust side to test against. When the lowering matures, only the body of useSceneTrace changes; the call site in App stays the same. Refs #868 #947
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the last open Stage 0 item in #947 — `useSceneTrace` hooks
into AppInner so a real session running with
`REASONIX_SCENE_TRACE=path/to/frames.jsonl` produces one frame per
state change. The Rust binary from #953 can read that trace and
debug-print decoded SceneFrames, end-to-end on real data.
What gets emitted
A one-line summary today: card count, busy/idle, activity label.
Wrapped in a Box with `paddingX: 1` so the frame is a believable
SceneNode shape, not just a string.
```
reasonix · 3 cards · busy · awaiting response
```
Why a stub frame, not a full lowering
`lowerInkToScene` only handles Ink primitives — `Text` and `Box`. The
App render tree is mostly function components, and lowering them
automatically requires either (a) finishing #565 enough that
subtrees decompose to primitives, or (b) a function-component
expansion helper. Both are bigger pieces of work.
This PR gets us the wiring without committing to that path. The
producer is real, the boundary is proven on real data, and the
shape is stable enough for the Rust side to test against. When
lowering matures, only the body of `useSceneTrace` changes; the
call site in App stays one line.
Surface area in App.tsx
Three lines added:
existing `isStreaming` selector.
call after the existing `busyRef` effect.
No state ownership changes, no render-tree changes, no behavior
change when the env var is unset (which is the default).
Refs #868 #947