Skip to content

feat(desktop): migrate Paper Ops, System, Experiments to native-hosted surfaces (#410)#426

Merged
Whiteks1 merged 5 commits intomainfrom
codex/issue-410-migrate-paper-ops-system-experiments
Apr 20, 2026
Merged

feat(desktop): migrate Paper Ops, System, Experiments to native-hosted surfaces (#410)#426
Whiteks1 merged 5 commits intomainfrom
codex/issue-410-migrate-paper-ops-system-experiments

Conversation

@Whiteks1
Copy link
Copy Markdown
Owner

@Whiteks1 Whiteks1 commented Apr 20, 2026

Summary

Migrate Paper Ops, System, and Experiments surfaces from research_ui iframe delegation to native-hosted surfaces in the canonical desktop shell.

Framing: This is a native-hosted migration using existing canonical render logic, not a deep React rewrite.

Changes

Components Created

  • PaperOpsPane.jsx — Native surface wrapping renderPaperOpsTab(). Broker boundary, decision queue, operational continuity.
  • SystemPane.jsx — Native surface wrapping renderSystemTab(). Runtime diagnostics, workspace status, logs.
  • ExperimentsPane.jsx — Native surface wrapping renderExperimentsTab(). Config catalog, sweeps, decision tracking.

Routing Updated

  • MainContent.jsx — Added conditional renders for paper, system, experiments tab kinds. Updated legacy fallback condition to exclude these kinds from iframe delegation.

Documentation Updated

  • PRODUCT_SURFACES.md — Moved Paper Ops, System, Experiments from secondary/legacy iframe category to secondary/support as native-hosted surfaces.

Scope

In:

  • Paper Ops, System, Experiments surfaces native-hosted
  • Use existing render functions (1:1 behavioral port)
  • MainContent routing wiring
  • Product surfaces inventory update

Out:

  • Launch / Job surfaces (remain iframe)
  • Sweep Decision surface (frozen)
  • Shell bootstrap work
  • Product redesign or deep refactoring

Validation Status

Passed

  • npm run typecheck — no type errors
  • npm run build — clean build (artifacts identical to origin/main)
  • node --test tests/snapshot-status.test.mjs — 4/4 tests pass
  • git diff --check — no whitespace violations

Known Issue (Pre-Existing, Not From #410)

Shell Bootstrap Smoke Regression — Refs #427

Both npm run smoke:fallback and npm run smoke:real-path fail with:

shellReady: false
hasShell: false
error: "run detail unavailable (activeId=..., hasTabsBar=true, hasShell=false)"

Status: Pre-existing on origin/main. Identical failure state confirmed:

Root Cause: Shell initialization/bootstrap, unrelated to surface routing logic. Likely from #409 native run detail work.

Impact: Blocks strict DoD compliance (DoD expects smoke green), but does not represent a #410-introduced regression.

Tracking: Issue #427 — "fix(desktop): resolve shell bootstrap hasShell=false smoke regression"

Mergeability

#410 is mergeable with explicit acceptance that:

  1. Smoke failure is pre-existing (not a desktop(migration): paper ops, system, and experiments native surfaces #410 regression)
  2. Failure root cause is outside desktop(migration): paper ops, system, and experiments native surfaces #410 scope (shell bootstrap, not surface routing)
  3. desktop(migration): paper ops, system, and experiments native surfaces #410 does not worsen smoke state
  4. Shell bootstrap must be resolved separately via fix(desktop): resolve shell bootstrap hasShell=false smoke regression #427 or as part of desktop(migration): run detail and artifact explorer native surfaces #409 hardening

DoD Compliance: Conditional. Passes all direct checks; smoke failure is pre-existing and tracked separately via #427. Merge only if pre-existing shell bootstrap issue (#427) is accepted as known blocker outside this slice.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 20, 2026

Reviewer's Guide

Migrates the Paper Ops, System, and Experiments tabs from research_ui iframe delegation to native-hosted React panes in the desktop shell by wiring them into MainContent routing while reusing existing tab render functions, and updates product-surface documentation accordingly.

Sequence diagram for native rendering of Paper Ops tab

sequenceDiagram
  actor User
  participant DesktopApp
  participant MainContent
  participant PaperOpsPane
  participant QuantLabContext
  participant renderPaperOpsTab
  participant LegacyAppJS

  User->>DesktopApp: select tab kind paper
  DesktopApp->>MainContent: render with activeTab.kind paper
  MainContent->>MainContent: detect native kind (paper)
  MainContent->>PaperOpsPane: mount component with tab

  PaperOpsPane->>QuantLabContext: useQuantLabContext()
  QuantLabContext-->>PaperOpsPane: state (snapshot, runs, launchControl, decisionStore, decisionCompare)

  PaperOpsPane->>PaperOpsPane: build ctx for renderPaperOpsTab
  PaperOpsPane->>renderPaperOpsTab: renderPaperOpsTab(ctx)
  renderPaperOpsTab-->>PaperOpsPane: html string
  PaperOpsPane->>PaperOpsPane: setHtml(html)

  PaperOpsPane->>DesktopApp: render div with dangerouslySetInnerHTML
  DesktopApp->>LegacyAppJS: bind legacy event listeners to rendered DOM
  User->>DesktopApp: click action button in Paper Ops surface
  DesktopApp->>LegacyAppJS: handle click via event delegation
  LegacyAppJS-->>DesktopApp: perform side effects (launch, navigation, updates)
Loading

Class diagram for new native panes and routing

classDiagram
  class MainContent {
    +activeTab
    +allTabs
    +onTabChange
    -legacyContainerRef
    +useEffect()
    +render()
  }

  class PaperOpsPane {
    +tab
    -html
    +useEffect()
    -buildContext(state)
    -handleRenderError(error)
    +render()
  }

  class SystemPane {
    +tab
    -html
    +useEffect()
    -buildContext(state)
    -handleRenderError(error)
    +render()
  }

  class ExperimentsPane {
    +tab
    -html
    +useEffect()
    -buildContext(state, tab)
    -handleRenderError(error)
    +render()
  }

  class QuantLabContext {
    +state
    +useQuantLabContext()
  }

  class TabRenderers {
    +renderPaperOpsTab(ctx)
    +renderSystemTab(ctx)
    +renderExperimentsTab(tab, ctx)
  }

  MainContent --> PaperOpsPane : renders when activeTab.kind paper
  MainContent --> SystemPane : renders when activeTab.kind system
  MainContent --> ExperimentsPane : renders when activeTab.kind experiments

  PaperOpsPane --> QuantLabContext : reads state via hook
  SystemPane --> QuantLabContext : reads state via hook
  ExperimentsPane --> QuantLabContext : reads state via hook

  PaperOpsPane --> TabRenderers : calls renderPaperOpsTab
  SystemPane --> TabRenderers : calls renderSystemTab
  ExperimentsPane --> TabRenderers : calls renderExperimentsTab
Loading

File-Level Changes

Change Details Files
Add native-hosted Paper Ops, System, and Experiments panes that wrap existing tab render functions instead of using iframes.
  • Introduce PaperOpsPane, SystemPane, and ExperimentsPane React components using useQuantLabContext for app state access.
  • Build per-surface context objects (workspace, runs, launch jobs, decisions, experiments workspace, sweep decisions) and pass them into renderPaperOpsTab, renderSystemTab, and renderExperimentsTab.
  • Render the returned HTML strings via dangerouslySetInnerHTML as a temporary bridge, with basic error handling that logs failures and shows a placeholder message.
desktop/renderer/components/PaperOpsPane.jsx
desktop/renderer/components/SystemPane.jsx
desktop/renderer/components/ExperimentsPane.jsx
Update main desktop routing so paper, system, and experiments tabs render via the new native panes instead of the legacy iframe/DOM path.
  • Extend the allowlist of native-handled tab kinds in MainContent so paper, system, and experiments no longer fall through to the legacy DOM container.
  • Add conditional React renders for PaperOpsPane, SystemPane, and ExperimentsPane based on activeTab.kind.
  • Keep the legacy container for truly legacy kinds only (job, sweep-decision, iframe, etc.).
desktop/renderer/components/MainContent.jsx
Refresh product-surface documentation to reflect the new native-hosted ownership and iframe status for Paper Ops, System, and Experiments.
  • Update PRODUCT_SURFACES inventory table to mark Paper Ops, System, and Experiments as desktop-native keep surfaces without iframes, describing their behavior and render functions.
  • Remove their prior classification as iframe-based migrate/freeze surfaces and adjust the iframe-delegation matrix to show them as non-iframe.
  • Bump the last-updated date on the product surfaces document.
desktop/docs/PRODUCT_SURFACES.md

Possibly linked issues

  • #desktop(renderer): migrate paper ops system and experiments surfaces: PR implements the issue’s requested migration of Paper Ops, System, Experiments to native-hosted renderer surfaces.
  • desktop(migration): paper ops, system, and experiments native surfaces #410: El PR realiza exactamente la migración de Paper Ops, System y Experiments a superficies nativas solicitada en el issue.
  • #N/A: PR’s PaperOpsPane and routing changes deliver the requested native Paper Ops v1 shell integration and supervision flow.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In SystemPane and ExperimentsPane, the useEffect dependency arrays are missing some of the state fields used inside the effect (e.g., state.launchControl?.jobs, state.decision, state.decisionStore, state.sweepDecision, state.runs), which can lead to stale HTML when those parts of state change; consider adding all referenced state slices to the dependencies.
  • The three new panes (PaperOpsPane, SystemPane, ExperimentsPane) share a similar pattern of pulling from QuantLabContext, building a ctx object, and using dangerouslySetInnerHTML; you might factor out a small shared helper or hook to reduce duplication and keep the bridging logic consistent across surfaces.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In SystemPane and ExperimentsPane, the useEffect dependency arrays are missing some of the state fields used inside the effect (e.g., `state.launchControl?.jobs`, `state.decision`, `state.decisionStore`, `state.sweepDecision`, `state.runs`), which can lead to stale HTML when those parts of state change; consider adding all referenced state slices to the dependencies.
- The three new panes (PaperOpsPane, SystemPane, ExperimentsPane) share a similar pattern of pulling from QuantLabContext, building a ctx object, and using dangerouslySetInnerHTML; you might factor out a small shared helper or hook to reduce duplication and keep the bridging logic consistent across surfaces.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Whiteks1 Whiteks1 merged commit 7a1545a into main Apr 20, 2026
3 checks passed
@Whiteks1 Whiteks1 deleted the codex/issue-410-migrate-paper-ops-system-experiments branch April 20, 2026 14:12
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