Skip to content

desk-web: build and test under the React Compiler, as the Electron app does - #106

Merged
SSFSKIM merged 4 commits into
masterfrom
desk-web-react-compiler
Oct 21, 2026
Merged

SSFSKIM merged 4 commits into
masterfrom
desk-web-react-compiler

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 21, 2026

Copy link
Copy Markdown
Owner

The desk now ships MAWS's renderer modules in the same configuration as the Electron app, and desk-web's tests run that compiled code.

What changed

  • Build. apps/desk-web/vite.config.ts now uses electron.vite.config.ts's react({ babel: { plugins: ['babel-plugin-react-compiler'] } }) with the compiler's defaults. babel-plugin-react-compiler is added to desk-web's devDependencies at the root's range (^1.0.0, which resolves to 1.0.0). e2e:desk-web runs vite build before it runs, so it drives the compiled app.
  • Tests. apps/desk-web/vitest.config.ts builds the suites with the same plugin. src/compiled.test.tsx checks this. A memoized element keeps its child from re-rendering with its parent. That test fails under master's plain config, with "called 2 times".
  • Lint. ESLint's L154 rule now covers apps/desk-web/src, as it already covers src/renderer. The rule exists because a read postfix ++/-- can compile to the prefix form. It found five reads in four files. None was inside a compiled function. All are rewritten without changing behaviour: one in hub/project-client.ts's backoff, and four in tests.
  • Two compiled-only bugs found by the audit, fixed:
    • SubagentDetail's header. When the agent's meta named no model, the header read it from the controller's held rows during render. Compiled, that read was cached on the controller, so the header kept showing "model unknown". It now reads the transcript state's model, which DeskTranscript updates as rows arrive.
    • KeyDialog's passphrase-work line. It read a module variable in derive.ts during render. Compiled, the element was kept, so a derivation run while the dialog was open, such as adding a passphrase method, never appeared. derive.ts now notifies listeners, and the line subscribes with useSyncExternalStore. A new case in KeyDialog.test.tsx fails without the fix.
  • Tech debt. Three rows added to docs/tech-debt-tracker.md; see "Logged, not fixed".

Audit

I ran the compiler's logger over every non-test file in apps/desk-web/src and every MAWS module the desk's graph reaches: 598 files. 460 functions compiled and 36 were skipped. An opus audit then read every compiled component and hook in desk-web, and the shared modules on paths only the desk takes. It found three behaviour changes:

  • The two fixed above.
  • A third, in DiffPane's initialScrollTop={ui.getState().scrollTop}, was dismissed. In the compiled output that expression is recomputed together with the ReviewView element, whose memo depends on file.path.

It found nothing in the other classes:

  • No mutation during render.
  • No reliance on identity changing every render.
  • No ref read during render that the lint misses.
  • Every read postfix ++ is in a plain function.

What the compiler skips, so the desk still runs those functions plain:

  • Unsupported syntax, which the compiler 1.0.0 does not handle: try without catch or with finally, ??=, ||=, and updating a variable captured in a lambda. In desk-web this covers KeyDialog, UnlockForm, NewMethodForm, OrgMethodForm, CodeSteps, LatencyOverlay, SessionView, landed-message, land-on-card and QuestionOverlay.
  • exhaustive-deps suppressions in SessionView (twice), drawn-rows and keep-place.
  • Shared modules: Transcript, Rows, Tools, Divider, Group, parts, PeerComposer, the composer's files, SandboxedPreview, Notice, ModeMenu, focus, site and answering.

The skip list is the same one the Electron app already ships with for the shared files.

Logged, not fixed

  • Three memos compile plain only because an exhaustive-deps suppression makes the compiler skip them: SessionView, drawn-rows, and the shared Transcript's report projection. Each relies on a dependency its body never reads to re-read state that changes in place. Removing a suppression without restructuring that memo would make it stale.
  • SubagentRow's working time is event-paced when its ticker is off.
  • A bubble's link is dead. This is not caused by the compiler.

Size

The JS is about 145 kB larger, and 54 kB larger gzipped (3,170,617 → 3,224,334 bytes over dist/assets/*.js).

Gates and review

  • Locally: desk-web's vitest project passes compiled (89 files, 814 tests). eslint and desk-web's typecheck are clean, and vite build succeeds.
  • scripts/ci-gate.sh --gates static,unit,e2e:desk-web results follow in a comment.
  • Review: doperpowers:reviewer-medium with a lens on compiled memoization. Verdict: correct, no findings.

Not done here: dropping the plain duplicate renderer suites from MAWS's unit lane belongs to that lane's owners.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)

…p builds its renderer

vite.config.ts takes electron.vite.config.ts's `react({ babel: { plugins: ['babel-plugin-react-compiler'] } })`, so
the desk ships MAWS's shared renderer modules in the one configuration the Electron app ships them in, and
vitest.config.ts builds desk-web's suites with the same plugin, so they run the code that ships (compiled.test.tsx
fails under the plain build). babel-plugin-react-compiler is declared in desk-web's devDependencies at the root's range.

ESLint's L154 rule (a read postfix ++/-- can compile to the prefix form) now covers apps/desk-web/src as it covers
src/renderer; the five reads it found, none in a compiled function, are rewritten.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…now subscribe to it

A subagent's header, when its meta names no model, read the model from the controller's held rows in render; compiled,
that read is kept on the controller, the node and the ticker, so a finished agent opened before its snapshot landed
kept "model unknown". It reads the transcript state's `model`, which DeskTranscript publishes as rows arrive.

The key dialog's passphrase-work line read derive.ts's module variable in render; compiled, its element is kept, so a
derivation made while the dialog is open (a passphrase method added) never showed. derive.ts now notifies listeners
and the line subscribes through useSyncExternalStore; KeyDialog.test.tsx's new case fails without it.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Three memos that compile plain only through an exhaustive-deps suppression and lean on it; SubagentRow's working
time, event-paced where the ticker is off; a bubble's dead link (found by the audit, not caused by the compiler).

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)

# Conflicts:
#	docs/tech-debt-tracker.md
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-21T11:06:08.431980Z dee1ea9 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.

@SSFSKIM

SSFSKIM commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Gates for head dee1ea9: scripts/ci-gate.sh --gates static,unit,e2e:desk-web is green (run 39589437622).

  • static: passed.
  • unit: 1617 files and 22459 tests passed. desk-web's project ran compiled; src/compiled.test.tsx passed in it, and that test fails under a plain build.
  • e2e:desk-web: 157 passed, all against the compiled dist. That includes depth-subagents.spec.ts's check that an opened agent's header names its model.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)

@SSFSKIM
SSFSKIM merged commit 8315f70 into master Oct 21, 2026
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