Production CT225 has uncommitted changes not in master:
- recentErrors.ts: add slimContext() to trim large context_data blobs
and expose context_data in the recent-errors response
- admin-ui resolve-by-pattern/route.ts: new endpoint
- admin-ui resolve-fixed-patterns/route.ts: new endpoint
This commit preserves the drift so it can be PR-reviewed and merged
over 7bc04e8 (PR20).
Paperclip-Issue: BIT-33338
- php-error bridge: accept paperclip_project_id / paperclipProjectId in
CrmPhpPayload and promote into event context alongside project_slug/gitea_repo
- recent-errors: extract paperclip_project_id from context_json and emit as
top-level field so error loop can route issues to the correct project board
column without falling back to PAPERCLIP_ERROR_LOOP_PROJECT_ID_BY_SLUG
- Add tests for include/omit behaviour (mirrors gitea_repo coverage)
- Update ERROR_MONITORING_PUBLIC_API.md to document both optional fields
No DB migration required: field is stored in existing context_json column.
Co-Authored-By: Paperclip <[email protected]>
Next.js catches /api/* before Fastify, causing 404 on resolve-fixed-patterns.
Add rewrite so external callers (error-loop via CRM_RESOLVE_API_URL) reach
the hub Fastify API on port 3200 via the canonical errors.bitreport.pt URL.
Paperclip-Issue: BIT-25083
Co-Authored-By: Paperclip <[email protected]>
Block ingest for retired WDMI slugs, purge project data via migration,
remove WDMI runbooks, and add offboard-project helper for future retirements.
Co-authored-by: Cursor <[email protected]>
Pin matching versions in web/ and admin-ui/, document the decision and
Node requirement in README, and ignore TypeScript build info artefacts.
Made-with: Cursor
Fetch stats summary first and tolerate trend/recurrence failures with Promise.allSettled so KPI totals no longer fall back to the 500-row incidents list cap.
Top KPI cards used the paginated incidents list, so totals stuck near the API list cap. When operational stats load, sum byProject rollups from GET /v1/stats/summary instead.
Paperclip-Issue: BIT-2202
Paperclip-Run: 4c8f9b0e-4283-4fd7-9c20-f032f14f3719
Translates CRM-shaped ErrorMonitoringReporter payloads (project_slug,
gitea_repo at top level) to ingest-api /v1/ingest/events format. Both
routing fields are promoted into the event context so they are persisted
in context_json and surfaced by GET /api/error-monitoring/recent-errors,
unblocking ERRSIG routing validation for CasamentoWeb.
Auth: X-Error-Monitoring-Key is forwarded as Bearer to the ingest-api;
the key must be registered in er_ingest_keys for the target project.
Paperclip-Issue: BIT-1541
Co-Authored-By: Paperclip <[email protected]>
The single-domain deployment (errors.bitreport.pt) routed all traffic
through the admin-ui, whose auth middleware redirected /v1/ingest/events
and /health to /login — making the ingest API unreachable from outside.
- middleware.ts: pass through /v1/* and /health without auth redirect
- next.config.ts: rewrite /v1/* and /health to ingest-api backend
(INGEST_API_URL env, default http://127.0.0.1:3041)
- docker-compose.yml: set INGEST_API_URL=http://ingest-api:3041
- env examples: document INGEST_API_URL
- scripts/onboard-project.sh: generate project + ingest key SQL
Paperclip-Agent: peter-spark
Paperclip-Issue: BIT-750
Paperclip-Run: dc5b7949-b24d-4867-a2cd-cf4f47477ef8
Extend GET /v1/stats/trend with granularity=hour (UTC buckets) and granularity=day
response envelope. Enrich GET /v1/stats/summary per-project totals and critical
counts. Add GET /v1/stats/recurrence for top incidents by occurrence volume in
a sliding window. Add index on er_incident_occurrences(occurred_at) for range
queries. Wire admin dashboard to summary, 24h/14d trends, and recurrence table.
Document contract in docs/ADMIN_STATS_API.md.
Paperclip-Agent: Pedro Alves (urlKey pedro-alves; id d706f4e6-5d05-4cec-b6e8-f8fb1f203aae)
Paperclip-Issue: BIT-728
Paperclip-Run: 948904bb-20d7-4d29-9cd7-4c22544f7570
Made-with: Cursor
Add POST /api/error-monitoring/resolve, bulk-resolve, and purge-resolved with
resolve key or admin JWT (errors:triage / errors:delete). Extend GET
recent-errors with status, severity, project_slug, q, offset, and stable
ordering. Document contracts in api/docs/ERROR_MONITORING_PUBLIC_API.md;
add vitest for public auth helpers. Proxy new routes and widen admin-ui
middleware for /api/error-monitoring/*.
Paperclip-Issue: BIT-726
Paperclip-Run: 3fbf92be-736e-4b11-8e90-cf993d8cd5ca
Paperclip-Agent: Pedro Alves (id d706f4e6-5d05-4cec-b6e8-f8fb1f203aae)
Made-with: Cursor
Keep /api/error-monitoring/recent-errors reachable for Paperclip error loop (including path variants) so central hub returns JSON instead of 307 /login.
Register the same handler as /v1/paperclip/recent-errors so NPM and direct
API probes (e.g. :3200) match Paperclip default PAPERCLIP_ERROR_API_QUERY.
Admin UI proxy now calls the Fastify path for a single contract end-to-end.
Paperclip-Agent: David Santos (urlKey david-santos; id 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376)
Paperclip-Issue: BIT-702
Paperclip-Run: 4ba525c4-3929-475c-a845-400c49eda817
Made-with: Cursor
Add Fastify GET /v1/paperclip/recent-errors returning CRM-compatible JSON (data
envelope, project_slug per row, status open for open/investigating incidents).
Admin UI proxies the public path /api/error-monitoring/recent-errors to the API
base; middleware bypasses the session redirect for that path only.
Auth matches CRM env names: ERROR_RESOLVE_API_KEY or ERROR_REPORTING_API_KEY for
?api_key=, DEBUG_VIEW_ERRORS_KEY for ?view_errors=.
Paperclip-Agent: David Santos (urlKey david-santos; id 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376)
Paperclip-Issue: BIT-684
Paperclip-Run: cf7cb964-6953-4476-af09-3feb5d10da17
Made-with: Cursor
Next build inlines bare process.env.* as undefined without .env at build time.
Use Reflect.get for admin API base and demo flag; add .env.production default for LXC.
- Middleware: require development+demo or SKIP_LOGIN for unauthenticated access.
- Document SKIP_LOGIN and stricter demo in .env.example.
- Ship bitreport-error-reporting-api.service (PORT via ExecStart env; shared env has PORT for ingest).
- Add middleware redirecting unauthenticated users to /login unless dev+demo
- Disable demo incident data when NODE_ENV=production
- Forward __Host-access cookie on SSR fetches to admin API
- Document NPM /admin/ proxy to Fastify api (§14.2.2)
Co-Authored-By: Paperclip <[email protected]>
Expose Velzon admin dashboard in docker-compose with ERROR_REPORTING_UI_DEMO=1
by default until admin API serves /v1/incidents. Document env vars in .env.example.
Co-Authored-By: Paperclip <[email protected]>