Skip to content

Commit 42e59e5

Browse files
thymikeeclaude
andcommitted
test(capture-kit): pin a late effect after a post-gesture rebase
Review follow-up to #3868. After a rebase the loop trusts the next quiet pair, so an effect that lands later must still keep it polling until the moved surface is quiet. Also pin that the backend-flip scroll test never reaches the stale-accept cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 86637b2 commit 42e59e5

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

‎packages/capture-kit/src/post-gesture-stability.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,22 @@ test('a quiet pair matching a same-backend baseline is still distrusted to the c
157157
assert.equal(diagnostics('post_gesture_snapshot_stale_accept').length, 1);
158158
assert.ok(clock.now() >= 3_500, `accepted after ${clock.now()}ms`);
159159
});
160+
161+
test('an effect that lands after a rebase keeps the loop polling until the moved surface is quiet', async () => {
162+
const clock = fakeClock();
163+
const rebasedRead: Surface = { signature: ['before'], costMs: 0, backend: 'bridge' };
164+
const moving: Surface = { signature: ['moving'], costMs: 0, backend: 'bridge' };
165+
const moved: Surface = { signature: ['moved'], costMs: 0, backend: 'bridge' };
166+
167+
const outcome = await runPostGestureStabilityLoop({
168+
pending: { ...PENDING, baselineSignature: ['before'], baselineBackend: 'runner' },
169+
needsBaselineDistrust: true,
170+
hooks: hooksFor(clock, [rebasedRead, rebasedRead, moving, moved, moved]),
171+
clock,
172+
});
173+
174+
assert.equal(outcome.value, moved);
175+
assert.equal(outcome.postGestureOutcome, undefined);
176+
assert.equal(diagnostics('post_gesture_snapshot_baseline_rebased').length, 1);
177+
assert.equal(diagnostics('post_gesture_snapshot_stale_accept').length, 0);
178+
});

‎packages/daemon/src/core/__tests__/post-gesture-no-effect-claim.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,16 @@ test('a successful scroll that flips the capture backend must not claim no-effec
152152
});
153153
markPostGestureStabilization(session, 'scroll', ['down']);
154154

155-
const { result, rebased, vetoed, vetoEvents } = await runStabilization(session, () =>
156-
makeSnapshotState(chromeWithListSnapshot(['row-3', 'row-4']).nodes, {
157-
snapshotQuality: { state: 'recovered', backend: 'private-ax' },
158-
}),
155+
const { result, rebased, staleAccepts, vetoed, vetoEvents } = await runStabilization(
156+
session,
157+
() =>
158+
makeSnapshotState(chromeWithListSnapshot(['row-3', 'row-4']).nodes, {
159+
snapshotQuality: { state: 'recovered', backend: 'private-ax' },
160+
}),
159161
);
160162

161163
assert.equal(rebased, 1);
164+
assert.equal(staleAccepts, 0);
162165
assert.equal(
163166
result.postGestureOutcome,
164167
undefined,

0 commit comments

Comments
 (0)