@@ -220,25 +220,19 @@ export type MovingTargetObservation = MovingTargetMeasurement & {
220220
221221/** Whether a look produced a position of its own, or nothing to compare against. */
222222type MovingTargetMeasurement =
223- /** The position this observation's own capture reported for the target, on that capture's surface. */
224- | MovingTargetMeasured
223+ /**
224+ * The position this observation's own capture reported for the target, and on which surface. The
225+ * surface rides along because a rect is only comparable to one measured on the same presentation
226+ * (#2438).
227+ */
228+ | { measured : true ; rect : Rect ; surfaceBundleId : string | undefined }
225229 /**
226230 * No position of its own. Two of these would "agree" trivially — rest certified by a
227231 * non-measurement, the one outcome the check must never produce — so the first of them ends the
228232 * recheck, and a refusal reports no `movedToRect` rather than a stale one.
229233 */
230234 | { measured : false ; rect : undefined } ;
231235
232- /**
233- * A look that measured the target: where it put it, and on which surface. The surface rides along
234- * because a rect is only comparable to one measured on the same presentation (#2438).
235- */
236- type MovingTargetMeasured = {
237- measured : true ;
238- rect : Rect ;
239- surfaceBundleId : string | undefined ;
240- } ;
241-
242236/**
243237 * One observation of the same target, asked as the original question rather than a narrower one.
244238 *
@@ -310,34 +304,20 @@ function resolvedRect(resolved: ResolvedInteractionTarget): Rect | undefined {
310304 return 'node' in resolved ? resolved . node ?. rect : undefined ;
311305}
312306
313- /**
314- * The hint published beside every `target_still_moving` refusal, owned by the refusal's module so
315- * the reason cannot be published without its recovery.
316- *
317- * A selector re-resolves against a fresh capture and can be retried as-is. An `@ref` cannot survive
318- * the wait: the capture a `wait` takes retires the ref frame (ADR 0014), which is the same reason
319- * the off-screen guard sends its `@ref` refusals to a selector. The selector is quoted for the
320- * caller's shell the way the daemon's other recovery hints quote values (`shellQuoteIfNeeded`), so
321- * a label carrying an apostrophe cannot turn the suggested command into a copy-paste failure.
322- */
323- function targetStillMovingHint ( params : { selector : string | undefined } ) : string {
324- const reobserve = params . selector
325- ? `Run wait ${ shellQuoteIfNeeded ( params . selector ) } and retry with the same selector`
326- : 'Run snapshot -i and retry with a selector (text=/id=) rather than this @ref — re-observing retires the ref frame' ;
327- return (
328- 'The target had no confirmed resting position when the transition window after the previous action ran ' +
329- `out, so nothing was dispatched. ${ reobserve } ; or pass --settle to have the action itself wait for the ` +
330- 'UI to go quiet.'
331- ) ;
332- }
333-
334307/**
335308 * The refusal, keyed on the reason the whole interaction surface shares and raised beside the guard
336309 * that owns it. `rect` is the position the caller's own resolution produced and `movedToRect` where
337310 * the last re-observation found the target — the pair that says which way the surface is going.
338311 * `movedToRect` is the one optional member: a re-observation that measured nothing (the ref kept its
339312 * authorized frame node) has no position to name, and an absent value is the honest report rather
340313 * than a stale one.
314+ *
315+ * The hint is owned here so the reason cannot be published without its recovery. A selector
316+ * re-resolves against a fresh capture and can be retried as-is. An `@ref` cannot survive the wait:
317+ * the capture a `wait` takes retires the ref frame (ADR 0014), which is the same reason the
318+ * off-screen guard sends its `@ref` refusals to a selector. The selector is quoted for the caller's
319+ * shell (`shellQuoteIfNeeded`), so a label carrying an apostrophe cannot turn the suggested command
320+ * into a copy-paste failure.
341321 */
342322export function motionRefusal (
343323 resolved : Exclude < ResolvedInteractionTarget , { kind : 'point' } > ,
@@ -346,6 +326,9 @@ export function motionRefusal(
346326) : Error {
347327 const selector = resolved . target . kind === 'selector' ? resolved . target . selector : undefined ;
348328 const ref = resolved . target . kind === 'ref' ? resolved . target . ref : undefined ;
329+ const reobserve = selector
330+ ? `Run wait ${ shellQuoteIfNeeded ( selector ) } and retry with the same selector`
331+ : 'Run snapshot -i and retry with a selector (text=/id=) rather than this @ref — re-observing retires the ref frame' ;
349332 return discloseDispatch (
350333 new AppError (
351334 'COMMAND_FAILED' ,
@@ -358,7 +341,10 @@ export function motionRefusal(
358341 ...( resolved . node ?. rect ? { rect : resolved . node . rect } : { } ) ,
359342 ...( movedToRect ? { movedToRect } : { } ) ,
360343 waitedMs,
361- hint : targetStillMovingHint ( { selector } ) ,
344+ hint :
345+ 'The target had no confirmed resting position when the transition window after the previous action ran ' +
346+ `out, so nothing was dispatched. ${ reobserve } ; or pass --settle to have the action itself wait for the ` +
347+ 'UI to go quiet.' ,
362348 } ,
363349 ) ,
364350 'no' ,
0 commit comments