Skip to content

refactor(runtime): foundation for surface-context migration (#1237)#1292

Merged
gfargo merged 1 commit into
mainfrom
feat/surface-context-foundation
Jun 17, 2026
Merged

refactor(runtime): foundation for surface-context migration (#1237)#1292
gfargo merged 1 commit into
mainfrom
feat/surface-context-foundation

Conversation

@gfargo

@gfargo gfargo commented Jun 17, 2026

Copy link
Copy Markdown
Owner

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

  • Grow LogInkRuntimeContextValue with the set-once / app-wide values surfaces still receive as props: contextStatus + the injected render primitives h and components. (react/ink are dynamic-imported at boot, so a surface component can't import them — they ride in the context.) The provider value in app.ts populates the three new fields.
  • useSurfaceRenderContext(React, panel) — rebuilds the SurfaceRenderContext a render*Surface fn already expects, from the context. The proven, snapshot-tested render logic moves unchanged; only how it sources inputs changes. panel selects 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.ts updated for the grown value shape (the header is already a context consumer).

Validation

tsc --noEmit clean · full jest green (runtimeContext 9/9, header 6/6, 68 snapshots) · eslint 0 errors · rollup -c builds. (The 4 tsTreeSitterParser .wasm-backed failures are the known worktree WASM-grammar gotcha — unrelated, src/lib/parsers, fail identically on main here.)

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.

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.
@gfargo gfargo merged commit 9722485 into main Jun 17, 2026
16 checks passed
@gfargo gfargo deleted the feat/surface-context-foundation branch June 17, 2026 14:19
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