From 23ecb810d8efc4dfe50efc1a496e61a62b9ca953 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 19 Jun 2026 21:38:28 +0100 Subject: [PATCH 1/4] chore(analytics): adopt posthog-js defaults 2026-05-30 Set the `defaults: "2026-05-30"` config flag on the browser posthog.init call so the app opts into the latest posthog-js default behaviors. This value was introduced in posthog-js 1.378.0, so bump the dependency from ^1.283.0 to ^1.378.0 (lockfile resolves to 1.386.6). Generated-By: PostHog Code Task-Id: 9b346513-66e9-4766-a449-e2c158abf8d5 --- packages/ui/package.json | 2 +- packages/ui/src/shell/posthogAnalyticsImpl.ts | 1 + pnpm-lock.yaml | 40 ++++++++++--------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/packages/ui/package.json b/packages/ui/package.json index 00979580e0..9759cfc99c 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -91,7 +91,7 @@ "fzf": "^0.5.2", "inversify": "catalog:", "lucide-react": "^1.7.0", - "posthog-js": "^1.283.0", + "posthog-js": "^1.378.0", "radix-themes-tw": "0.2.3", "react-hotkeys-hook": "^4.4.4", "react-markdown": "^10.1.0", diff --git a/packages/ui/src/shell/posthogAnalyticsImpl.ts b/packages/ui/src/shell/posthogAnalyticsImpl.ts index e4ddbada6d..f6b7c0ae4b 100644 --- a/packages/ui/src/shell/posthogAnalyticsImpl.ts +++ b/packages/ui/src/shell/posthogAnalyticsImpl.ts @@ -55,6 +55,7 @@ export function initializePostHog(sessionId?: string) { } posthog.init(apiKey, { + defaults: "2026-05-30", api_host: apiHost, ui_host: uiHost, disable_session_recording: false, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 216ed2a996..c570d6f79d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1296,8 +1296,8 @@ importers: specifier: ^1.7.0 version: 1.7.0(react@19.1.0) posthog-js: - specifier: ^1.283.0 - version: 1.340.0 + specifier: ^1.378.0 + version: 1.386.6 radix-themes-tw: specifier: 0.2.3 version: 0.2.3 @@ -4558,6 +4558,9 @@ packages: '@posthog/core@1.20.0': resolution: {integrity: sha512-e/F20we0t6bPMuDOVOe53f908s23vuKEpFKNXmZcx4bSYsPkjRN49akIIHU621HBJdcsFx537vhJYKZxu8uS9w==} + '@posthog/core@1.32.3': + resolution: {integrity: sha512-vwOEMfZvGv5XxNWV7p9I52NSmvFNMhyW2IHpIoUHW5jLkgUrknzJW1H/qxVGSIrNNVQkfsoaDFzDhJdg10pgrA==} + '@posthog/hedgehog-mode@0.0.48': resolution: {integrity: sha512-CswMCbELF5De2gFDD7tyEsNiQhEivb3Mhq12RgcjAQxm1/VPD4lx2kDlpVpRv5qOJVgDVYGUFrgMWlnytNLagg==} engines: {node: '>=18'} @@ -4588,8 +4591,8 @@ packages: peerDependencies: rollup: '>= 4.0.0' - '@posthog/types@1.340.0': - resolution: {integrity: sha512-vsHaWgioNUFUt7iPdPnjfyhQuOs0GcuIk1dSfDJ4w37y+Lj3GCvQy4Wqes7yGGB7splAuUNG2PZYVWWfQjpqIw==} + '@posthog/types@1.386.3': + resolution: {integrity: sha512-LqJoiQi2eyWn7rCUgnn+D+F3Efp6+04o72bjSX6kWHx0nFaYNC/nJuAIRliDTY/X7GPIUAaHAcSjbMI/9wfX1Q==} '@preact/signals-core@1.13.0': resolution: {integrity: sha512-slT6XeTCAbdql61GVLlGU4x7XHI7kCZV5Um5uhE4zLX4ApgiiXc0UYFvVOKq06xcovzp7p+61l68oPi563ARKg==} @@ -7879,8 +7882,8 @@ packages: resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} engines: {node: '>= 4'} - dompurify@3.3.1: - resolution: {integrity: sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==} + dompurify@3.4.10: + resolution: {integrity: sha512-0xzNv0e7oYC6yyuOGZIABPM4qtg3QxLFniDNPP4ZP90wR8Yq3zgwpRbrNiT4N3IKqDbbYFEJLV+JWEs19aZ//w==} domutils@3.2.2: resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==} @@ -11168,8 +11171,8 @@ packages: resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} engines: {node: ^10 || ^12 || >=14} - posthog-js@1.340.0: - resolution: {integrity: sha512-9Q/kX302HWRymQqeBSZTARR54jbeGTKxjmlAkaGwi0z3S/EOsPZycNmRq/5iHxliIBbHLl8jcDSVElHzNKUaRg==} + posthog-js@1.386.6: + resolution: {integrity: sha512-xRcbToRtU07Ojk+VaCCos6I/zD60sNKfWxdeZih0xbncgegIqLZJmBzi4HdkSkXrf14b6HhwMI/s2GxWha5ADQ==} posthog-node@5.24.10: resolution: {integrity: sha512-C4ueZUrifTJMDFngybSWQ+GthcqCqPiCcGg5qnjoh+f6ie3+tdhFROqqshjttpQ6Q4DPM40USPTmU/UBYqgsbA==} @@ -17176,6 +17179,10 @@ snapshots: dependencies: cross-spawn: 7.0.6 + '@posthog/core@1.32.3': + dependencies: + '@posthog/types': 1.386.3 + '@posthog/hedgehog-mode@0.0.48(prop-types@15.8.1)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': dependencies: gsap: 3.14.2 @@ -17225,7 +17232,7 @@ snapshots: transitivePeerDependencies: - debug - '@posthog/types@1.340.0': {} + '@posthog/types@1.386.3': {} '@preact/signals-core@1.13.0': {} @@ -20850,7 +20857,7 @@ snapshots: dependencies: domelementtype: 2.3.0 - dompurify@3.3.1: + dompurify@3.4.10: optionalDependencies: '@types/trusted-types': 2.0.7 @@ -24770,17 +24777,12 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 - posthog-js@1.340.0: + posthog-js@1.386.6: dependencies: - '@opentelemetry/api': 1.9.0 - '@opentelemetry/api-logs': 0.208.0 - '@opentelemetry/exporter-logs-otlp-http': 0.208.0(@opentelemetry/api@1.9.0) - '@opentelemetry/resources': 2.5.0(@opentelemetry/api@1.9.0) - '@opentelemetry/sdk-logs': 0.208.0(@opentelemetry/api@1.9.0) - '@posthog/core': 1.20.0 - '@posthog/types': 1.340.0 + '@posthog/core': 1.32.3 + '@posthog/types': 1.386.3 core-js: 3.48.0 - dompurify: 3.3.1 + dompurify: 3.4.10 fflate: 0.4.8 preact: 10.28.3 query-selector-shadow-dom: 1.0.1 From 82d66750bfd6c066287ca945677866b1b6be3467 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 19 Jun 2026 22:00:10 +0100 Subject: [PATCH 2/4] docs(analytics): explain the posthog-js 2026-05-30 defaults epoch Address convergent qa-swarm review feedback (paul + xp): the bare `defaults: "2026-05-30"` reads as an opaque date. Document that it's a named posthog-js defaults epoch, that it requires posthog-js >= 1.378.0 (kept in sync with package.json's floor), and that the explicit options below intentionally override it (posthog-js merges the epoch first, explicit config last). Generated-By: PostHog Code Task-Id: 9b346513-66e9-4766-a449-e2c158abf8d5 --- packages/ui/src/shell/posthogAnalyticsImpl.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/ui/src/shell/posthogAnalyticsImpl.ts b/packages/ui/src/shell/posthogAnalyticsImpl.ts index f6b7c0ae4b..c45fb4c292 100644 --- a/packages/ui/src/shell/posthogAnalyticsImpl.ts +++ b/packages/ui/src/shell/posthogAnalyticsImpl.ts @@ -55,6 +55,11 @@ export function initializePostHog(sessionId?: string) { } posthog.init(apiKey, { + // Pins posthog-js' baseline config to the 2026-05-30 defaults epoch (a named + // bundle of recommended defaults, not a date anything happens on). This value + // only exists in posthog-js >= 1.378.0 — keep package.json's floor in sync. + // posthog-js merges the epoch first and the explicit options below last, so + // every option set here deliberately overrides the epoch. defaults: "2026-05-30", api_host: apiHost, ui_host: uiHost, From d139813994ec8719e216c47210da19e42c286fdc Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 19 Jun 2026 22:03:38 +0100 Subject: [PATCH 3/4] fix(analytics): opt out of automatic pageviews under hash routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 2026-05-30 defaults epoch sets capture_pageview to "history_change", which auto-captures a pageview on every history change. The app routes via createHashHistory(), so the route lives in the URL hash and $pathname is identical across every screen — automatic pageviews would collapse all routes into one and corrupt route-level analytics. Set capture_pageview: false to opt out. Addresses Codex review finding (P2). Generated-By: PostHog Code Task-Id: 9b346513-66e9-4766-a449-e2c158abf8d5 --- packages/ui/src/shell/posthogAnalyticsImpl.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/ui/src/shell/posthogAnalyticsImpl.ts b/packages/ui/src/shell/posthogAnalyticsImpl.ts index c45fb4c292..37c767bb58 100644 --- a/packages/ui/src/shell/posthogAnalyticsImpl.ts +++ b/packages/ui/src/shell/posthogAnalyticsImpl.ts @@ -63,6 +63,12 @@ export function initializePostHog(sessionId?: string) { defaults: "2026-05-30", api_host: apiHost, ui_host: uiHost, + // The epoch turns capture_pageview into "history_change". This app routes via + // createHashHistory() (packages/ui/src/router/router.ts), so the route lives in + // the URL hash and $pathname is identical for every screen — automatic pageviews + // would collapse all routes into one and corrupt route-level analytics. Opt out + // and rely on explicit instrumentation instead. + capture_pageview: false, disable_session_recording: false, session_idle_timeout_seconds: SESSION_IDLE_TIMEOUT_SECONDS, ...(sessionId ? { bootstrap: { sessionID: sessionId } } : {}), From 398fedcb3db54acce62432e0a145ab5cdc49aade Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 19 Jun 2026 22:49:37 +0100 Subject: [PATCH 4/4] Apply suggestion from @pauldambra --- packages/ui/src/shell/posthogAnalyticsImpl.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/ui/src/shell/posthogAnalyticsImpl.ts b/packages/ui/src/shell/posthogAnalyticsImpl.ts index 37c767bb58..2225edc37f 100644 --- a/packages/ui/src/shell/posthogAnalyticsImpl.ts +++ b/packages/ui/src/shell/posthogAnalyticsImpl.ts @@ -55,11 +55,6 @@ export function initializePostHog(sessionId?: string) { } posthog.init(apiKey, { - // Pins posthog-js' baseline config to the 2026-05-30 defaults epoch (a named - // bundle of recommended defaults, not a date anything happens on). This value - // only exists in posthog-js >= 1.378.0 — keep package.json's floor in sync. - // posthog-js merges the epoch first and the explicit options below last, so - // every option set here deliberately overrides the epoch. defaults: "2026-05-30", api_host: apiHost, ui_host: uiHost,