Skip to content

refactor(screens): extract focusedInputDialog priority cascade (audit 1.1.1) - #179

Merged
dahai80 merged 1 commit into
mainfrom
audit-1.1.1-focused-dialog-selector
Aug 28, 2026
Merged

dahai80 merged 1 commit into
mainfrom
audit-1.1.1-focused-dialog-selector

Conversation

@dahai80

@dahai80 dahai80 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Eighth surgical extraction in the §1.1.1 god-module split (continues PRs #168/#171/#172/#174/#175/#177/#178).

What

The 92-line getFocusedInputDialog() priority cascade (20-literal return union, 18 conditional returns, 23 deps incl. feature("ULTRAPLAN") x2 + isInternalBuild() x2) was inlined in REPL.tsx:2450-2541 and untestable.

Extracted into src/utils/focusedDialogSelector.ts as a pure function (aggregate-input pattern: 23-field FocusedDialogInput → FocusedDialogKind | undefined).

Why

Dialog priority cascade is high-value pure logic (no React, no JSX) but inline → zero unit coverage. Lowest semantic risk despite 23 deps: body is the original expression verbatim, REPL passes all bindings eagerly, downstream reads the same const name → byte-identical.

feature("ULTRAPLAN") + isInternalBuild() are runtime checks (non-React), safe to call from a pure helper. feature() string-literal args are cross-file DCE-safe (precedent: src/utils/slowOperations.ts, src/services/compact.ts).

LOC

REPL.tsx 6691 → 6628 (−63). Cumulative off 7096: −468 LOC (#168 −285, #171 −70, #172 −9, #174 −17, #175 −6, #177 −5, #178 −13, this −63).

Tests

36 new tests cover all 18 reachable return arms + exit/typing/sandbox gates + toolJSX animation gate + ant-only branches + priority ordering. ultraplan-choice/ultraplan-launch arms are compile-time dead under feature-off (test build) and cannot be unit-tested (Rule 9) — documented.

Gates

typecheck 0 / 830 tests (+36) / lint net-zero new-files-clean / build:dev 3766.

Co-Authored-By: Claude Fable 5 [email protected]

…ocusedDialogSelector (audit 1.1.1)

The 92-line getFocusedInputDialog() priority cascade (20-literal return
union, 18 conditional returns, 23 deps incl. feature("ULTRAPLAN") x2 +
isInternalBuild() x2) was inlined in REPL.tsx:2450-2541 and untestable.

Extracted into src/utils/focusedDialogSelector.ts as a pure function
(aggregate-input pattern: 23-field FocusedDialogInput -> FocusedDialogKind
| undefined). feature("ULTRAPLAN") + isInternalBuild() are runtime checks
(non-React), safe to call from a pure helper; feature() string-literal
args are cross-file DCE-safe (precedent: src/utils/slowOperations.ts,
src/services/compact.ts). Byte-identical: body is the original expression
verbatim, REPL passes all bindings eagerly, downstream reads the same
const name.

REPL.tsx 6691 -> 6628 (-63). Cumulative off 7096: -468 LOC.

36 new tests cover all 18 reachable return arms + exit/typing/sandbox
gates + toolJSX animation gate + ant-only branches + priority ordering.
ultraplan-choice/launch arms are compile-time dead under feature-off
(test build) and cannot be unit-tested (Rule 9) -- documented.

Gates: typecheck 0 / 830 tests / lint net-zero new-files-clean / build:dev 3766.

Co-Authored-By: Claude Fable 5 <[email protected]>
@dahai80
dahai80 merged commit fa37fb2 into main Aug 28, 2026
1 check passed
@dahai80
dahai80 deleted the audit-1.1.1-focused-dialog-selector branch August 28, 2026 09:42
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