refactor(daemon): consolidate post-gesture surface-evidence helpers and their rationale - #1615
refactor(daemon): consolidate post-gesture surface-evidence helpers and their rationale#1615thymikee wants to merge 2 commits into
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Code review is clean on |
dab24b0 to
2401d28
Compare
…nd their rationale
Six findings against interaction-outcome-policy.ts and post-gesture-stabilization.ts,
all behavior-preserving except the gesture-warning wording:
1. Extract rectsWithinTolerance and use it in areInteractionSurfaceSignaturesStable,
classifyBaselineSurfaceEvidence, and haveIdenticalDiscriminatingSurfaces instead
of three copies of the same four-field comparison.
2. Unbox identifiedContent's Map from { entry } to the entry itself, dropping the
.entry indirection at every call site.
3. Document why haveIdenticalDiscriminatingSurfaces deliberately keys on `key`
(not `identity`, the opposite of interactionSurfaceIdentity's own conclusion):
it runs only after classifyBaselineSurfaceEvidence already accepted
'unchanged', exists solely to gate an agent-facing no-effect claim, and a
stricter key trades recall for precision — the safe direction for a veto.
4. Relocate decidePostGestureStabilityVerdict's stale pre-#1573 rationale
(intersection rect-deltas) to a short pointer at classifyBaselineSurfaceEvidence,
which already owns the current (post-#1573) evidence rule.
5. Type PostGestureStabilization.baselineBackend and CapturedSurface.backend as
SnapshotQualityVerdict['backend'] instead of bare string, closing the silent-typo
gap in the backend-rebase equality check.
6. Replace the numeric-regex guess in formatGestureNoEffectWarning with the known,
fixed positional grammar for scroll/swipe; gesture keeps a narrower fallback
since its per-subtype shape isn't uniform.
…g it The previous commit replaced `formatGestureNoEffectWarning`'s "drop numeric-looking positionals" regex with a per-action builder table — but kept the regex as the table's fallback. That is two mechanisms where there was one, and the heuristic this finding exists to remove is still in the file. Only `scroll`, `swipe` and `gesture <subtype> …` reach the warning by default (`isPostGestureStabilizingAction`), and across all three exactly one positional is not part of the gesture's identity: `scroll`'s optional trailing amount. Echoing everything else verbatim is simpler than either version and strictly more truthful than the original, which ate all four coordinates of `swipe <x1> <y1> <x2> <y2>` and reported a contentless bare "swipe". scroll down 0.6 -> "scroll down" scroll up -> "scroll up" swipe 10 20 30 40 -> "swipe 10 20 30 40" (was: "swipe") swipe -> "swipe" gesture swipe left -> "gesture swipe left" gesture fling down 100 200 -> "gesture fling down 100 200" 35 lines of table, dispatch and regex become 4 lines with one named exception. `--postGestureStabilization` can still force an arbitrary action through; echoing its positionals is the honest answer for one warning string, and reconstructing each gesture subtype's layout would fork a grammar that lives in GestureSemanticInput, downstream of the raw positionals this function receives.
2401d28 to
d20d2da
Compare
|
Live evidence attempt at rebased head I could not produce the warning, and I do not think that is a reproduction problem. Reporting the mechanism rather than presenting a near-miss as evidence. Tried five no-effect gestures across two screens:
Every one reported Two things in that output each independently veto the claim, both by design:
So the gate is working exactly as #1601 specified — silence as the safe failure mode. The consequence is the uncomfortable part: the warning appears unreachable on precisely the screen class #1600 was built for. #1600's motivating case was element-18 burning ~40 tool calls re-issuing scrolls on a Bluesky feed, and a Bluesky feed is hostile enough to capture that the corroboration can never be satisfied. I did not isolate which of the two vetoes dominates — that needs the per-capture backend and signature sets, not just the rendered warning. Filing separately rather than expanding this PR. What this means for this PR: nothing in it changes when the warning fires. It consolidates helpers, types 🤖 Addressed by Claude Code |
|
Re-review at |
|
Status update for |
refactor(daemon): drop the numeric-token heuristic instead of wrapping it
The previous commit replaced
formatGestureNoEffectWarning's"drop numeric-looking positionals" regex with a per-action builder table —
but kept the regex as the table's fallback. That is two mechanisms where
there was one, and the heuristic this finding exists to remove is still
in the file.
Only
scroll,swipeandgesture <subtype> …reach the warning bydefault (
isPostGestureStabilizingAction), and across all three exactlyone positional is not part of the gesture's identity:
scroll's optionaltrailing amount. Echoing everything else verbatim is simpler than either
version and strictly more truthful than the original, which ate all four
coordinates of
swipe <x1> <y1> <x2> <y2>and reported a contentlessbare "swipe".
scroll down 0.6 -> "scroll down"
scroll up -> "scroll up"
swipe 10 20 30 40 -> "swipe 10 20 30 40" (was: "swipe")
swipe -> "swipe"
gesture swipe left -> "gesture swipe left"
gesture fling down 100 200 -> "gesture fling down 100 200"
35 lines of table, dispatch and regex become 4 lines with one named
exception.
--postGestureStabilizationcan still force an arbitraryaction through; echoing its positionals is the honest answer for one
warning string, and reconstructing each gesture subtype's layout would
fork a grammar that lives in GestureSemanticInput, downstream of the raw
positionals this function receives.
refactor(daemon): consolidate post-gesture surface-evidence helpers and their rationale
Six findings against interaction-outcome-policy.ts and post-gesture-stabilization.ts,
all behavior-preserving except the gesture-warning wording:
classifyBaselineSurfaceEvidence, and haveIdenticalDiscriminatingSurfaces instead
of three copies of the same four-field comparison.
.entry indirection at every call site.
key(not
identity, the opposite of interactionSurfaceIdentity's own conclusion):it runs only after classifyBaselineSurfaceEvidence already accepted
'unchanged', exists solely to gate an agent-facing no-effect claim, and a
stricter key trades recall for precision — the safe direction for a veto.
(intersection rect-deltas) to a short pointer at classifyBaselineSurfaceEvidence,
which already owns the current (post-fix(daemon): judge post-gesture movement by identity, not by the intersection #1573) evidence rule.
SnapshotQualityVerdict['backend'] instead of bare string, closing the silent-typo
gap in the backend-rebase equality check.
fixed positional grammar for scroll/swipe; gesture keeps a narrower fallback
since its per-subtype shape isn't uniform.
Gates: typecheck / lint / format /
check:layeringgreen; 30 unit tests in the touched files pass.Reviewer note: the second commit reworks the first. The initial pass replaced
formatGestureNoEffectWarning's numeric-token regex with a per-action builder table but kept the regex as that table's fallback — two mechanisms where there was one, with the heuristic still present. It is now one named exception (scroll's trailing amount) and no heuristic, which also fixes the real defect the table found: the old rule ate all four coordinates ofswipe <x1> <y1> <x2> <y2>and emitted a contentless bare "swipe".Local gate note.
pnpm check:affected --runis flaky on a loaded dev host. Across six runs on three branches — plus a reproduction on unmodifiedorigin/mainby a parallel agent — failures came only from the poolandroid-lifecycle/android-recording/doctor/input-actions/daemon-client, always as timeouts, with a different subset each run. All pass in isolation (verified for this branch). Please treat the CI Integration Tests job on this head as authoritative forprovider-integration, per AGENTS.md ("GitHub remains authoritative for reported device/toolchain lanes").