Repository navigation
desk-web: build and test under the React Compiler, as the Electron app does - #106
Merged
Merged
Conversation
…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
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
Author
|
Gates for head dee1ea9:
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook) |
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.
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
apps/desk-web/vite.config.tsnow useselectron.vite.config.ts'sreact({ babel: { plugins: ['babel-plugin-react-compiler'] } })with the compiler's defaults.babel-plugin-react-compileris added to desk-web's devDependencies at the root's range (^1.0.0, which resolves to 1.0.0). e2e:desk-web runsvite buildbefore it runs, so it drives the compiled app.apps/desk-web/vitest.config.tsbuilds the suites with the same plugin.src/compiled.test.tsxchecks 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".apps/desk-web/src, as it already coverssrc/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 inhub/project-client.ts's backoff, and four in tests.model, whichDeskTranscriptupdates as rows arrive.derive.tsduring render. Compiled, the element was kept, so a derivation run while the dialog was open, such as adding a passphrase method, never appeared.derive.tsnow notifies listeners, and the line subscribes withuseSyncExternalStore. A new case inKeyDialog.test.tsxfails without the fix.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/srcand 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:DiffPane'sinitialScrollTop={ui.getState().scrollTop}, was dismissed. In the compiled output that expression is recomputed together with theReviewViewelement, whose memo depends onfile.path.It found nothing in the other classes:
++is in a plain function.What the compiler skips, so the desk still runs those functions plain:
trywithoutcatchor withfinally,??=,||=, and updating a variable captured in a lambda. In desk-web this coversKeyDialog,UnlockForm,NewMethodForm,OrgMethodForm,CodeSteps,LatencyOverlay,SessionView,landed-message,land-on-cardandQuestionOverlay.exhaustive-depssuppressions inSessionView(twice),drawn-rowsandkeep-place.Transcript,Rows,Tools,Divider,Group,parts,PeerComposer, the composer's files,SandboxedPreview,Notice,ModeMenu,focus,siteandanswering.The skip list is the same one the Electron app already ships with for the shared files.
Logged, not fixed
exhaustive-depssuppression makes the compiler skip them:SessionView,drawn-rows, and the sharedTranscript'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.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
eslintand desk-web'stypecheckare clean, andvite buildsucceeds.scripts/ci-gate.sh --gates static,unit,e2e:desk-webresults follow in a comment.doperpowers:reviewer-mediumwith 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)