2.5 KiB
2.5 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 02-frontend-error-endpoint | Frontend-error endpoint | completed | 2 |
|
plan.md | ../../specs/platform/requirements/diagnostic-logging.md |
Task 02: Frontend-error endpoint
Acceptance
- Authenticated install users can submit the exact bounded
POST /api/v1/system/logs/frontend-errorscontract and receive204. - A valid request creates one fixed
frontend error toasterror entry with client data, including an optional boundedtask_id, only in structured fields. - Malformed, oversized, source-invalid, text-empty, and truncation cases follow the spec without weakening the existing log-download allow-list.
- Per-identity 60/minute burst-20 and process-wide 300/minute burst-100 token
buckets return
429plusRetry-After; stale identity buckets are removed. - The endpoint lives in
internal/system/frontenderrors, not the legacyinternal/system/logspackage removed by Task 09.
Verification
cd apps/backend
go test ./internal/system/frontenderrors ./internal/system
Files likely touched
apps/backend/internal/system/frontenderrors/handler.goapps/backend/internal/system/frontenderrors/handler_test.goapps/backend/internal/system/frontenderrors/limiter.goapps/backend/internal/system/frontenderrors/limiter_test.goapps/backend/internal/system/system.goapps/backend/internal/system/system_routes_test.go
Dependencies
- Task 01 provides the dual-sink logger and fixed file used by the endpoint.
Parallelism
Parallel-safe with Task 03 after Task 01. The files are disjoint from the launcher implementations and no shared schema or generated contract changes.
Inputs
- Spec: API surface, Permissions, Failure modes, and report Scenarios.
- Plan: Backend / Frontend-error ingestion.
- Existing patterns: System route composition and
system/logshandler tests.
Risks
- Body limiting must occur before JSON decoding.
- Truncation must preserve valid UTF-8 and must not turn client data into a log message or level.
task_idis an untrusted correlation field, not authorization or proof that the reporting user owns a task.- Limiter identity keys come only from authenticated context; task IDs and browser fields never select a bucket.
Output contract
Report the final request shape and limits, files changed, exact test
command/result, blockers or risks, and update this task plus plan.md status
in the same conversation.