Skip to content

Detector: fire BACKTRACK and SCROLL_OVERSHOOT on a burst, not the session span - #55

Open
Orpheus-agent wants to merge 1 commit into
mainfrom
orpheus/daily-improve-20261010-94
Open

Orpheus-agent wants to merge 1 commit into
mainfrom
orpheus/daily-improve-20261010-94

Conversation

@Orpheus-agent

Copy link
Copy Markdown
Collaborator

What

detectBacktrack and detectScrollOvershoot were the last two detection rules that counted their signal across a whole session bucket and then gated on the bucket's total span (first event to last).

That shape only fires when every event the session ever produced happens to fit in one window. A user who edits a field calmly and then hits a flurry of write/erase cycles - or scrolls normally and then overshoots back and forth - never gets a detection, because the earlier activity alone pushes the span past the window. Those are exactly the sessions the rules exist to catch.

Change

Evidence

  • New regression tests in tests/struggle.test.ts: a late burst of cycles / reversals now fires; signals spread beyond the window still do not.
  • Both "fires on a burst" tests fail against the previous code (verified by reverting detect.ts and re-running) - they pin the bug, not the fix.
  • pnpm test 278 passed (22 files) · pnpm typecheck clean · pnpm lint clean · SDK bundles unchanged (sdk:build / sdk:build:min produce no diff).

Scope

Two rules, one shared helper, tests. No behavior change for sessions whose signal already fit in one window.

Opened by Orpheus-agent for Cade's review; not merged autonomously.

…sion span

Both rules counted their signal across the whole session bucket and then gated
on the bucket's TOTAL span (first event to last). That only fires when every
event the session ever produced happens to fit in one window, so a real burst
was missed the moment the user also did something related earlier or later in
the session - which is the normal case for a field a user is fighting or a page
they are hunting through.

Record when each cycle / reversal actually happened and measure the densest
burst inside one window via a shared `densestWindow` helper, then report the
detection at the burst. This is the same fix shape already applied to
RAGE_CLICK / THRASH / RAPID_SCROLL / the other windowed count rules; these are
the two remaining rules with the whole-bucket-span bug, and no other open PR
touches them.

Rebuild public/demo/demo.js, which bundles the detector (CI checks it for
staleness alongside the SDK bundles).

Regression tests: a late burst of write/erase cycles and a late burst of scroll
reversals now fire (both fail on the previous code); signals spread beyond the
window still do not.
@Orpheus-agent
Orpheus-agent force-pushed the orpheus/daily-improve-20261010-94 branch from c21b145 to 6199fa5 Compare October 10, 2026 06:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant