Skip to content

Commit 0510124

Browse files
committed
fix(interaction): report a refused press as an unconfirmed position, not as measured motion (#3471)
A `target_still_moving` refusal covers two outcomes and all three of its surfaces described only one. The gate also refuses when a re-observation never measured a position at all — the `@ref` case where reconciliation kept the authorized frame node — so "the target was still moving" reported an observation the gate had not made, in the message, in the published hint, and in the website paragraph. A caller told the target is moving waits for movement; the actual recovery there is to re-resolve the target. All three now state the confirmation that failed. The reason literal is untouched: `reason` is the branch point, and the prose around it is not allowed to be more specific than the code that raised it. The unmeasured `@ref` refusal asserts both halves of that — the new wording present, the motion claim absent — so the text cannot drift back into a claim this path cannot support.
1 parent b936b37 commit 0510124

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

‎src/commands/interaction/runtime/moving-target-gate.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ test('a ref the second observation cannot re-measure is refused, never self-agre
278278
// hint's only test was the contracts unit suite, and the hint now lives beside this refusal.
279279
assert.match(String(details?.hint), /snapshot -i/);
280280
assert.match(String(details?.hint), /ref frame/);
281+
// And no claim about motion. This refusal is the shape that measured NOTHING, so a hint saying
282+
// the target "was still moving" would report an observation the gate never made, and the caller
283+
// would wait for movement instead of re-resolving.
284+
assert.match(String(details?.hint), /no confirmed resting position/);
285+
assert.doesNotMatch(String(details?.hint), /was still moving/);
281286
return true;
282287
},
283288
);

‎src/commands/interaction/runtime/moving-target-gate.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ function targetStillMovingHint(params: { selector: string | undefined }): string
286286
? `Run wait ${shellQuoteIfNeeded(params.selector)} and retry with the same selector`
287287
: 'Run snapshot -i and retry with a selector (text=/id=) rather than this @ref — re-observing retires the ref frame';
288288
return (
289-
'The target was still moving when the transition window after the previous action ran out, so no resting ' +
290-
`position could be confirmed and nothing was tapped. ${reobserve}; or pass --settle to have the action itself ` +
291-
'wait for the UI to go quiet.'
289+
'The target had no confirmed resting position when the transition window after the previous action ran ' +
290+
`out, so nothing was dispatched. ${reobserve}; or pass --settle to have the action itself wait for the ` +
291+
'UI to go quiet.'
292292
);
293293
}
294294

@@ -311,8 +311,8 @@ function motionRefusal(
311311
new AppError(
312312
'COMMAND_FAILED',
313313
selector
314-
? `Selector ${selector} is still moving, so no resting position could be confirmed to press`
315-
: `Ref ${ref} is still moving, so no resting position could be confirmed to press`,
314+
? `Selector ${selector} had no confirmed resting position when the transition window ran out`
315+
: `Ref ${ref} had no confirmed resting position when the transition window ran out`,
316316
{
317317
reason: INTERACTION_ERROR_REASONS.targetStillMoving,
318318
...(selector !== undefined ? { selector } : { ref }),

‎test/integration/interaction-contract/runtime-ref.contract.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ test(scenarioNames(RUNTIME_REF_COVERAGE, 'targetStability')[0]!, async () => {
151151
() => device.interactions.click(ref('@e1'), { session: 'default' }),
152152
(error: unknown) => {
153153
assert.ok(error instanceof Error);
154-
assert.match(error.message, /still moving/);
154+
// One message for both refusal shapes, so it states the confirmation that failed rather
155+
// than motion the gate did not always observe. This scenario did move, and `movedToRect` below
156+
// is where that claim earns its keep.
157+
assert.match(
158+
error.message,
159+
/Ref @e1 had no confirmed resting position when the transition window ran out/,
160+
);
155161
const details = (error as { details?: Record<string, unknown> }).details;
156162
assert.equal(details?.reason, 'target_still_moving');
157163
assert.equal(details?.dispatched, 'no');

‎test/integration/interaction-contract/runtime-selector.contract.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,12 @@ test(scenarioNames(RUNTIME_SELECTOR_COVERAGE, 'targetStability')[1]!, async () =
291291
() => device.interactions.press(selector('label=Continue'), { session: 'default' }),
292292
(error: unknown) => {
293293
assert.ok(error instanceof Error);
294-
assert.match(error.message, /label=Continue is still moving/);
294+
// Names the target and the fact the gate can actually assert; not "is still moving", which
295+
// the unmeasured shape would publish as an observation it never made.
296+
assert.match(
297+
error.message,
298+
/label=Continue had no confirmed resting position when the transition window ran out/,
299+
);
295300
const details = (error as { details?: Record<string, unknown> }).details;
296301
assert.equal(details?.reason, INTERACTION_ERROR_REASONS.targetStillMoving);
297302
assert.equal(details?.dispatched, 'no');

0 commit comments

Comments
 (0)