Repository navigation
Source maps phase 3: upload and list API - #122
Conversation
Expose POST/GET /api/project/source-maps for JSON map upload keyed by app, release, and bundle URL so CI can register maps before symbolication lands in phase 4. Co-authored-by: Cursor <[email protected]>
Raise per-route Fastify bodyLimit for POST /project/source-maps above the 10 MB map cap and trim app/release in Zod so whitespace-only keys are rejected before upsert. Co-authored-by: Cursor <[email protected]>
Share trim helpers between source map storage and POST /ingest/error so padded SDK labels match uploaded artifacts for retention and symbolication lookups. Co-authored-by: Cursor <[email protected]>
Use assertIngestAppAllowed and normalizeMapAppLabel for /ingest/batch so padded app fields match restricted API keys the same way as single-event and error ingest. Co-authored-by: Cursor <[email protected]>
Parse V8 and Firefox stack frames, resolve positions with uploaded source maps, and expose symbolicated_stack fields on GET /api/errors/:id for display-only de-minification. Co-authored-by: Cursor <[email protected]>
Derive symbolicated_top_stack from the first resolvable frame in occurrence stacks instead of top_stack (error message line), and dedupe concurrent listSourceMapArtifactsForRelease calls per release. Co-authored-by: Cursor <[email protected]>
Store trimmed app values on /ingest/event and /ingest/session (including session lookup) so padded SDK labels match error, batch, and source-map keys. Co-authored-by: Cursor <[email protected]>
…ase4 Source maps phase 4: stack symbolication
| data: { | ||
| project_id: projectId, | ||
| app: body.app, | ||
| app, |
There was a problem hiding this comment.
Whitespace-only ingest app becomes empty
Medium Severity
Ingest now stores normalizeMapAppLabel(body.app) while Zod still accepts any non-empty string, including whitespace-only values. Those labels trim to "" and are written to events, sessions, and errors. Upload validation rejects the same input, so ingest can persist invalid empty app keys and break scoping, quotas, and map alignment.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 37a7a89. Configure here.
| ok: true, | ||
| artifact: toSourceMapArtifactSummary(row), | ||
| created: existing === null, | ||
| }; |
There was a problem hiding this comment.
Upload may return wrong status
Low Severity
upsertSourceMapArtifact sets created from a pre-upsert findUnique, not from the upsert result. Concurrent uploads for the same key can both see no row and return 201 even when one request only replaced an artifact another just created.
Reviewed by Cursor Bugbot for commit 37a7a89. Configure here.
Reject whitespace-only app labels in ingest Zod schemas, normalize app/release on artifact lookup, and use create-then-update on P2002 so concurrent uploads return accurate 201/200 status. Co-authored-by: Cursor <[email protected]>
Require exact same-origin pathnames for full URLs, normalize ErrorGroup app/release when loading maps for legacy rows, and add regression tests. Co-authored-by: Cursor <[email protected]>
Compute the group top frame from occurrences_list[0] before parallel per-occurrence enrichment so older stacks cannot win under Promise.all and the newest occurrence without maps leaves symbolicated_top_stack unset. Co-authored-by: Cursor <[email protected]>
Lazy-load source map content by matching stack frames with caps on bundle refs and content fetches. Reject whitespace-only ingest apps via Zod trim, and match legacy padded session app labels on close/idempotency. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 4 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 01fcea5. Configure here.
Singleflight source map content fetches and enrich occurrences sequentially so MAX_SOURCE_MAP_CONTENT_LOADS_PER_DETAIL cannot be exceeded under Promise.all. Count distinct ingest apps with TRIM(app) so legacy padded labels match trimmed ingest keys. Co-authored-by: Cursor <[email protected]>


Summary
POST /api/project/source-mapsfor JSON source map upload (EDITOR+ session auth), upserting on(project, app, release, bundle_url)with 10 MB cap and SHA-256 dedupe metadataGET /api/project/source-maps?app=&release=to list uploaded map metadata (no map body) for any project member with read accesssource-map-upload.tswith validation, parsing, upsert, and list helpers plus unit testsdocs/source-maps.mdandCHANGELOG.mdfor phase 3 completionPart of #98 (v1.3.0). No new migrations.
Test plan
pnpm --filter api exec vitest run src/lib/source-map-upload.test.tspnpm run buildPOST /api/project/source-mapswith valid session + EDITOR role returns 201/200GET /api/project/source-maps?app=web&release=1.0.0returns metadata listMade with Cursor