feat(discovery-index): replace Sentry with PostHog for error tracking + sourcemap pipeline#8614
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | 2bfc6af | Commit Preview URL Branch Preview URL |
Jul 25 2026, 08:45 AM |
Bundle ReportBundle size has no change ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8614 +/- ##
==========================================
+ Coverage 92.55% 92.57% +0.01%
==========================================
Files 798 799 +1
Lines 79850 79976 +126
Branches 24120 24156 +36
==========================================
+ Hits 73908 74034 +126
Misses 4803 4803
Partials 1139 1139
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-25 08:33:02 UTC
Review summary Nits — 7 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
…e as a parallel Sentry sink Adds src/posthog.ts, mirroring src/sentry.ts's shape exactly (same redaction rules, tag allowlist, capture entry points) using PostHog's documented captureException(error, distinctId, properties) API, wired into app.ts's onError handler, server.ts's unhandled-rejection/ uncaught-exception hooks and shutdown path, and worker.ts's Container env forwarding. Extends upload-sourcemaps.ts with a second, fully independent leg: posthog-cli sourcemap inject/upload with an explicit --release-version (the Docker build never copies .git, so the CLI's own git-metadata auto-detection has nothing to inspect), running after the existing, unmodified Sentry leg so an unverified interaction between the two CLIs' inject steps can't put the proven flow at risk. Adds scripts/validate-posthog-release.mjs, a narrower release-verification counterpart to validate-sentry-release.mjs -- PostHog's release model has no commits/deploys/finalize lifecycle to check, only symbol-set presence via the error_tracking/symbol_sets API. All PostHog config (POSTHOG_API_KEY/HOST/ENVIRONMENT/RELEASE for capture, POSTHOG_CLI_API_KEY/PROJECT_ID/HOST for sourcemap upload) is wired end-to-end but not yet a real wrangler.jsonc var/secret -- #7875 (a real loopover-owned PostHog project) isn't provisioned yet, so every path stays a complete no-op until then, same as an unset SENTRY_DSN. Runs fully parallel with the existing Sentry sink per the epic's gated decommission plan (#8298); nothing about the Sentry leg changes here. Closes #8289
…racking sink Per the epic's revised strategy (#8286 correction, 2026-07-25): PostHog replaces Sentry directly, not a parallel-run sink. This branch's earlier commit added PostHog alongside the existing Sentry wiring; this commit finishes the swap by removing Sentry entirely. Deletes src/sentry.ts, scripts/validate-sentry-release.mjs, the @sentry/node/@sentry/cli dependencies, and the live metagraphed Sentry DSN previously baked into wrangler.jsonc's vars (a genuine cross-project entanglement -- discovery-index reporting into a different product's shared Sentry project, exactly the problem #8289 set out to fix). Removes the corresponding SENTRY_* fields from env.d.ts/WorkerEnv/ Cloudflare.Env, regenerates worker-configuration.d.ts, and drops the Sentry leg from upload-sourcemaps.ts (PostHog's inject/upload/validate flow is now the only path, no more Math.max(sentryExitCode, postHogExitCode) combining). @posthog/cli is pinned to an exact version (0.9.1, no caret) rather than a range -- its postinstall script downloads a platform binary over HTTPS with no checksum verification. Also rebases onto current main to pick up #8612's postcss/tar dependency overrides, which an earlier `npm install --workspace` in this branch had inadvertently regressed to their pre-fix versions. Closes #8289
6561117 to
2bfc6af
Compare
Summary
Per the epic's revised strategy (correction comment on #8286, 2026-07-25): PostHog replaces Sentry directly, not a parallel-run sink. This PR's history reflects that: the first commit added PostHog alongside the existing Sentry wiring; the second commit finishes the swap by removing Sentry entirely.
src/sentry.ts,scripts/validate-sentry-release.mjs,@sentry/node,@sentry/cli, and the live metagraphed Sentry DSN that was baked intowrangler.jsonc'svars-- a genuine cross-project entanglement (discovery-index reporting into a different product's shared Sentry project), exactly the problem this migration set out to fix.src/posthog.ts(mirrors the deletedsentry.ts's shape 1:1) andscripts/validate-posthog-release.mjs(narrower than the deleted Sentry validator, since PostHog's release model has no commits/deploys/finalize lifecycle -- just symbol-set presence + nofailure_reasonviaerror_tracking/symbol_sets).upload-sourcemaps.ts's PostHog inject/upload/validate flow is now the only path (no more Sentry-then-PostHog sequencing or exit-code combining).@posthog/cliis pinned to an exact version (0.9.1, no caret) -- its postinstall script downloads a platform binary over HTTPS with no checksum verification.mainto pick up fix(deps): resolve postcss + tar audit findings via overrides #8612's postcss/tar dependency-audit fix, which an earliernpm install --workspacein this branch had inadvertently regressed to pre-fix versions.All PostHog config is wired end-to-end but not yet a real
wrangler.jsoncvar/secret -- #7875 (a real loopover-owned PostHog project) isn't finished, so every path stays a complete no-op until then.Closes #8289
Test plan
npm run typecheck(repo root + discovery-index package +cf:typecheck) cleannpx vitest run test/unit/discovery-index/-- 180/180 passing, 100% line/branch coverage on every touched filenpm run build --workspace @loopover/discovery-indexandcf:typecheckcleannpm audit --audit-level=moderate-- only the pre-existing, already-trackedeslint/brace-expansionfinding (Bump eslint to v10 to resolve brace-expansion/minimatch DoS chain (GHSA-mh99-v99m-4gvg) #8608-8610), nothing new