Repository navigation
refactor(screens): extract idle-return-hint useEffect body (audit 1.1.1 slice #34) - #207
Merged
Merged
Conversation
….1 slice #34) Slice #34 of #170 REPL god-module split. Extract the idle-return-hint useEffect body (5 early-return guards + setTimeout with 5 stale-closure-bypass positional args generating Ink <Text> JSX for the hint_v2 variant + logEvent + cleanup) into maybeScheduleIdleReturnHint() in src/screens/idleReturnHint.tsx. PURE-ROUTING SUB-BLOCK class (6th, like slice #29 maybeSendIdleNotification). The function returns the setTimeout handle so the kept-thin useEffect cleanup (clearTimeout + removeNotification + ref reset) still works byte-identically. JSX-generating extract -> .tsx + Text import from ../ink.js. 5 setTimeout-arg + 2 guard dep + removeNotification pass via ctx object; getFeatureValue_CACHED_MAY_BE_STALE/logEvent/AnalyticsMetadata/getGlobalConfig/ getTotalInputTokens/formatTokens imported directly. removeNotifications path checked: formatTokens became import-only (sole user moved) -> removed from REPL; getFeatureValue/getGlobalConfig/getTotalInputTokens/Text/logEvent/ AnalyticsMetadata still multi-use -> kept. Gates: typecheck 0 errors / 921 pass / biome new-file-clean / build:dev pass. REPL 5754 -> 5703 (-51 net: -59 body, +8 thin shell). Byte-identical behavior. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Slice #34 of #170 REPL god-module split.
Change
Extract the idle-return-hint
useEffectbody (5 early-return guards +setTimeoutwith 5 stale-closure-bypass positional args generating Ink<Text>JSX for thehint_v2variant +logEvent+ cleanup) intomaybeScheduleIdleReturnHint()insrc/screens/idleReturnHint.tsx.Class: PURE-ROUTING SUB-BLOCK (6th, like slice #29
maybeSendIdleNotification). The function returns thesetTimeouthandle so the kept-thinuseEffectcleanup (clearTimeout+removeNotification+ ref reset) still works byte-identically. JSX-generating extract →.tsx+Textimport from../ink.js.Extraction pattern
setTimeout-arg + 2 guard dep +removeNotificationpass via ctx objectgetFeatureValue_CACHED_MAY_BE_STALE/logEvent/AnalyticsMetadata/getGlobalConfig/getTotalInputTokens/formatTokensimported directly (NOT via ctx)useEffectkept as thin shell:const timer = maybeScheduleIdleReturnHint({...}); return () => { if (timer) clearTimeout(timer); ... }Import cleanup
formatTokensbecame import-only in REPL (sole user moved) → removed from REPL (slice feat: 代码生成 API — 供协作空间调用 #22 import-cleanup-after-extraction lesson)getFeatureValue/getGlobalConfig/getTotalInputTokens/Text/logEvent/AnalyticsMetadatastill multi-use → keptGates
bun run typecheck→ 0 errorsbun test src/__tests__/→ 921 pass, 0 failbunx biome checkon new file only → clean (--write applied to new file only per churn-avoidance rule)bun run build:dev→ passImpact
REPL 5754 → 5703 (−51 net: −59 body, +8 thin shell). Byte-identical behavior.
Co-Authored-By: Claude Fable 5 [email protected]