Skip to content

feat(api): request and session IDs from the frontend, client error endpoint and axiom frontend dashboard - #69

Merged
jplacht merged 1 commit into
mainfrom
feat/client-error-correlation
Oct 1, 2026
Merged

jplacht merged 1 commit into
mainfrom
feat/client-error-correlation

Conversation

@jplacht

@jplacht jplacht commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What and why

Frontend and backend logs can't be joined today: the frontend sends no IDs, CORS would reject them, and a response that fails the frontend's Zod check is logged by the backend as a clean 200. This lets the frontend send a request ID and session ID on every call (logged as request_id / correlation_id, also on the Celery tasks a call queues) and report errors from the browser to a new endpoint, logged as client_error for Axiom.

Changes

  • X-Request-ID / X-Correlation-ID accepted when they are UUIDs (canonicalized to lowercase, anything else dropped) and logged as request_id / correlation_id, also on queued tasks
  • CORS allows both headers
  • POST /client-errors/: no auth, bounded body (unknown keys rejected), logs client_error, returns 204; throttle scope client_error 30/min
  • Tests for the middleware, Celery propagation, CORS preflight and the endpoint (204/400/429)

The matching Axiom dashboard (prunplanner-frontend) lives in the workspace repo's axiom/ builder.

How it was verified

QA PASS (2 rounds: full, then scoped to the UUID canonicalization). uv run ruff check, ruff format --check, ty check and pytest (798 passed) green. e2e stack: preflight, IDs in request_finished and client_error, 204 / 400 / 429, expired token still 204, uppercase IDs logged lowercase, invalid IDs replaced.

Deploy order

Backward compatible (new endpoint, optional headers); deploy before the frontend change (obs-02) that sends them.

🤖 Generated with Claude Code

…dpoint and axiom frontend dashboard

- X-Request-ID / X-Correlation-ID accepted when they are UUIDs (canonicalized to lowercase,
  anything else dropped) and logged as request_id / correlation_id, also on queued tasks
- CORS allows both headers
- POST /client-errors/: no auth, bounded body (unknown keys rejected), logs client_error,
  returns 204; throttle scope client_error 30/min
- Tests for the middleware, Celery propagation, CORS preflight and the endpoint (204/400/429)

Spec: specs/2026-10-01-obs-01-client-errors-backend.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity · 0 duplication

Metric Results
Complexity 8
Duplication 0

View in Codacy

🟢 Coverage 96.49% diff coverage · +0.01% coverage variation

Metric Results
Coverage variation ✅ +0.01% coverage variation (-1.00%)
Diff coverage ✅ 96.49% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (22b3f7a) 4735 4525 95.56%
Head commit (2a8eb1e) 4791 (+56) 4579 (+54) 95.58% (+0.01%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#69) 57 55 96.49%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jplacht
jplacht merged commit 7dd03bf into main Oct 1, 2026
6 checks passed
@jplacht
jplacht deleted the feat/client-error-correlation branch October 1, 2026 13:57
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