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.
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 didconsole.error(...)before returning a clean 502 -- unlikeworkers/api.ts'scaptureAiRouteErrorandworkers/data-api.ts'scaptureDataApiError, nothing reached Sentry or PostHog for this path. The outerSentry.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_TOKENwas never provisioned as a secret onmetagraphed-data-api, so its own existingcaptureDataApiErrorcall was a silent no-op for the PostHog half.Fix
captureRegistrySyncError()toworkers/registry-sync-api.ts, matching the existingcaptureDataApiError/captureAiRouteErrorpattern exactly (Sentry.captureException + recordExceptionEvent).POSTHOG_PROJECT_TOKENas a Worker secret on bothmetagraphed-data-apiandmetagraphed-registry-sync-api(matches the same value already live on the mainmetagraphedWorker).Acceptance criteria
metagraphed-registry-sync-apinow emits a PostHog$exceptionevent.npm run test:coveragestays green.