refactor(ios): single CommandTraits table for runner command classification#642
Merged
Conversation
…cation Replace the three hand-maintained switches in RunnerTests+Lifecycle.swift (isInteractionCommand / isReadOnlyCommand / isRunnerLifecycleCommand) with one source of truth: CommandType.traits, an exhaustive switch returning a CommandTraits struct (interaction / readOnly / lifecycle axes), collocated with CommandType in RunnerTests+Models.swift. Pure refactor: every command's classification is reproduced verbatim, and the three predicates become one-line lookups with unchanged signatures, so call sites are untouched. The exhaustive switch makes it a compile error to add a CommandType without classifying it, closing the drift that historically let tapSeries/dragSeries/keyboardReturn fall out of isInteractionCommand. readOnly is a 3-state enum (.always/.never/.conditional); .conditional preserves alert's action-dependent read-only behavior, resolved in isReadOnlyCommand. Classification feeds ADR-0002 session invalidation (the read-only retry that nulls currentApp/currentBundleId), so behavior is intentionally unchanged. Adds the "Runner command traits" term to CONTEXT.md.
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
5 tasks
thymikee
added a commit
that referenced
this pull request
Jun 1, 2026
… commands tapSeries and dragSeries are the series forms of tap/drag (already interaction commands); keyboardReturn is the sibling of keyboardDismiss (already an interaction command). All three were missing from the historical isInteractionCommand switch — a drift the new CommandTraits table (#642) makes visible. Classifying them as interaction commands gives them the foreground-guard + stabilization preflight that their single-shot/sibling forms already get. Behavior change: these three commands now re-activate a backgrounded target to foreground and pay the stabilization delays before running. Ships separately from the CommandTraits refactor (#642) and should land after that bakes. mouseClick left unchanged: macOS-only and the foreground guard interacts with bespoke macOS activation, so it needs a macOS smoke check first.
… commands (#643) * fix(ios): classify tapSeries/dragSeries/keyboardReturn as interaction commands tapSeries and dragSeries are the series forms of tap/drag (already interaction commands); keyboardReturn is the sibling of keyboardDismiss (already an interaction command). All three were missing from the historical isInteractionCommand switch — a drift the new CommandTraits table (#642) makes visible. Classifying them as interaction commands gives them the foreground-guard + stabilization preflight that their single-shot/sibling forms already get. Behavior change: these three commands now re-activate a backgrounded target to foreground and pay the stabilization delays before running. Ships separately from the CommandTraits refactor (#642) and should land after that bakes. mouseClick left unchanged: macOS-only and the foreground guard interacts with bespoke macOS activation, so it needs a macOS smoke check first. * test: cover iOS runner series commands in perf harness
|
Merged
5 tasks
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.
What
Replace the three hand-maintained switches in
RunnerTests+Lifecycle.swift—isInteractionCommand,isReadOnlyCommand,isRunnerLifecycleCommand— with a single source of truth:CommandType.traits, an exhaustiveswitchreturning aCommandTraitsstruct, collocated withCommandTypeinRunnerTests+Models.swift.CommandTraitshas three independent axes:isInteraction— needs the foreground-guard + stabilization preflightreadOnly: .always/.never/.conditional— eligible for the session-invalidating retry (.conditionalpreservesalert's action-dependent behavior)isLifecycle— skips the app-activation preflightWhy
Adding a command meant editing up to three separate switches;
screenshotalready lived in two. That scatter is exactly what historically lettapSeries/dragSeries/keyboardReturndrift out ofisInteractionCommand. The exhaustiveswitchmakes it a compile error to add aCommandTypewithout classifying it.Pure refactor — no behavior change
Every command's classification is reproduced verbatim. The three predicates become one-line lookups with unchanged signatures, so all call sites in
CommandExecutionare untouched. Classification feeds ADR-0002 session invalidation (the read-only retry that nullscurrentApp/currentBundleId), so behaviour is intentionally identical.A
NOTEcomment in the table documents the pre-existing classifications it preserves — including two latent inconsistencies the work surfaced:querySelectoris not read-only, andrecordStartis not a lifecycle command. These (and theisInteractionomissions) are deliberately left for a separate normalization PR.Verification
xcodebuild build-for-testing(UITest bundle) compiles: TEST BUILD SUCCEEDED.switch(completeness) + a verbatim, reviewable diff.Docs
Adds the "Runner command traits" term to
CONTEXT.md.Follow-up (separate PR)
Reclassify
tapSeries/dragSeries/keyboardReturnas interaction commands, and evaluatemouseClick(macOS-only; needs a macOS smoke check) — each with e2e evidence.