Repository navigation
refactor(screens): extract showSpinner derive into spinnerState (audit 1.1.1) - #175
Merged
Merged
Conversation
…t 1.1.1) Third spinner-visibility derive (onlySleepToolActive/stopHookSpinnerSuffix landed in #171) now joined by deriveShowSpinner — completes the spinner cluster in utils/spinnerState.ts. REPL.tsx 2034-2053 inline 20-line boolean expression moved out as a pure helper taking an aggregate input object (11 deps). Byte-identical: helper body is the original expression verbatim; deps passed eagerly (getCommandQueueLength has no side effects, only reads .length). REPL keeps the toolJSX/queue/isLoading/etc bindings and calls deriveShowSpinner once. -6 LOC off the god module (6715 -> 6709). Types aligned to real sources: userInputOnProcessing is string|undefined (truthy-checked as in original), pendingWorkerRequest {toolName}|null. 15 new unit tests (spinnerStateShowSpinner.test.ts) cover each gate: toolJSX showSpinner flag, confirm/prompt queue gating, 4 busy arms (loading/userInput/teammates/queue), pendingWorkerRequest suppress, onlySleepToolActive suppress, visibleStreamingText suppress + isBriefOnly exemption, all-suppressors case. Gates: typecheck 0 / 750 tests (+15) / lint 4601 net-zero / build:dev 3763. Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 28, 2026
…State (audit 1.1.1) (#176) (#177) Sixth surgical extraction for audit §1.1.1 god-module split. Bundle 3 chained pure derives out of REPL.tsx (was 5748-5769): - usesSyncMessages (showStreamingText||!isLoading) - displayedMessages (agent view|sync|deferred, ref-preserving) - placeholderText (input-baseline gate) src/utils/messageDisplayState.ts NEW — deriveUsesSyncMessages + deriveDisplayedMessages + derivePlaceholderText + aggregate deriveMessageDisplayState. No React, no hooks, deps as args. Returns ORIGINAL array refs (no spread copy) — preserves ref-identity for Messages memo + length checks downstream. Byte-identical to inline. REPL keeps useDeferredValue(messages) + userInputBaselineRef ref; calls deriveMessageDisplayState once, destructures to SAME const names → downstream reads unchanged. Picked 7-dep bundle over survey #1 getFocusedInputDialog (90 LOC but 23 deps) — strategy = fewest-dep pure-helper = lowest byte-identical risk (per proven PR #174/#175 pattern). Tests: messageDisplayState.test.ts 19 tests — usesSyncMessages 3 arms, displayedMessages ref-identity + agent-override + empty-array, placeholderText baseline gate + agent suppress, aggregate 7 cases including ref-identity assertion (not a copy). REPL.tsx 6709 → 6696 (−13). Cumulative off 7096: #168(−285)+#171(−70)+#172(−9)+#174(−17)+#175(−6)+#176(−13) = −400 LOC. Gates: typecheck 0 / 769 tests (+19) / lint net-zero 4601 / build:dev 3764. Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Aug 28, 2026
Merged
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.
Audit §1.1.1 — god-module split, 5th surgical slice
Extracts the third spinner-visibility derive (
deriveShowSpinner) fromREPL.tsxintoutils/spinnerState.ts, completing the spinner cluster started in #171 (onlySleepToolActive+stopHookSpinnerSuffix).Change
REPL.tsx:2034-2053— 20-line inline boolean expression → singlederiveShowSpinner({...})call (12 lines).utils/spinnerState.ts— +deriveShowSpinner+ShowSpinnerInputtype +ToolJsxSpinnerLikeminimal shape. Helper body is the original expression verbatim.toolJSX,toolUseConfirmQueue,isLoading,userInputOnProcessing,hasRunningTeammates,getCommandQueueLength(),pendingWorkerRequest,onlySleepToolActive,visibleStreamingText,isBriefOnly) and passes them eagerly as an aggregate input object.Byte-identical
getCommandQueueLength()has no side effects (reads.lengthonly) → eager evaluation safe; original short-circuit only avoided the call, not a side effect.userInputOnProcessing: string | undefined(truthy-checked, matches REPL:1138useState<string | undefined>),pendingWorkerRequest: { toolName: string } | null(matches AppStateStore:384).Tests
src/__tests__/utils/spinnerStateShowSpinner.test.ts— 15 new tests covering each gate: toolJSXshowSpinnerflag (true/false), confirm/prompt queue gating (before busy), 4 busy arms (loading / userInput / teammates / commandQueue),pendingWorkerRequestsuppress,onlySleepToolActivesuppress,visibleStreamingTextsuppress +isBriefOnlyexemption, combined all-suppressors case.Gates
bun run typecheckbun test src/__tests__/bun run lintbun run build:devGod-module reduction
REPL.tsx 6715 → 6709 LOC (−6). Cumulative off the 7096-LOC original: #168 (−285) + #171 (−70) + #172 (−9) + #174 (−17) + this (−6) = −387 LOC.
Continues the 4-6wk §1.1.1 split per [[audit-1-1-1-repl-split-checkpoint]]. Each slice independently mergeable.
Co-Authored-By: Claude Fable 5 [email protected]