You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 248e08a
Browse filesBrowse the repository at this point in the historyBrowse files
feat: warn on out-of-viewport coordinate taps (ADR 0011) (#1085)
* feat: warn on out-of-viewport coordinate taps (ADR 0011)
Implements the coordinate/offscreen guarantee: when a point tap target
falls outside the last-known viewport, attach a warning to the result
instead of silently forwarding the tap. This is a WARNING not an error,
maintaining the escape-hatch semantics of coordinate taps.
The warning is generated at the runtime layer in resolvePointInteractionTarget
using the session's last snapshot to infer viewport bounds via resolveViewportRect.
No snapshot is captured (by design), so the implementation reuses the session's
existing snapshot state. When no snapshot is available, no warning is emitted.
Changes:
- Add `warning?: string` field to PressCommandResult and LongPressCommandResult
types (FillCommandResult already had it for --verify evidence)
- Implement tryResolveOutOfBoundsPointWarning in resolution.ts and export it
for registry verification
- Update interaction-guarantees.ts to mark coordinate/offscreen as runtime-enforced
- Remove coordinate/offscreen from the pinned gap list in the test registry
- Add tests: out-of-bounds point with snapshot → warning; in-bounds → no warning;
no snapshot → no warning
- Carry the warning field through daemon handlers for press/click/longpress
Closes#1081 (coordinate/offscreen gap).
* refactor: drop suppressed re-export; registry points at the enforcement carrier
The registry via now references resolveInteractionTarget (the exported
carrier, same precedent as the verifyEvidence cell) instead of forcing a
suppressed unused-export of the internal helper.
Copy file name to clipboardExpand all lines: src/commands/interaction/runtime/interactions.test.ts
+79Lines changed: 79 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1379,6 +1379,85 @@ test('runtime interaction commands are available from the command namespace', as
1379
1379
assert.equal(result.kind,'selector');
1380
1380
});
1381
1381
1382
+
test('coordinate tap with out-of-bounds point warns when session has viewport',async()=>{
1383
+
constdevice=createInteractionDevice(
1384
+
makeSnapshotState([
1385
+
{
1386
+
index: 0,
1387
+
depth: 0,
1388
+
type: 'Application',
1389
+
rect: {x: 0,y: 0,width: 400,height: 800},
1390
+
hittable: true,
1391
+
},
1392
+
]),
1393
+
{
1394
+
tap: async()=>({ok: true}),
1395
+
},
1396
+
);
1397
+
1398
+
constresult=awaitdevice.interactions.click(
1399
+
{kind: 'point',x: 500,y: 500},
1400
+
{
1401
+
session: 'default',
1402
+
},
1403
+
);
1404
+
1405
+
assert.equal(result.kind,'point');
1406
+
assert.equal(
1407
+
result.warning,
1408
+
'Coordinates (500, 500) are outside the last-known viewport (400x800). The tap will be forwarded anyway; take a fresh snapshot if the screen changed.',
1409
+
);
1410
+
});
1411
+
1412
+
test('coordinate tap with in-bounds point has no warning',async()=>{
1413
+
constdevice=createInteractionDevice(
1414
+
makeSnapshotState([
1415
+
{
1416
+
index: 0,
1417
+
depth: 0,
1418
+
type: 'Application',
1419
+
rect: {x: 0,y: 0,width: 400,height: 800},
1420
+
hittable: true,
1421
+
},
1422
+
]),
1423
+
{
1424
+
tap: async()=>({ok: true}),
1425
+
},
1426
+
);
1427
+
1428
+
constresult=awaitdevice.interactions.click(
1429
+
{kind: 'point',x: 200,y: 400},
1430
+
{
1431
+
session: 'default',
1432
+
},
1433
+
);
1434
+
1435
+
assert.equal(result.kind,'point');
1436
+
assert.equal('warning'inresult,false);
1437
+
});
1438
+
1439
+
test('coordinate tap with no session snapshot has no warning',async()=>{
return`Coordinates (${point.x}, ${point.y}) are outside the last-known viewport (${viewport.width}x${viewport.height}). The tap will be forwarded anyway; take a fresh snapshot if the screen changed.`;
0 commit comments