Skip to content

Commit f22ddb7

Browse files
committed
feat(interaction)!: remove target-readiness waits
1 parent 5d05dc2 commit f22ddb7

55 files changed

Lines changed: 460 additions & 1763 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎contracts/fixtures/dispatch-disclosure.json‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
"trigger": "Android blocking-dialog readiness tapped Close app and relaunched the app, then re-admission aborted the requested ref press",
3636
"dispatched": "unknown"
3737
},
38-
{
39-
"id": "daemon.refusal.selector-readiness-exhausted",
40-
"producer": "daemon",
41-
"trigger": "press with readinessTimeoutMs whose selector target never appears: the readiness wait (pollForSelectorReadiness) spends its budget over two or more polls and refuses with selector_not_found before any backend touch",
42-
"dispatched": "no"
43-
},
4438
{
4539
"id": "daemon.unclassified",
4640
"producer": "daemon",

‎packages/ad-replay/src/internal/runtime-port-types.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,9 @@ export type AdReplayStepRuntime = Readonly<{
223223
* Captures a fresh snapshot (with the #1385 launch-race retry) and resolves
224224
* the recorded target against it using the SAME lookup/matching a real
225225
* dispatch would — daemon authority (`SessionStore`, the capture pipeline,
226-
* tree helpers and the selectors package engine). A step whose dispatch
227-
* would wait for its target under a readiness budget re-captures while the
228-
* target does not match yet, under that same budget, so this gate never
229-
* refuses a target the dispatch itself would have waited for. The last
230-
* capture is the divergence's `screen`.
226+
* tree helpers and the selectors package engine). A missing target is
227+
* refused after this observation; scripts wait explicitly for loading
228+
* screens. The capture is the divergence's `screen`.
231229
*/
232230
observeTarget(params: {
233231
action: SessionAction;

‎packages/command-registry/src/registry.ts‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,6 @@ export const RAW_COMMAND_DESCRIPTORS = [
13101310
},
13111311
timeoutPolicy: postActionObservationTimeoutPolicy('click', PRESERVE_DAEMON_TIMEOUT_POLICY),
13121312
postActionObservation: postActionObservation('click'),
1313-
targetReadiness: 'budgeted',
13141313
responseDataTransform: TOUCH_INTERACTION_RESPONSE_DATA_TRANSFORM,
13151314
batchable: true,
13161315
platformExecution: { kind: 'device-runtime', uses: clickRuntimeUses },
@@ -1341,7 +1340,6 @@ export const RAW_COMMAND_DESCRIPTORS = [
13411340
envelopeMs: 210_000,
13421341
},
13431342
postActionObservation: postActionObservation('longpress'),
1344-
targetReadiness: 'budgeted',
13451343
batchable: true,
13461344
platformExecution: { kind: 'device-runtime', uses: longPressRuntimeUses },
13471345
},
@@ -1371,7 +1369,6 @@ export const RAW_COMMAND_DESCRIPTORS = [
13711369
frameworkTier: 'core',
13721370
timeoutPolicy: postActionObservationTimeoutPolicy('press', PRESERVE_DAEMON_TIMEOUT_POLICY),
13731371
postActionObservation: postActionObservation('press'),
1374-
targetReadiness: 'budgeted',
13751372
responseDataTransform: TOUCH_INTERACTION_RESPONSE_DATA_TRANSFORM,
13761373
batchable: true,
13771374
platformExecution: { kind: 'device-runtime', uses: pressRuntimeUses },
@@ -2002,9 +1999,7 @@ function readCatalogKey(descriptor: {
20021999
const TIMEOUT_POLICY_BY_COMMAND: ReadonlyMap<string, CommandTimeoutPolicy> = new Map(
20032000
Array.from(COMMAND_DESCRIPTOR_BY_NAME.values(), (descriptor) => [
20042001
descriptor.name,
2005-
descriptor.targetReadiness
2006-
? { ...descriptor.timeoutPolicy, targetReadiness: descriptor.targetReadiness }
2007-
: descriptor.timeoutPolicy,
2002+
descriptor.timeoutPolicy,
20082003
]),
20092004
);
20102005

@@ -2032,11 +2027,6 @@ export function commandSupportsSettleObservation(command: string | undefined): b
20322027
return resolveCommandPostActionObservationSupport(command) !== undefined;
20332028
}
20342029

2035-
export function commandAcceptsReadinessBudget(command: string | undefined): boolean {
2036-
if (command === undefined) return false;
2037-
return COMMAND_DESCRIPTOR_BY_NAME.get(command)?.targetReadiness === 'budgeted';
2038-
}
2039-
20402030
export function commandSupportsVerifyEvidence(command: string | undefined): boolean {
20412031
return resolveCommandPostActionObservationSupport(command) === 'settle-and-verify';
20422032
}

‎packages/command-registry/src/timeout-policy.ts‎

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ type RequestTimeoutInput = Readonly<{
6868
timeoutMs?: number;
6969
settle?: boolean;
7070
waitMs?: number;
71-
readinessTimeoutMs?: number;
7271
}>;
7372
}>;
7473

@@ -79,32 +78,11 @@ export function resolveCommandRequestTimeoutMs(
7978
): number | undefined {
8079
if (policy.envelopeMs === 'unbounded') return undefined;
8180
const boundedPolicy: BoundedTimeoutPolicy = { ...policy, envelopeMs: policy.envelopeMs };
82-
const envelopeMs =
81+
return (
8382
resolvePositionalBudgetTimeoutMs(boundedPolicy, input.positionals ?? []) ??
8483
resolveFlagBudgetTimeoutMs(boundedPolicy, input.flags) ??
85-
boundedPolicy.envelopeMs;
86-
return envelopeMs + readinessBudgetMs(policy, input.flags);
87-
}
88-
89-
/**
90-
* The ceiling of a `targetReadiness: 'budgeted'` command's readiness budget: the promotedTarget
91-
* selector row's poll ceiling, pinned to it by test.
92-
*/
93-
export const READINESS_BUDGET_MAX_MS = 2_000;
94-
95-
/**
96-
* A readiness budget is target-poll time spent before the action itself, so it extends whatever
97-
* envelope the command otherwise has; the daemon's own poll must never outlive the client's clock.
98-
* The poll never runs past the promotedTarget row's ceiling, so neither does the widening.
99-
*/
100-
function readinessBudgetMs(
101-
policy: CommandTimeoutPolicy,
102-
flags: RequestTimeoutInput['flags'],
103-
): number {
104-
if (policy.targetReadiness !== 'budgeted') return 0;
105-
const budgetMs = flags?.readinessTimeoutMs;
106-
if (typeof budgetMs !== 'number' || !Number.isInteger(budgetMs) || budgetMs <= 0) return 0;
107-
return Math.min(budgetMs, READINESS_BUDGET_MAX_MS);
84+
boundedPolicy.envelopeMs
85+
);
10886
}
10987

11088
function resolvePositionalBudgetTimeoutMs(

‎packages/command-registry/src/types.ts‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,8 @@ export type CommandTimeoutPolicy = {
7575
budget: CommandTimeoutBudget;
7676
envelopeMs: number | 'unbounded';
7777
onTimeout: 'preserve-daemon' | 'reset-daemon';
78-
/**
79-
* The descriptor's {@link CommandTargetReadiness} trait, attached by `resolveCommandTimeoutPolicy`
80-
* so the envelope can widen by the readiness budget. Descriptors declare it as `targetReadiness`,
81-
* never on their `timeoutPolicy`.
82-
*/
83-
targetReadiness?: CommandTargetReadiness;
8478
};
8579

86-
/**
87-
* `budgeted`: the command's target resolution may poll for a target that does not exist yet, under
88-
* a caller-supplied `readinessTimeoutMs`, capped at `READINESS_BUDGET_MAX_MS` (`timeout-policy.ts`).
89-
* Must match the commands the `targetReadiness` interaction guarantee cells mark `runtime`.
90-
*/
91-
export type CommandTargetReadiness = 'budgeted';
92-
9380
/**
9481
* #1320 "Command descriptor policy": what a command may do with the host-global
9582
* device claim store. REQUIRED on every descriptor (no default), and read by the
@@ -212,9 +199,6 @@ export type TargetIdentityVerification = 'pre-dispatch' | 'post-resolution';
212199
* commands that support `--settle`/`--verify`; consumed by
213200
* command surfaces and timeout policy instead of repeated
214201
* command-name lists.
215-
* - `targetReadiness` — optional; the commands whose target resolution accepts a
216-
* `readinessTimeoutMs` budget. Read by replay (which supplies a
217-
* default budget) and by the request envelope (which widens by it).
218202
* - `responseDataTransform` — optional public response data shaping rules for
219203
* command-owned fields in daemon responses. This keeps
220204
* response shaping on the same descriptor surface as other
@@ -237,7 +221,6 @@ type CommandDescriptorBase = {
237221
*/
238222
deviceClaimPolicy: DeviceClaimPolicy;
239223
postActionObservation?: PostActionObservationSupport;
240-
targetReadiness?: CommandTargetReadiness;
241224
responseDataTransform?: CommandResponseDataTransform;
242225
catalog: CommandCatalogFacet;
243226
/** Required iff `catalog.group === 'public'`; see {@link CommandFrameworkTier}. */

‎packages/contracts/src/client-gesture.ts‎

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,11 @@ export type SettleCommandOptions = {
3535
timeoutMs?: number;
3636
};
3737

38-
/**
39-
* How long a tap-shaped interaction may poll for a target that does not exist yet, capped at the
40-
* promotedTarget row's maxTimeoutMs. Never model- or CLI-writable; omitted means one attempt.
41-
*/
42-
export type ReadinessBudgetOptions = {
43-
readinessTimeoutMs?: number;
44-
};
45-
4638
export type ClickOptions = DeviceCommandBaseOptions &
4739
SelectorSnapshotCommandOptions &
4840
InteractionTarget &
4941
RepeatedPressOptions &
50-
SettleCommandOptions &
51-
ReadinessBudgetOptions & {
42+
SettleCommandOptions & {
5243
button?: ClickButton;
5344
/**
5445
* Opt-in (#1047): return cheap post-action evidence (AX digest, node counts,
@@ -62,16 +53,14 @@ export type PressOptions = DeviceCommandBaseOptions &
6253
SelectorSnapshotCommandOptions &
6354
InteractionTarget &
6455
RepeatedPressOptions &
65-
SettleCommandOptions &
66-
ReadinessBudgetOptions & {
56+
SettleCommandOptions & {
6757
verify?: boolean;
6858
};
6959

7060
export type LongPressOptions = DeviceCommandBaseOptions &
7161
SelectorSnapshotCommandOptions &
7262
InteractionTarget &
73-
SettleCommandOptions &
74-
ReadinessBudgetOptions & {
63+
SettleCommandOptions & {
7564
durationMs?: number;
7665
};
7766

‎packages/contracts/src/command-flags.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ export type CommandFlags = Omit<CliFlags, DaemonExcludedCliFlag> & {
3232
kind?: string;
3333
maestro?: MaestroRuntimeFlags;
3434
postGestureStabilization?: boolean;
35-
/**
36-
* Readiness budget for press/click/longpress, capped at the promotedTarget row's maxTimeoutMs.
37-
* No CliFlags counterpart: never CLI- or model-writable.
38-
*/
39-
readinessTimeoutMs?: number;
4035
snapshotIncludeHiddenContentHints?: boolean;
4136
leaseProvider?: string;
4237
provider?: string;

‎packages/contracts/src/daemon-command-surface.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ export type DaemonPressOptions = CommandContext &
199199
Readonly<{
200200
target: InteractionTarget;
201201
button?: ClickButton;
202-
/** Polls for the target to become actionable; absent takes one attempt. */
203-
readinessTimeoutMs?: number;
204202
expectedResolvedTarget?: ReplayTargetGuardDenotation;
205203
/** #1654: a mutating `find`'s already-resolved node. */
206204
preresolvedTarget?: PreresolvedInteractionTarget;
@@ -222,7 +220,6 @@ export type DaemonLongPressOptions = CommandContext &
222220
Readonly<{
223221
target: InteractionTarget;
224222
durationMs?: number;
225-
readinessTimeoutMs?: number;
226223
expectedResolvedTarget?: ReplayTargetGuardDenotation;
227224
settle?: SettleParams;
228225
}>;

‎packages/contracts/src/facades/client.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export type {
5555
PanOptions,
5656
PinchOptions,
5757
PressOptions,
58-
ReadinessBudgetOptions,
5958
RepeatedPressOptions,
6059
RotateGestureOptions,
6160
ScrollOptions,

‎packages/contracts/src/interaction-guarantees.ts‎

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ export const INTERACTION_GUARANTEES = [
7373
// unique/disambiguated/exact/label-fallback/not-observed provenance,
7474
// pre-action diagnostics only — never ref-issued or MCP-pinned.
7575
'resolutionDisclosure',
76-
// How the path waits for the target to exist and become actionable before acting: a declared
77-
// budget under which a plain no-match keeps retrying, versus a target that must already exist at
78-
// dispatch time. Distinct from occlusion/offscreen/nonHittable, which judge a target already
79-
// found; this is about whether one is found at all.
80-
'targetReadiness',
8176
// What the path observes after dispatch to back its success claim, and whether that observation
8277
// is advisory (a hint the caller may ignore) or can change the response (a corroborated failure,
8378
// a settled diff). Distinct from the opt-in verifyEvidence/settleObservation features; this is the
@@ -169,17 +164,6 @@ const TAP_OUTCOME_NOT_OBSERVED_GAP: GuaranteeEnforcement = {
169164
trackingIssue: TAP_OUTCOME_NOT_OBSERVED_GAP_ISSUE,
170165
};
171166

172-
// Both Maestro-compatible fast paths (src/daemon/interaction/internal/interaction-touch-direct-ios.ts)
173-
// dispatch ONE fused XCTest runner request (`command: 'tap'` with a selectorKey/selectorValue) built
174-
// in packages/platform-apple/src/interactions.ts#tapElementSelector — not the separate
175-
// packages/maestro/ flow-script engine, which drives standalone `.yaml` Maestro flows and never
176-
// participates in an ordinary daemon click.
177-
const DIRECT_IOS_SINGLE_QUERY_READINESS: GuaranteeEnforcement = {
178-
kind: 'waived',
179-
reason:
180-
"Intentional: the fused runner request performs a single XCTest selector/frame query per dispatch and does not itself retry for an as-yet-nonexistent target; a miss is a runner failure (see errorTaxonomy) rather than a wait, and delegation-on-error (ADR 0011) is a different path's guarantee, not a retry of this one.",
181-
};
182-
183167
// Shares the SAME reasoning as TAP_OUTCOME_NOT_OBSERVED_GAP: the tap outcome is not observed on the
184168
// success path here either. The shared ambiguous-XCTest-failure corroboration
185169
// (src/daemon/interaction/internal/interaction-ios-tap-outcome.ts#corroborateIosTapFailure) is
@@ -282,14 +266,6 @@ export const INTERACTION_DISPATCH_PATHS: Record<InteractionPathId, InteractionPa
282266
kind: 'runtime',
283267
via: 'src/commands/interaction/runtime/selector-action-resolution.ts#resolveActionSelector',
284268
},
285-
// press/click/longpress poll the promotedTarget row's readiness budget only when the caller
286-
// supplies readinessTimeoutMs (never model- or CLI-writable), capped at the row's
287-
// maxTimeoutMs; fill/hover resolve against the resolvedTarget row, which declares no poll budget.
288-
targetReadiness: {
289-
kind: 'runtime',
290-
via: 'src/commands/interaction/runtime/selector-readiness.ts#pollForSelectorReadiness',
291-
appliesTo: ['press', 'click', 'longpress'],
292-
},
293269
outcomeObservation: TAP_OUTCOME_NOT_OBSERVED_GAP,
294270
},
295271
},
@@ -316,11 +292,6 @@ export const INTERACTION_DISPATCH_PATHS: Record<InteractionPathId, InteractionPa
316292
kind: 'runtime',
317293
via: 'src/commands/interaction/runtime/resolution-disclosure.ts#buildRefResolution',
318294
},
319-
targetReadiness: {
320-
kind: 'inapplicable',
321-
reason:
322-
'A resolved @ref names exactly one node in its authorized frame; ADR 0014 fails a stale or unusable ref at once instead of waiting for a fresher observation to authorize it, so there is no existence budget to poll under.',
323-
},
324295
outcomeObservation: TAP_OUTCOME_NOT_OBSERVED_GAP,
325296
},
326297
},
@@ -379,11 +350,6 @@ export const INTERACTION_DISPATCH_PATHS: Record<InteractionPathId, InteractionPa
379350
kind: 'runtime',
380351
via: 'src/commands/interaction/runtime/gestures.ts#dragCommand',
381352
},
382-
targetReadiness: {
383-
kind: 'inapplicable',
384-
reason:
385-
'Both endpoints resolve through the resolvedTarget row, which declares no poll budget; only the promotedTarget row carries a readiness budget.',
386-
},
387353
outcomeObservation: {
388354
kind: 'waived',
389355
reason:
@@ -464,11 +430,6 @@ export const INTERACTION_DISPATCH_PATHS: Record<InteractionPathId, InteractionPa
464430
kind: 'runtime',
465431
via: 'src/commands/interaction/runtime/resolution-disclosure.ts#EXACT_REF_RESOLUTION',
466432
},
467-
targetReadiness: {
468-
kind: 'waived',
469-
reason:
470-
"Intentional: the fast path dispatches to the web provider's own element handle (clickRef/fillRef/hoverRef), which owns its own auto-wait/actionability semantics outside this repo. The shared preflight still refuses an already-resolved node that fails occlusion/offscreen/keyboard; it does not wait for one to first exist.",
471-
},
472433
outcomeObservation: {
473434
kind: 'waived',
474435
reason:
@@ -532,11 +493,6 @@ export const INTERACTION_DISPATCH_PATHS: Record<InteractionPathId, InteractionPa
532493
kind: 'inapplicable',
533494
reason: 'Coordinates name a point; no element was resolved to disclose.',
534495
},
535-
targetReadiness: {
536-
kind: 'inapplicable',
537-
reason:
538-
'Coordinates name a point, not an element; there is no target existence to wait for.',
539-
},
540496
outcomeObservation: TAP_OUTCOME_NOT_OBSERVED_GAP,
541497
},
542498
},
@@ -599,7 +555,6 @@ export const INTERACTION_DISPATCH_PATHS: Record<InteractionPathId, InteractionPa
599555
kind: 'runtime',
600556
via: 'src/daemon/interaction/internal/interaction-touch-response.ts#buildInteractionResponseData',
601557
},
602-
targetReadiness: DIRECT_IOS_SINGLE_QUERY_READINESS,
603558
outcomeObservation: DIRECT_IOS_OUTCOME_NOT_OBSERVED_GAP,
604559
},
605560
},
@@ -662,7 +617,6 @@ export const INTERACTION_DISPATCH_PATHS: Record<InteractionPathId, InteractionPa
662617
reason:
663618
'Maestro owns matching; the fallback is coordinate execution. Cell membership is usage-based: only a dispatch whose runner actually executed the coordinate fallback is this path — allowed-but-not-taken is the direct path and discloses not-observed.',
664619
},
665-
targetReadiness: DIRECT_IOS_SINGLE_QUERY_READINESS,
666620
outcomeObservation: DIRECT_IOS_OUTCOME_NOT_OBSERVED_GAP,
667621
},
668622
},

0 commit comments

Comments
 (0)