Skip to content

Fix concurrent error-group create race on ingest#599

Merged
unjica merged 1 commit into
developfrom
fix/error-group-create-race
Jul 19, 2026
Merged

Fix concurrent error-group create race on ingest#599
unjica merged 1 commit into
developfrom
fix/error-group-create-race

Conversation

@unjica

@unjica unjica commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Concurrent POST /ingest/error requests for the same (project_id, fingerprint) can both miss findUnique and both call create; the loser hit Prisma P2002 and 500'd.
  • findOrCreateErrorGroup now catches P2002, re-fetches the existing group, increments occurrences (same path as a normal hit), and returns isNew: false so only the create winner triggers new-group notifications.
  • Regression tests cover the P2002 path and non-P2002 create errors.

Test plan

  • pnpm lint && pnpm test && pnpm build
  • Unit: simulated P2002 → re-fetch + isNew: false
  • Optional: dual concurrent /ingest/error with same fingerprint in staging after deploy

Note: safe to land on develop for a patch ride alongside any in-flight v1.17 deploy.

Made with Cursor

Catch Prisma P2002 on create, re-fetch the winner, and keep isNew true only for the creator so duplicate-fingerprint ingest no longer 500s.

Co-authored-by: Cursor <cursoragent@cursor.com>
@unjica
unjica merged commit 514622d into develop Jul 19, 2026
7 checks passed
@unjica
unjica deleted the fix/error-group-create-race branch July 19, 2026 11:10
FelineFantasy pushed a commit to FelineFantasy/telemetry-tracker that referenced this pull request Jul 20, 2026
…oup create race (Telemetry-Tracker#599).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant