feat(insights): multi-project Sentry archive #3

Merged
root merged 1 commits from feat/sentry-multi-project into main 2026-06-01 18:38:17 +03:00
Owner

The sentry-archive job was hardcoded to a single SENTRY_PROJECT slug. Now that sase has a second Sentry project (sase-web, browser SDK live as of 2026-06-01), the worker has to pull both — otherwise frontend events stay only in Sentry's UI and never reach sentry_events for the BIP to pick up.

Changes

  • SENTRY_PROJECT becomes a CSV (e.g. python,sase-web); single value still works.
  • Issues fetched org-wide (unchanged endpoint) but each row now persists sentrySourceProject from the Sentry payload.
  • Events iterate per project. Project-level failure recorded in error but doesn't abort the rest.
  • New result shape: perProject: { [slug]: { fetched, inserted, duplicate } }. Pipeline log gains a [python=N/M sase-web=N/M] breakdown.
  • Schema: nullable sentrySourceProject on SentryIssue + SentryEvent (+ composite index). Pure nullable add — prisma db push on container start is safe; existing rows stay null until next sync touches them.

Verification

  • pnpm --filter @panel/worker exec tsc --noEmit
  • pnpm --filter @panel/web exec tsc --noEmit
  • pnpm --filter @panel/web exec prisma generate

Post-merge

  1. Set SENTRY_PROJECT=python,sase-web on panel-worker Coolify app jk8gsg04w0kwo4sc4s84k8cc.
  2. Redeploy (the panel-worker auto-deploys on main push, so just merging is enough — Coolify will pick up the new env on the same deploy if you set it before merge, otherwise edit env + redeploy after).

🤖 Generated with Claude Code

The `sentry-archive` job was hardcoded to a single `SENTRY_PROJECT` slug. Now that sase has a second Sentry project (`sase-web`, browser SDK live as of 2026-06-01), the worker has to pull both — otherwise frontend events stay only in Sentry's UI and never reach `sentry_events` for the BIP to pick up. ## Changes - `SENTRY_PROJECT` becomes a CSV (e.g. `python,sase-web`); single value still works. - Issues fetched org-wide (unchanged endpoint) but each row now persists `sentrySourceProject` from the Sentry payload. - Events iterate per project. Project-level failure recorded in `error` but doesn't abort the rest. - New result shape: `perProject: { [slug]: { fetched, inserted, duplicate } }`. Pipeline log gains a `[python=N/M sase-web=N/M]` breakdown. - Schema: nullable `sentrySourceProject` on `SentryIssue` + `SentryEvent` (+ composite index). Pure nullable add — `prisma db push` on container start is safe; existing rows stay null until next sync touches them. ## Verification - `pnpm --filter @panel/worker exec tsc --noEmit` ✓ - `pnpm --filter @panel/web exec tsc --noEmit` ✓ - `pnpm --filter @panel/web exec prisma generate` ✓ ## Post-merge 1. Set `SENTRY_PROJECT=python,sase-web` on panel-worker Coolify app `jk8gsg04w0kwo4sc4s84k8cc`. 2. Redeploy (the panel-worker auto-deploys on main push, so just merging is enough — Coolify will pick up the new env on the same deploy if you set it before merge, otherwise edit env + redeploy after). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
root added 1 commit 2026-06-01 18:37:43 +03:00
The sentry-archive job was hardcoded to a single SENTRY_PROJECT slug.
Now that sase has a second Sentry project (sase-web, browser SDK), the
worker has to pull both — otherwise frontend events live only in
Sentry's UI and never reach the panel's sentry_events table for the
behavioral-insight pipeline to pick up.

Changes:

- SENTRY_PROJECT becomes a CSV (e.g. "python,sase-web") parsed once at
  module load into PROJECTS[]. Backward-compatible: a single value
  keeps working exactly as before.
- Issues are fetched org-wide in a single loop (unchanged endpoint)
  but each issue's Sentry project slug is now persisted via the new
  `sentrySourceProject` column on sentry_issues.
- Events are project-scoped on Sentry's side, so the job iterates
  projects and calls listEventsPage(slug, cursor) for each. Per-project
  pagination + dedup is preserved. A project-level failure is recorded
  in `error` but doesn't abort the other projects.
- New result shape: `perProject: { [slug]: { fetched, inserted, duplicate } }`
  Pipeline log gains a `[python=N/M sase-web=N/M]` breakdown so it's
  obvious at a glance which project produced what.
- Schema: nullable `sentrySourceProject` on both SentryIssue and
  SentryEvent (+ composite index per projectKey for queries that want
  to filter "panel project = sase AND sentry project = sase-web").
  Migration is a pure nullable add — `prisma db push` on container
  start is safe. Existing rows stay null until next sync touches them.

After merge, set `SENTRY_PROJECT=python,sase-web` on the panel-worker
Coolify app and redeploy.
root merged commit 59cb1f63ec into main 2026-06-01 18:38:17 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: root/sp#3