Repository navigation
feat(trackers,browser): ProcessTracker (heap, main-thread lag, idle, user idle, uptime) (TR5) - #83
Conversation
…i:local / review yet Work stopped mid-way for a session hand-off; see the draft PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…user idle, uptime domain tracker) (TR5) Mutator loop run on the new tracker; lint fixes and a stale-idle-callback test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
…lock read once, no NaN lag, teardown finally, test strength Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
…ssion, clock retry, single hostile-clock report, stable env closures, test gaps Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
…no phantom run on sync query failure, reset drops listeners, dead field removed Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
…uery receiver, lag with custom interval Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
|
Claude finished @bugseeai's task in 1m 1s —— View job Review of PR #83: ProcessTracker (TR5)Scope reviewed: FindingsNo new P0–P2 issues. I tried to break these paths and found no failing scenario:
P3 (low), not blocking: seed path in
Known limit (already disclosed, no new action)
Summary
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
|
Claude finished @bugseeai's task in 1m 9s —— View job Deep review of PR #83: ProcessTracker (TR5), re-run on the latest pushI read
Earlier findings
New findings (inline)
What I tried to break and could not
Summary
|
| }; | ||
|
|
||
| try { | ||
| void Promise.resolve(query.call(permissions, { name: 'idle-detection' })).then( |
There was a problem hiding this comment.
P2 — Location: #startUserIdle / UserIdleProducer (trace-producers.ts), wired on by default in createBrowserSystemTraceProducers.
Problem: The idle-detection permission check only shows that the host page was granted the permission. It does not show consent to record the user's idle or screen-locked state and upload it to Bugsee. The SDK never prompts, but it reuses a grant the user gave to the site for its own feature.
Impact: user_idle_state (active/idle/locked) is behavioural data. It lands in every bug report for any app that already uses Idle Detection, with no SDK-level switch. This sits in the same consent family as the held-trace-after-revoke decision, but it is a separate question: this one covers collection on a grant the SDK never asked for, while the other covers retraction after a revoke.
Scenario: A customer app asks for idle-detection to dim its own UI. After the user accepts, the SDK starts a second IdleDetector on the same grant. Locked/idle transitions are then written to traces.system and uploaded.
Fix: Record the owner decision before release. Consider an explicit opt-in (e.g. a launch option defaulting to off) for the userIdle producer, or document the behaviour prominently in the privacy docs. Pair it with the pending retract-on-revoke decision.
There was a problem hiding this comment.
Addressed in c667c65. Decision (the maintainer's, pending owner confirmation): user_idle_state is now OPT-IN. A page's own idle-detection grant is not consent to record and upload idle/locked state.
- New launch option
captureUserIdle(browser and WebView launch; default false; only booleantrueenables it, any other value stays off and is reported).createBrowserSystemTraceProducersbuildsUserIdleProduceronly forcaptureUserIdle === true, so without the opt-in the permission is not even queried. - When on, the tracker still starts a detector only if the permission already reports
granted; the SDK never prompts. - Tests: off-by-default, on+granted, on+prompt/denied, factory-level and launch-level (browser and WebView), invalid-value tests, option classification tests. Mutations on the gate, the launch pass-through and the default were each caught.
- README, docs/PROGRESS.md and the changeset updated. This applies only to
user_idle_state; private-mode detection is a separate decision. The retract-on-revoke question for held traces is unchanged and still pending.
Generated by Claude Code
| '@bugsee/trackers': minor | ||
| --- | ||
|
|
||
| Browser and WebView system traces gain `main_thread_idle_ms` (the browser's granted idle period, 0-50 ms, from one `requestIdleCallback` probe per sampling tick on visible pages; omitted where `requestIdleCallback` is absent, and for a tick in which no idle period was granted) and `user_idle_state` (`active`, `idle` or `locked`, from the Idle Detection API). `user_idle_state` is produced only when the page's `idle-detection` permission is already granted: the SDK never prompts for it. The heap (`ram_js_heap_*`) and `main_thread_lag_ms` traces are unchanged but now come from one per-window `ProcessTracker` (new in `@bugsee/trackers/browser`), whose stages (`heap`, `mainThreadLag`, `idle`, `userIdle`, `uptime`) run only while they have listeners. `MultiKeyEmitterBase` gains the protected `listenerCount` / `onListenersChanged` hooks. |
There was a problem hiding this comment.
P3 — Problem: The last sentence says MultiKeyEmitterBase "gains the protected listenerCount / onListenersChanged hooks". This PR does not touch packages/trackers/src/emitter.ts. Both hooks are already on main (emitter.ts:90, :98) and ui-tracker.ts already uses them.
Impact: The changelog for @bugsee/trackers would attribute an API addition to the wrong release.
Fix: Drop that sentence, or confirm the hooks are described in the changeset of the PR that introduced them.
There was a problem hiding this comment.
Fixed in 7d84773: the stale MultiKeyEmitterBase sentence is removed from the changeset (the hooks came in with #82, which is already on main).
Generated by Claude Code
There was a problem hiding this comment.
Fixed (already in 7d84773 for the changeset). In c667c65 the same stale claim is also removed from docs/PROGRESS.md (TR5 entry): the listenerCount/onListenersChanged hooks come from #82 and this PR does not touch the emitter. The changeset now also describes the captureUserIdle opt-in.
Generated by Claude Code
…dy on main via #82) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
|
Claude finished @bugseeai's task in 21s —— View job Deep review of PR #83 (TR5 ProcessTracker), re-run on the latest pushI read the diff against What changed since my last reviewThe only new commit is FindingsNo new findings. I rechecked the producer wiring in
Still open from earlier rounds (not repeated as new)
Summary
|
…e (review P2) The host page's idle-detection grant is not consent to record and upload idle/locked state. UserIdleProducer is now built only for captureUserIdle:true (default false, strict boolean, invalid reported) and still only produces a trace when the permission is already granted (the SDK never prompts). Applies only to user_idle_state. Also corrects the stale MultiKeyEmitterBase sentence in PROGRESS.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @krassx's task in 30s —— View job Deep review of PR #83 (TR5 ProcessTracker), re-run on the latest pushScope: The only new commit since my last review is Earlier findings: status
New findingsNone. Things I checked on the new commit:
Summary
|
…5/TR7 (#82/#83/#84 merged) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC
Umbrella and hand-off: #53.
What
packages/trackers/src/browser/process-tracker.ts(+test): domain tracker with stagesheap,mainThreadLag(timer drift, same algorithm as feat(browser,webview): screen_size and main_thread_lag_ms traces (ST4c) #75),idle(requestIdleCallbackonce per sampling tick, visible pages only),userIdle(Idle Detection API ONLY when the Permissions API already reportsgranted; the SDK never prompts) anduptime.packages/browser/src/trace-producers.tsrewired onto it; new tracesmain_thread_idle_msanduser_idle_state. The oldmemory-tracker.tsandmain-thread-lag-tracker.tsare removed (no remaining references).rebind;browserTraceEnvFromnow caches bound closures per (window, fn) so a no-op relaunch does not restart armed stages.docs/PROGRESS.mdupdated.Verification
@bugsee/node-utilschmod tests fail only when run as root (sandbox); unrelated to this change.Open owner decision
user_idle_stateis a held value: a revoke cannot retract an already-recorded value (the seed is age-bounded and gated on a live, confirmed detector, but a producer that already published keeps re-recording). Same family as the pendingstorage_estimatedecision recorded indocs/PROGRESS.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01A1UFAUHj4nozT7kLwBgMrC