Skip to content

feat(browser,electron,node): adopt Android names for shared system events; camelCase params everywhere (C2) - #97

Merged
krassx merged 2 commits into
mainfrom
feat/shared-event-names-android
Oct 21, 2026
Merged

krassx merged 2 commits into
mainfrom
feat/shared-event-names-android

Conversation

@krassx

@krassx krassx commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Shared browser/WebView events.system names now follow Android (specs PR bugsee/specs#62, change C2): orientation_changed -> OrientationChanged {current, prev?, type, angle} (current/prev are the Android orientation ints; no params when type/angle unreadable), dark_mode_changed -> DarkModeChanged {dark}, process_foreground -> UIApplicationDidBecomeActiveNotification, process_background -> UIApplicationDidEnterBackgroundNotification. Names verified against the Android SDK (EventApplicationLifecycleTest, EventConfiguration) and agree with the spec.
  • No other JS event has a mobile-equivalent rename pending C2 in the spec; JS-only events keep snake_case.
  • camelCase params: audited browser, node, electron sources and trackers; every key was already camelCase, so nothing needed changing. Locked in by per-package conformance tests whose keys are derived from events the real sources emit (browser, node, electron), plus a repo-wide retired-name guard (whole repo except release notes and the dated docs/PROGRESS.md / docs/review/browser.md history) (packages/instrumentation-tests/test/event-names.guard.test.ts).
  • Docs (PROGRESS.md, review/browser.md) and a changeset (breaking for consumers of the old names; beta).

Follow-ups (not in this PR)

  • display_added/removed/metrics_changed params still {id, width, height, scaleFactor?, rotation?(deg), internal?, refreshRate?} (camelCase, but not the displays keys): C5 PR.
  • gc event: separate PR.
  • Historical .changeset/* entries still mention the old names (history, left as is).

Spec follow-ups

  • javascript.md row for OrientationChanged lists current as required, but the SDK emits a bare event (no params) when the engine cannot read both type and angle. The spec should say so.
  • OrientationChanged is emitted only when the Android orientation int really changes (a raw {type, angle} change mapping to the same int is silent; a 180-degree flip is a different int).

Test plan

  • pnpm ci:local passes
  • Mutator loop on the new orientation/prev/rename logic (one survivor found and killed with a new test)
  • Mutating a param key to snake_case in browser/node sources fails the conformance tests; a retired name in any package source fails the guard

🤖 Generated with Claude Code

…ents; camelCase params everywhere (C2)

OrientationChanged {current, prev?, type, angle}, DarkModeChanged {dark},
UIApplicationDidBecomeActiveNotification, UIApplicationDidEnterBackgroundNotification.
Per-package camelCase param conformance tests and a retired-name guard.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@claude

claude Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Claude finished @krassx's task in 24s —— View job


Review of PR #97 (Android names for shared system events)

I read the diff and the surrounding code (orientationToWire, the UiTracker orientation path, the repo-wide grep for the old names). I did not run the test suite or the linters.

Findings: no P0–P2 issues. I found nothing that justifies an inline comment.

What I checked

  • Rename completeness: a repo-wide grep for the four retired names finds them only in docs/PROGRESS.md and historical .changeset/* entries. No source, test or sample still emits or consumes process_background and the others, so nothing like fps pause is keyed on the old names. docs/PROGRESS.md is outside the guard's scan, so check that its remaining mentions are intentional history.
  • Orientation prev/current:
    • previousOrientation is seeded from #ui.current('orientation') at activation and re-seeded on each reactivation, so there is no stale state across deactivate/activate.
    • The bare event (type or angle unreadable) correctly leaves previousOrientation untouched.
    • current goes through the same orientationToWire as the orientation trace, so the event and trace values agree.
  • Params: all event param keys are camelCase, as the PR states.

Minor notes (P3, non-blocking)

  • prev can equal current. When two different unrecognised type strings both map to Unknown (0), UiTracker emits because the raw state changed, but the wire event reads {current: 0, prev: 0}. If Android only fires on an actual orientation change, you could skip the emit when current === previousOrientation. This is an unlikely edge case, so it is fine to leave.
  • The retired-name guard only scans packages/*/src. Samples and e2e fixtures outside src are not covered, but a grep shows none use the old names today.
  • A few comment lines in system-events.ts, trace-producers.ts and application-tracker.ts are now long because of the longer event names. This is cosmetic.

Summary

  1. Overall risk: Low.
  2. Merge recommendation: approve and merge. The breaking change is called out in the changeset (beta).
  3. Most important issues to fix: none required. The prev === current dedupe is the only optional one.
  4. Positives:
    • The conformance tests derive their keys from events the real sources emit, rather than from a hard-coded list.
    • The retired-name guard is built so it cannot match its own file.
    • The orientation logic is covered by mutator-loop tests, including a survivor that was killed.
    • Follow-ups (C5 displays, gc) are scoped out explicitly.

…xact key sets; repo-wide retired-name guard

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@claude

claude Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Claude finished @krassx's task in 22s —— View job


Re-review of PR #97 after the second commit (885b8c28)

I read the diff and the code around it: system-events.ts, the UiTracker orientation path, orientationToWire and the retired-name guard. I also grepped the repo for the four retired names. I did not run the test suite or the linters.

Findings: no new P0–P3 issues, so I have no inline comments.

Earlier findings

  • The previous review's only optional item was prev === current on OrientationChanged. 885b8c28 fixes it with if (current === before) return; in system-events.ts, so the event now fires only when the Android orientation int really changes.
  • The repo-wide guard now scans the whole repo, not just packages/*/src. This covers the earlier note about samples and e2e fixtures.
  • A grep outside .changeset/ finds the old names only in docs/PROGRESS.md and docs/review/browser.md. Both are exempt from the guard as dated history. docs/review/browser.md carries an explicit rename note, and PROGRESS.md has a new C2 entry saying older entries keep the old names.

What I checked

  • Rename completeness: nothing in the source consumes the old names. The ApplicationTracker comment is updated and AppStateProducer is not keyed on them.
  • Orientation state:
    • previousOrientation is seeded at onActivate, so a re-activation starts fresh.
    • A bare event (type or angle unreadable) leaves previousOrientation untouched. After it, the next real event carries the last known prev, and an identical orientation is suppressed. That is consistent with the "real change only" rule.
  • Wire values: current and prev both come from orientationToWire, the same function as the orientation trace, so the event and the trace agree.
  • Params: the key sets are camelCase. The conformance tests derive them from real emitted events.

Notes (not blocking)

  • The changeset says "prev omitted when unreadable", while the spec row lists current as required but the event is bare when type/angle is unreadable. PROGRESS.md records this spec mismatch. Please confirm it with bugsee/specs#62 before release.
  • A few comment lines are long after the renames (cosmetic).

Summary

  1. Overall risk: Low.
  2. Merge recommendation: approve and merge. The breaking rename is called out in the changeset (beta).
  3. Most important issues to fix: none.
  4. Positives:
    • The previous review's feedback was applied in the next commit with tests.
    • The guard cannot match itself and has a probe test.
    • The follow-ups for C5 display_* and gc are scoped out explicitly.
      · branch feat/shared-event-names-android

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89ad40dc-dc45-42db-9366-ef77c72b7745
📥 Commits

Reviewing files that changed from the base of the PR and between ae65d76 and 885b8c2.

📒 Files selected for processing: 12
  • .changeset/shared-event-names-android.md
  • docs/PROGRESS.md
  • docs/review/browser.md
  • packages/browser/src/launch.test.ts
  • packages/browser/src/system-events.test.ts
  • packages/browser/src/system-events.ts
  • packages/browser/src/trace-producers.ts
  • packages/electron/src/system-events.test.ts
  • packages/instrumentation-tests/test/event-names.guard.test.ts
  • packages/node/src/system-events.test.ts
  • packages/trackers/src/browser/application-tracker.ts
  • packages/webview/src/launch.test.ts
+------------------------------------------------------------------------------------------------+
| Your code and I have a love-hate relationship. I love finding bugs, you hate that I find them. |
+------------------------------------------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@krassx
krassx merged commit 2a9804c into main Oct 21, 2026
krassx added a commit that referenced this pull request Oct 21, 2026
Also drops the stale second orientationToWire argument in browser/system-events (main's #97 and #98 disagreed on the signature, so main's browser typecheck/build failed).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
krassx added a commit that referenced this pull request Oct 21, 2026
…x #98 merge) (#103)

#98 made orientationToWire take only the type; #97's two call sites still passed
the angle, which fails @bugsee/browser typecheck and build on main.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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