refactor(runtime): foundation for surface-context migration (#1237)#1292
Merged
Conversation
Groundwork for migrating workstation surfaces off threaded props onto LogInkRuntimeContext (the remaining open half of #1237 / #1136). No surface migrated yet — this lands the machinery the per-surface PRs consume. - Grow `LogInkRuntimeContextValue` with the set-once / app-wide values surfaces still receive as props: `contextStatus` and the injected render primitives `h` + `components`. (react/ink are dynamic-imported at boot, so a surface component can't `import` them — they ride in the context.) Provider value in app.ts populates the three new fields. - Add `useSurfaceRenderContext(React, panel)` — rebuilds the `SurfaceRenderContext` a `render*Surface` fn already expects from the context, so the proven (snapshot-tested) render logic moves unchanged; only how it sources its inputs changes. `panel` selects main vs detail width. - Add `defineSurfaceComponent(React, renderFn, opts)` — wraps a zero-extra render fn into a thin context-reading component (the common case for the first migration batch). - Tests: fake-React harness (mirrors the hook-test pattern) covering the read path, identity pass-through, panel width selection, and the component wrapper. header.test.ts updated for the grown value shape.
This was referenced Jun 17, 2026
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.
What
Groundwork for the remaining open half of #1237 / #1136 — migrating workstation surfaces off threaded props onto
LogInkRuntimeContext. The 0.72.1 state-cluster split is done; this starts the surface migration. No surface is migrated in this PR — it lands only the machinery the per-surface PRs consume, so it's behavior-preserving.Changes
LogInkRuntimeContextValuewith the set-once / app-wide values surfaces still receive as props:contextStatus+ the injected render primitiveshandcomponents. (react/ink are dynamic-imported at boot, so a surface component can'timportthem — they ride in the context.) The provider value inapp.tspopulates the three new fields.useSurfaceRenderContext(React, panel)— rebuilds theSurfaceRenderContextarender*Surfacefn already expects, from the context. The proven, snapshot-tested render logic moves unchanged; only how it sources inputs changes.panelselects main vs detail width.defineSurfaceComponent(React, renderFn, opts)— wraps a zero-extra render fn into a thin context-reading component (the common case for the first migration batch).Tests
Fake-React harness (mirrors the established hook-test pattern, no renderer needed): read path,
null-context throw, identity pass-through, main/detail width selection, and the component wrapper.header.test.tsupdated for the grown value shape (the header is already a context consumer).Validation
tsc --noEmitclean · full jest green (runtimeContext 9/9, header 6/6, 68 snapshots) · eslint 0 errors ·rollup -cbuilds. (The 4tsTreeSitterParser.wasm-backedfailures are the known worktree WASM-grammar gotcha — unrelated,src/lib/parsers, fail identically onmainhere.)Next
PR 2 migrates the 8 zero-extra surfaces (status, conflicts, remotes, submodules, reflog, pullRequest, issuesTriage, pullRequestTriage) onto these helpers. Full ladder in
specs/surface-context-migration-plan.md.