Skip to content

registry-sync-api: no error capture on the handled write-failure path #8093

Description

@JSONbored

Found auditing PostHog error-tracking coverage across all 3 backend Workers (metagraphed, metagraphed-data-api, metagraphed-registry-sync-api).

Context

workers/registry-sync-api.ts's single write-failure catch block only did console.error(...) before returning a clean 502 -- unlike workers/api.ts's captureAiRouteError and workers/data-api.ts's captureDataApiError, nothing reached Sentry or PostHog for this path. The outer Sentry.withSentry() wrap (registry-sync-api.sentry.ts) only sees genuinely uncaught exceptions, and this one is caught and handled cleanly, so it never reached Sentry either.

Also: POSTHOG_PROJECT_TOKEN was never provisioned as a secret on metagraphed-data-api, so its own existing captureDataApiError call was a silent no-op for the PostHog half.

Fix

  • Added captureRegistrySyncError() to workers/registry-sync-api.ts, matching the existing captureDataApiError/captureAiRouteError pattern exactly (Sentry.captureException + recordExceptionEvent).
  • Added POSTHOG_PROJECT_TOKEN as a Worker secret on both metagraphed-data-api and metagraphed-registry-sync-api (matches the same value already live on the main metagraphed Worker).

Acceptance criteria

  • A write failure on metagraphed-registry-sync-api now emits a PostHog $exception event.
  • npm run test:coverage stays green.

Metadata

Metadata

Assignees

Labels

backendmaintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions