Skip to content

refactor(ios): extract the text-entry engine into RunnerTests+TextEntry.swift#651

Merged
thymikee merged 1 commit into
mainfrom
refactor/ios-runner-textentry-file
Jun 1, 2026
Merged

refactor(ios): extract the text-entry engine into RunnerTests+TextEntry.swift#651
thymikee merged 1 commit into
mainfrom
refactor/ios-runner-textentry-file

Conversation

@thymikee
Copy link
Copy Markdown
Member

@thymikee thymikee commented Jun 1, 2026

What

Behavior-preserving file split: move the text-entry concern out of RunnerTests+Interaction.swift (the repo's most-changed file, formerly 1805 lines) into a new RunnerTests+TextEntry.swift. Interaction.swift drops to 1068 lines (−737).

Moved verbatim — no logic changes:

  • value types (TextTypingRepairMode, TextEntryTiming, TextEntryResult, TextEntryTarget)
  • the focus → type → verify → repair pipeline (typeTextReliably + focus orchestration + readiness polling + dropped-char/repair heuristics)
  • clearTextInput and the text-entry leaf helpers (editableTextValue, isPlaceholderValue, isGenericTextInputLabel, normalizedElementText, moveCaretToEnd, estimatedDeleteCount, keyboardBecameVisible, keyboardElementExists)

Why

Interaction.swift mixed five unrelated concerns; text entry alone was >half of it. Splitting it out is the biggest single navigability/token win in the file, with no behavioral surface.

Safety

  • Pure relocation — every symbol keeps its original visibility (no access widened). The moved cluster is text-entry-exclusive: its only callers are within the moved code or the already-internal command entry points (typeTextReliably, focusTextInputForTextEntry, resolveTextEntryMode, isTextEntryElement, waitForTextEntryReadinessAfterTap). The file-local leaf helpers stay private.
  • Shared helpers stay put in Interaction.swift (used by gestures/snapshot/get-text): isKeyboardVisible, visibleKeyboardFrame, textInputAt, textInputCandidatesAt, readableText, prefersExpandedTextRead, findScopeElement.
  • New file is auto-included via the project's file-system-synchronized group (no pbxproj edit).
  • Verified: xcodebuild build-for-testingTEST BUILD SUCCEEDED. Behavior is unchanged by construction (pure move); text entry is exercised by the existing 04-text-input-keyboard.ad smoke replay.

Scope

This is the safe, cosmetic half of the "TextEntry engine" architecture candidate. A deeper extraction (a real TextEntry type behind a seam, making the pipeline unit-testable) is intentionally deferred — it carries the #245 interaction-handler-revert risk and wants stronger text-entry e2e coverage first.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Size Report

Metric Base Current Diff
JS raw 1.1 MB 1.1 MB 0 B
JS gzip 360.5 kB 360.5 kB 0 B
npm tarball 461.4 kB 461.8 kB +369 B
npm unpacked 1.5 MB 1.5 MB +298 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.5 ms 27.7 ms -0.7 ms
CLI --help 43.8 ms 42.6 ms -1.1 ms

Top changed chunks: no changes in the largest emitted chunks.

…ry.swift

Behavior-preserving relocation: move the text-entry concern out of the (formerly 1805-line)
RunnerTests+Interaction.swift — the repo's most-changed file — into a new
RunnerTests+TextEntry.swift. Interaction.swift drops to 1068 lines (-737).

Moved verbatim (no logic changes):
- value types: TextTypingRepairMode, TextEntryTiming, TextEntryResult, TextEntryTarget
- the focus -> type -> verify -> repair pipeline (typeTextReliably + focus orchestration +
  readiness polling + dropped-char/repair heuristics)
- clearTextInput and the text-entry leaf helpers (editableTextValue, isPlaceholderValue,
  isGenericTextInputLabel, normalizedElementText, moveCaretToEnd, estimatedDeleteCount,
  keyboardBecameVisible, keyboardElementExists)

The whole cluster is text-entry-exclusive (its only callers are within the moved code or the
already-internal command entry points), so every symbol keeps its original visibility — no
access widened. Shared helpers used by gestures/snapshot/get-text (isKeyboardVisible,
visibleKeyboardFrame, textInputAt, textInputCandidatesAt, readableText, ...) stay in
Interaction. The new file is auto-included via the project's file-system-synchronized group.

This is the safe, cosmetic half of the "TextEntry engine" architecture candidate. A deeper
extraction behind a real seam/type is intentionally deferred: it carries the #245 revert risk
and wants stronger text-entry e2e coverage first.

Verified: xcodebuild build-for-testing -> TEST BUILD SUCCEEDED. Pure relocation, no behavior change.
@thymikee thymikee force-pushed the refactor/ios-runner-textentry-file branch from 9a71b14 to 7ffc56d Compare June 1, 2026 21:43
@thymikee
Copy link
Copy Markdown
Member Author

thymikee commented Jun 1, 2026

Both findings were stale-base artifacts, not real changes — thanks for catching it. The branch was 2 commits behind main:

My branch never touched runtime-support.ts, react-native.ts, package.json, or server.json; because it predated those commits, the comparison looked like it reverted #650 (the dismissed vs minimized mismatch you flagged is exactly what #650 fixes) and downgraded the version.

Rebased onto latest main (now 7ffc56d1f): version is back to 0.16.8, #650's overlay fix is in the base, and the PR diff is now only the two Swift files (the text-entry relocation). No behavior or metadata change. The rebased commits don't touch ios-runner, so the Swift build is unaffected (CI will recompile).

@thymikee thymikee merged commit 4d016db into main Jun 1, 2026
18 checks passed
@thymikee thymikee deleted the refactor/ios-runner-textentry-file branch June 1, 2026 21:53
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-01 21:53 UTC

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