Repository navigation
feat(electron): add opt-in automatic JavaScript error capture - #5716
marandaneto wants to merge 21 commits into
Conversation
…error-autocapture # Conflicts: # packages/electron/README.md # packages/electron/src/__tests__/main.test.ts # packages/electron/src/__tests__/renderer.test.ts # packages/electron/src/main/index.ts # packages/electron/src/renderer/index.ts
…error-autocapture # Conflicts: # packages/electron/src/__tests__/main.test.ts
…error-autocapture
…error-autocapture
…error-autocapture
…error-autocapture # Conflicts: # packages/electron/src/__tests__/renderer.test.ts # packages/electron/src/renderer/index.ts
Coherence📄 0 spec file errors · ⛔ 0 broken rules · 🚪 0 unchecked inputs · 🐛 0 bugs that came back What is Coherence?Coherence compares the code with its spec files ( This check read 44 parts of the code and 7 rules. Tip Nothing to fix. |
Node SDK acceptance v2Commit: 9694885 Capture v0✅ 83 passed / ❌ 4 non-passing / Drill-down: run artifacts → ❌ server_snapshot_payload_false — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_zero — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_null — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ migration/yaml-parity-v1/remote-flags-v1.feature::Omitted GeoIP settings default to enabled in flag requests — failed_assertionFlags field differs Code: Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:134 the first flags request field "geoip_disable" should equal JSON false Operation: Field: Expected: false Actual value: true Harness exit: 1; report validation exit: 1. Capture v1✅ 148 passed / ❌ 4 non-passing / Drill-down: run artifacts → ❌ server_snapshot_payload_false — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_zero — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_null — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ migration/yaml-parity-v1/remote-flags-v1.feature::Omitted GeoIP settings default to enabled in flag requests — failed_assertionFlags field differs Code: Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:134 the first flags request field "geoip_disable" should equal JSON false Operation: Field: Expected: false Actual value: true Harness exit: 1; report validation exit: 1. |
SDK performance: posthog-node3 changes worth reviewing: 3 observed improvements. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate.
View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
…error-autocapture
…error-autocapture
…error-autocapture
…xture clarification
📝 No Changeset FoundThis PR doesn't include a changeset. A changeset is required to release a new version. How to add a changesetRun this command and follow the prompts: pnpm changesetRemember: Never use |
|
|
✅ Security review complete — No findings above the confidence threshold, in 8 min. Add the |
There was a problem hiding this comment.
PostHog Review · Standard · reviewed b25c5d8: 1 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
…error-autocapture # Conflicts: # packages/electron/package.json # packages/electron/src/__tests__/main.test.ts # packages/electron/src/__tests__/renderer.test.ts # packages/electron/src/main/index.ts # packages/electron/src/renderer/index.ts
|
Verified 43423903309: burst-4096 CPU rises 41.8725 → 45.2325 µs/op (+8.02%), all six pairs positive. Node/core/benchmark digests and the lockfile are identical between compared sources. Actual runtime is Node 24.22.3. No changed measured implementation was identified, but matching Linux same-build controls are absent, so attribution remains blocked rather than calling the warning noise. |
dustinbyrne
left a comment
There was a problem hiding this comment.
The opt-in observers preserve the existing capture ownership and host error handling. The earlier disabled-state issue is addressed. Two optional notes remain about pending-opt-out observation and merge-backup artifacts.
AI-assisted review.
…error-autocapture
…error-autocapture
…error-autocapture
…error-autocapture
…error-autocapture
…error-autocapture
Problem
The Electron alpha needs automatic JavaScript error observation without changing app behavior.
Changes
Stacked on #5715 (
feat/electron-browser-integrations). Review and merge in dependency order. Keep the stack draft until human review and release gates are satisfied.Add optional main uncaught-exception monitoring and renderer error/rejection observers using core exception builders and the existing main-owned delivery path. Preserve exception mechanisms, stacks and process attribution. Check consent before reading error fields, bound error storms and remove listeners on disposal.
Preserve host error handling and termination. Main uses a monitor, not a rejection handler that would suppress native behavior. Same-document renderer reinitialization keeps bridge sequences increasing.
Validation and limits
165 unit tests, types/build/built checks, installed-package Electron error scenarios and seven native Node mode/handler comparisons passed. Actual app callbacks, uncanceled renderer events and native exit/warning behavior matched the disabled baseline.
Main warning-mode or host-handled promise rejections are not automatically captured. Fatal Electron delivery is best effort. Native crashes and symbolication are excluded.
Required isolated Pi autoreview was run against this branch and its immediate predecessor. Parent test-quality audit and reproduction-first fixes are recorded locally. Replay, native crash capture, surveys and product tours remain excluded.
Release info Sub-libraries affected
Libraries affected
@posthog/electron
Checklist
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi and specialist workers implemented and checked the change using local tools, Git/gh, real Electron fixtures and the prescribed isolated Pi autoreview helper. The parent verified findings against code and runtime evidence. Human review is required before merge.
Stack
Merge the implementation PRs in dependency order. Electron is private, ignored by stable Changesets and absent from the stable npm publish matrix starting in #5696; intermediate merges cannot publish it. Only #5720 removes the private flag and enables the separate protected manual alpha path. Merging #5720 still does not publish automatically.
Current CI follow-up
Windows and Linux native and genuine Forge/Builder jobs passed on Electron 41.0.2, 42.4.0 and 43.0.0. The initial macOS jobs were canceled because GitHub retired macos-14 on November 2, 2026. Both new Electron workflows now select the supported macos-15 image. Updated macOS CI is pending. Local macOS installed-package fixtures pass. Published conformance and npm readiness remain separate gates.
Merge-safety cleanup
The temporary
docs/plans/electron-sdk.mdplanning document is removed from the stack; local validation receipts remain ignored undertarget/. The built-export regression verifies actual Changesets release planning, private staging and the protected manual alpha boundary. It failed on the original stable Electron version bump and passes after cleanup. SDK runtime source is unchanged. Fresh CI results for these updated heads remain separate from historical runtime/conformance evidence.