refactor(daemon): split touch interaction orchestration into semantic modules - #1748
Conversation
d806774 to
b017db4
Compare
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Exact-head review of Please split these suites along coherent production questions—at minimum add the matching press-admission test, and introduce coherent production seams/subquestions for the other newly created over-budget suites—while retaining the shared fixture module and preserving the exact cases/assertions. The retained legacy I found no runtime behavior-preservation defect: the production route remains through |
Closes part of #1691: interaction-touch.ts becomes a router; press, fill, direct-iOS, shared runtime, Android readiness, and response projection each own one module. Behavior is unchanged.
Redistributes all 87 discovered cases across the new module topology and re-keys the two touch-family fallow baseline entries to the paths that now hold the same (net one fewer) findings.
Keeps interaction-touch-press.ts inside the 300-line budget after the complexity decomposition: admission (surface/capability/button policy, target parsing, @ref staleness and mutation admission) answers its own question.
Adds the press-admission suite the production module was missing and splits the four over-budget suites along new production seams (direct-iOS eligibility, Android ref freshness, touch payload). Every suite installs the full device mock set: three Android-session cases regressed to TOOL_MISSING on a runner without adb when the mock set was trimmed per file.
b017db4 to
073f852
Compare
|
Addressed on Three new production seams carry the three over-budget suites that had no sibling to split along:
Both splits follow a real consumer boundary, not a line count: eligibility is what The press-admission suite you asked for exists ( Final suite sizes: touch 228 · press-admission 428 · press 416 · fill 395 · direct-ios-eligibility 288 · direct-ios 343 · runtime 361 · android-readiness 314 · android-freshness 352 · response 456 · payload 423 · fixtures 227. The shared fixture module is retained and grew to hold the Manifest identity re-verified after the second split: the sorted Vitest name list is byte-identical to One real defect the Coverage lane caught, now fixed. Trimming the mock set per file made three Android-session cases depend on the host toolchain — without Fallow: the baseline re-key is now net −1 against 🤖 Addressed by Claude Code |
|
Re-reviewed exact head 073f852. The prior architecture blocker is fixed: every new touch production and test module is below the 500-line tripwire, and |
|
Closes #1691; prework for #1739 (wave 5).
Behavior-preserving decomposition of
src/daemon/handlers/interaction-touch.ts(1,052 lines) into semantic modules, with the test suites split 1:1 along the same questions. No guarantee matrix, response shape, session field, command descriptor, or platform behavior changed.Production module map
interaction-touch.tsinteraction-touch-press-admission.ts@refstaleness + ADR 0014 mutation admission)interaction-touch-press.tsinteraction-touch-fill.tsfilladmitted, parameterized, executed, and projected?interaction-touch-direct-ios-eligibility.tsinteraction-touch-direct-ios.tsinteraction-touch-runtime.tsinteraction-touch-android-readiness.tsinteraction-touch-android-freshness.ts@refmutation?interaction-touch-response.tsinteraction-touch-payload.tsImport DAG (no back-edges, no barrel, no forwarding wrappers):
Test topology (1:1 with production)
interaction.test.ts(3,987 lines, 86 cases) +interaction-android-recovery-abort.test.ts(1 case) were redistributed. The sorted Vitest name manifest is identical before and after — 87 unique names, no rename, no rewritten assertion, bodies moved verbatim.interaction-touch.test.tsinteraction-touch-press-admission.test.tsinteraction-touch-press.test.tsinteraction-touch-fill.test.tsinteraction-touch-direct-ios-eligibility.test.tsinteraction-touch-direct-ios.test.tsinteraction-touch-runtime.test.tsinteraction-touch-android-readiness.test.tsinteraction-touch-android-freshness.test.tsinteraction-touch-response.test.tsinteraction-touch-payload.test.tsinteraction-touch-fixtures.ts(shared pure factories)interaction.test.ts(retainedget/islegacy)Every touch suite is under the 500-line extraction tripwire. The retained
interaction.test.tsholds only non-touchget/iscases and is acknowledged pre-existing debt (AGENTS.mdnames it as shrinking opportunistically).interaction-android-recovery-abort.test.tsis deleted; its regression lives in the readiness suite, which spies onensureAndroidBlockingSystemDialogReadyand delegates to the real implementation by default so the neighbouring cases keep exercising it.Every suite installs the same device mock set. Trimming mocks per file made three Android-session cases depend on the host toolchain: without
adbon PATH they returnedTOOL_MISSINGinstead ofCOMMAND_FAILED(caught by the Coverage lane, reproduced locally by removingadbfrom PATH, and re-verified green that way).Deliberate deviations from the plan in #1691
press-admission,direct-ios-eligibility,android-freshness,payload. The first came from removing thefallow-ignore-next-line complexitywaiver the plan asks for (decomposingdispatchTargetedTouchViaRuntimepushed press past 300 lines); the other three give the over-budget suites a real production question to mirror rather than an arbitrary test shard.interaction.test.ts(6crap_moderate) andinteraction-touch.ts(3) are replaced by four test-file entries totalling 8 — the same moved test bodies at their new paths. Zero findings on the new production modules: the two real ones (dispatchTargetedTouchViaRuntime,hasNonDefaultClickOptions) were fixed, not baselined. The baseline is path-keyed, so a split cannot avoid re-keying; nothing was regenerated or loosened, and the entries satisfy both audit bases (merge-base andorigin/main).docs/adr/0014-session-ref-frame-lifetime.mdnamed the deleted test file; it now namesinteraction-touch-android-readiness.test.ts. No decision text changed.Verification
pnpm check:affected --run— greenpnpm check:layering— green (no new cycle, back-edge, or ratchet growth)pnpm exec vitest run --project interaction-contract— 73/73pnpm test:coverage(full suite) — 6,680 tests greenadbremoved from PATH — green (the regression the Coverage lane caught)responseDataliteral failed the guard; removed)origin/main's baselineorigin/mainafter refactor(contracts): consolidate per-domain defineUse wrappers into one neutral defineUse #1741; gates re-run on the rebased head