Skip to content

fix(api): replace Sentry with PostHog for the hosted ORB Worker#8618

Merged
JSONbored merged 1 commit into
mainfrom
claude/hosted-worker-remove-sentry
Jul 25, 2026
Merged

fix(api): replace Sentry with PostHog for the hosted ORB Worker#8618
JSONbored merged 1 commit into
mainfrom
claude/hosted-worker-remove-sentry

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Completes the hosted-Worker leg of #8288 under epic #8286's 2026-07-25 strategy correction: PostHog now fully replaces Sentry on this surface (no parallel-run). Companion to #8617 (self-host's equivalent removal).

  • Removed the @sentry/hono/cloudflare middleware registration from src/api/routes.tscreateWorkerPostHogErrorMiddleware() (PostHog error tracking for the hosted ORB Worker path (raw $exception, no SDK in the bundle) #8288) already covers the same Context.error capture path Hono's own error-handling model routes through.
  • Dropped @sentry/hono and @sentry/cloudflare from package.json (fully unused now — verified via npm ls).
  • Removed the now-dead WORKER_SENTRY_DSN/WORKER_SENTRY_ENVIRONMENT Env fields from src/env.d.ts.
  • Updated src/api/worker-posthog.ts's doc comments and the two affected tests (cloudflare-worker-runtime-detection.test.ts, test/workers/worker-runtime.test.ts) that referenced the removed middleware.

One real, narrow scope note (documented in worker-posthog.ts): PostHog's middleware captures errors that propagate through Hono's dispatch chain, not a crash reachable only via the raw fetch() export outside Hono — Sentry's old middleware additionally patched the Worker's fetch export for that case via @sentry/cloudflare's withSentry. This codebase has no PostHog equivalent for that specific edge, since every real route here is dispatched through Hono anyway.

Test plan

  • npm run typecheck — clean
  • Full npm run test:ci gate — 1155 test files / 21599 tests passed, 0 failures
  • npm run test:workers (the Workers-pool suite worker-runtime.test.ts lives in) — 3/3 pass
  • npm audit --audit-level=moderate — same 5 pre-existing high-severity findings as main, unrelated

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
loopover-ui 188bf3c Commit Preview URL

Branch Preview URL
Jul 25 2026, 11:50 AM

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.76%. Comparing base (0e93a85) to head (188bf3c).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8618   +/-   ##
=======================================
  Coverage   92.76%   92.76%           
=======================================
  Files         797      797           
  Lines       79355    79355           
  Branches    24034    24034           
=======================================
  Hits        73616    73616           
  Misses       4592     4592           
  Partials     1147     1147           
Flag Coverage Δ
backend 93.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/api/routes.ts 95.29% <ø> (ø)
src/api/worker-posthog.ts 100.00% <ø> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 25, 2026
@loopover-orb

loopover-orb Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-25 11:40:36 UTC

7 files · 1 AI reviewer · 2 blockers · CI green · dirty

⏸️ Suggested Action - Manual Review

Review summary
This PR cleanly completes the Sentry-to-PostHog cutover for the hosted Worker: it removes the `sentry()` middleware registration and `@​sentry/hono`/`@​sentry/cloudflare` deps from routes.ts/package.json, drops the dead `WORKER_SENTRY_DSN`/`WORKER_SENTRY_ENVIRONMENT` env fields, and updates doc comments plus two tests that referenced the removed middleware. The change is narrow, well-scoped to the stated intent, and honestly documents the one real capability gap (no PostHog equivalent for the raw fetch()-export-only crash case, which Sentry's withSentry patch used to cover) rather than hiding it. Removing the Sentry test (`still serves a normal response when WORKER_SENTRY_DSN is unset`) is correct since that middleware and env var no longer exist.

Nits — 4 non-blocking
  • The magic date '2026-07-25' is repeated as a literal string across three files' doc comments (worker-posthog.ts, env.d.ts, routes.ts) instead of referencing a single changelog/issue entry — fine for prose but worth a single source of truth if it recurs again.
  • src/env.d.ts and worker-posthog.ts doc comments still describe the Hono-dispatch-only scope gap in slightly different wording each time; consider consolidating into one canonical doc location referenced from the others to avoid drift.
  • Consider linking the new doc comments in worker-posthog.ts and routes.ts to the same canonical explanation of the fetch()-export scope gap (e.g. via a single JSDoc that others reference) rather than restating it three times.
  • The test-to-code ratio (0.22) is low, but this is a deletion-heavy PR (removing middleware and env fields) rather than new logic, so the existing modified tests (which cover the replacement path) are likely adequate — no new test is strictly required here.

Concerns raised — review before merging

  • No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example Closes #123) before opening the PR.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. No linked issue detected: No closing reference or linked issue number was found in the PR metadata/body. — If this PR is intended to solve an issue, link it explicitly in the PR body.

2. Maintainer requires a linked issue: This repo's maintainer focus manifest requires every PR to reference a tracked issue. — Link the relevant issue (for example `Closes #123`) before opening the PR.

Decision drivers

  • ❌ Code review — 2 blockers (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 13 registered-repo PR(s), 13 merged, 241 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 13 PR(s), 241 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, MDX, Shell, Solidity, JavaScript
  • Official Gittensor activity: 13 PR(s), 241 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Then work through the remaining 2 steps in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 25, 2026
Removes the @sentry/hono/cloudflare middleware from routes.ts now that
PostHog error tracking is a full replacement, not a parallel-run sink
(2026-07-25 epic #8286 correction) -- the createWorkerPostHogErrorMiddleware
added in #8288 already covers the same Context.error capture path. Drops
@sentry/hono and @sentry/cloudflare from package.json (fully unused now)
and the now-dead WORKER_SENTRY_DSN/WORKER_SENTRY_ENVIRONMENT Env fields.
@JSONbored
JSONbored force-pushed the claude/hosted-worker-remove-sentry branch from 65982f5 to 188bf3c Compare July 25, 2026 11:48
@JSONbored
JSONbored merged commit a266d7a into main Jul 25, 2026
5 checks passed
@JSONbored
JSONbored deleted the claude/hosted-worker-remove-sentry branch July 25, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant