refactor: shrink the renderer's first-load chunk and remove three duplicated authorities - #4100
Closed
Astro-Han wants to merge 5 commits into
Closed
refactor: shrink the renderer's first-load chunk and remove three duplicated authorities#4100Astro-Han wants to merge 5 commits into
Astro-Han wants to merge 5 commits into
Conversation
The feature barrel statically re-exported `WorkbarSurface`, and `app-shell` imports `WorkbarHost` from that barrel, so the surface and its five nested lazy tool panels landed in the eager chunk anyway. rolldown named it: INEFFECTIVE_DYNAMIC_IMPORT. Move the export to the `testing` entry, which the feature boundary test already recognizes as public and nothing shipped imports, and point the two Storybook consumers there. Renderer entry chunk 2,245.33 kB -> 2,166.20 kB (gzip 451.12 -> 426.86), with `workbar-surface` now emitted as its own 81.31 kB chunk, and the build warning is gone.
Four workbar files reached `ComposerProps` through a seven- or eight-level relative path into `packages/ui/dist/composer.d.ts`, a build artifact. `@maka/ui` already exports the type, and all four files already import from it.
`assistant-stream` and `thinking-stream` were two copies of one authority: identical Options/Result shapes, the same five-step redact-append-cap pipeline, the same non-string guard, structurally identical complete paths. They differed only in caps, marker strings, and which end of an over-cap buffer survives — a direction `streaming-display-redaction` already parameterizes as `recovery`. `stream-delta` now owns the pipeline; the two modules keep their exported names, caps, and option types as thin wrappers that supply their own spec. Head-keep's short-circuit on a frozen buffer is now expressed as a property of `recovery: 'head'` rather than of the assistant stream, which is what it always was. `tool-output-stream` stays separate: it accumulates a chunk array with dedup-by-seq, a different problem.
The first two render-phase branches reseeded `activation` with a byte-identical object literal, so they are one condition. The third branch clears `initialLiveContent` and stays as it is. The snapshot passed to `ChatView` also dropped its session guard: every branch reseeds `sessionId` to `activeSessionId`, and a render-phase setState re-runs the component body before anything commits, so the mismatched arm could never reach the DOM.
The layout effect deliberately runs on every render, and it wrote `tabIndex` on every row each time. An identical assignment still invalidates style and forces synchronous layout — DevTools charged the loop 224ms of reflow across the module pages that use it. Compare before assigning. A freshly mounted row still gets its tabindex, because it arrives at the default 0.
Astro-Han
force-pushed
the
claude/eager-rosalind-e4b5f3
branch
from
August 28, 2026 15:54
d653320 to
0309897
Compare
Astro-Han
marked this pull request as ready for review
August 28, 2026 15:56
Contributor
Author
|
Reopened as a branch that follows the repo's |
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.
Five simplification-audit findings in the desktop renderer and
packages/ui. All internal; no user-visible behavior changes.This is not a fix for the session-switch jank. The measured session-switch cost (9 long tasks, 717 ms, CLS 0.55) has a different, still-unidentified cause and is tracked separately. What is here is bundle size, one duplicated authority removed, and two boundary escape hatches closed.
Bundle size
The workbar feature barrel statically re-exported
WorkbarSurfacewhileworkbar-hostreaches it throughlazy(() => import('./workbar-surface')). Becauseapp-shellimportsWorkbarHostfrom that barrel, the static edge dragged the 917-line surface and its five nested tool panels into the eager chunk — rolldown reportedINEFFECTIVE_DYNAMIC_IMPORT.Two Storybook files did import
WorkbarSurfacefrom the barrel. The export moves to the feature'stestingentry — already recognized as public byworkbar-boundary.test.ts, and imported by nothing that ships — and the stories follow it there.workbar-surfacechunkINEFFECTIVE_DYNAMIC_IMPORTOne duplicated authority
assistant-streamandthinking-streamwere two implementations of one concept — identical Options/Result shapes, the same redact-append-cap pipeline, the same non-string guard, structurally identical complete paths. They differed only in caps, marker strings, and which end of an over-cap buffer survives, andstreaming-display-redactionalready parameterizes that asrecovery: 'head' | 'tail'.stream-deltanow owns the pipeline. Both modules keep their exported names, cap constants, and option types as thin wrappers. Head-keep's short-circuit on a frozen buffer is now expressed as a property ofrecovery: 'head', which is what it always was — tail-keep has no fixed point, so it is unaffected.tool-output-streamis deliberately left alone: it accumulates a chunk array with dedup-by-seq, a different problem.Two boundary escape hatches
Four workbar files imported
ComposerPropsthrough a seven- or eight-level relative path intopackages/ui/dist/composer.d.ts, a build artifact.@maka/uiexports the type and all four already import from it.Two local simplifications
chat-message-surface: the first two render-phase activation branches calledsetActivationwith a byte-identical literal — now one condition. The snapshot handed toChatViewalso dropped a session guard whose else branch was unreachable: every branch reseedssessionIdtoactiveSessionId, and a render-phase setState re-runs the body before anything commits.use-roving-row-focus: the dependency-array-free layout effect (deliberate, and left that way) wrotetabIndexon every row on every render. An identical write still invalidates style and forces synchronous layout — DevTools charged it 224 ms of reflow. It now compares first. This helps the module pages that use the hook (skills, scheduled tasks, MCP); the chat transcript does not use it.Verification
npm run format,npm run check:asf-headers,biome lintover the touched trees@maka/uibuild + fullpackages/uitest suitetsconfig.renderer.jsonandtsconfig.storybook.jsontypechecksapps/desktop/src/main/__tests__/{assistant,thinking}-stream.test.ts— 12/12vite buildof the renderer, A/B against the same tree with the barrel export restoredworkbar-boundary.test.ts— 6/6