Commit Graph
20 Commits
Author SHA1 Message Date
David SantosandPaperclip 3c307ea32d feat(hub): accept and expose paperclip_project_id on error records (BIT-25537)
- 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]>
2026-06-18 02:15:49 +00:00
tiago-nevesandPaperclip 050a380230 fix(admin-ui): proxy /api/error-monitoring/* to Fastify API (BIT-25083)
CI / Test ingest-api (push) Successful in 1m51s
CI / Test api (push) Successful in 1m50s
CI / Lint and typecheck admin-ui (push) Successful in 2m15s
CI / Validate Docker build (push) Successful in 7m29s
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]>
2026-06-14 02:23:41 +00:00
David SantosandCursor 8773f12b25 feat(hub): retire WDMI projects from error reporting (BIT-24704)
CI / Validate Docker build (pull_request) Failing after 12m46s
CI / Lint and typecheck admin-ui (pull_request) Failing after 13m16s
CI / Test api (pull_request) Failing after 13m20s
CI / Test ingest-api (pull_request) Successful in 15m35s
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]>
2026-06-08 14:26:06 +00:00
David Santos 2d93c4a3fc Align web and admin-ui on Next 15.5 + React 19.2 (BIT-2516)
CI / Test ingest-api (push) Has been cancelled
CI / Test api (push) Has been cancelled
CI / Lint and typecheck admin-ui (push) Has been cancelled
CI / Validate Docker build (push) Has been cancelled
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
2026-04-12 19:53:18 +00:00
David Santos 228d97db78 fix(admin-ui): keep dashboard totals from stats summary
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.
2026-04-10 23:25:40 +00:00
David Santos 5fede9ddd9 fix(admin-ui): derive dashboard KPI row from stats summary aggregates
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
2026-04-10 23:00:26 +00:00
David SantosandPaperclip f8c401a990 feat(admin-ui): add POST /api/error-monitoring/php-error bridge (BIT-1541)
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]>
2026-04-08 00:48:43 +00:00
Peter Spark 3b175eec86 fix(admin-ui): proxy ingest API through Next.js rewrites (BIT-750)
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
2026-04-03 10:01:55 +00:00
David Santos de68f68103 feat(admin): operational stats — hourly trends, recurrence, dashboard
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
2026-04-02 11:00:51 +00:00
David Santos 8b0044be82 feat(api): CRM parity mutations and recent-errors filters (BIT-726)
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
2026-04-02 10:50:06 +00:00
David Santos e0af92eda1 fix(admin-ui): allow public recent-errors API path without login redirect
Keep /api/error-monitoring/recent-errors reachable for Paperclip error loop (including path variants) so central hub returns JSON instead of 307 /login.
2026-04-02 08:50:21 +00:00
David Santos bc8bd8707f feat(api): expose CRM-shaped GET /api/error-monitoring/recent-errors on Fastify
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
2026-04-01 16:28:43 +00:00
David Santos 6811dba303 Expose recent-errors for Paperclip via api_key (BIT-684)
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
2026-04-01 14:18:00 +00:00
1sonhador c899cef6e1 fix(admin-ui): SSR sees ERROR_REPORTING_ADMIN_API_BASE at runtime
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.
2026-03-29 21:20:19 +01:00
1sonhador a3b65b4b3f chore(admin-ui): generic login copy; trim infra hints in comments and .env.example 2026-03-29 18:35:53 +01:00
1sonhador 83308b465b fix(admin-ui): middleware login gate; add admin API systemd unit
- 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).
2026-03-29 18:32:05 +01:00
1sonhadorandPaperclip e17acc983c fix(admin-ui): require session for dashboard in production (BIT-403)
- 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]>
2026-03-23 23:00:20 +00:00
1sonhadorandPaperclip 4a32bb3b0c fix(admin-ui): force-dynamic routes so DEMO/API env is not CDN-cached stale
Co-Authored-By: Paperclip <[email protected]>
2026-03-23 21:13:46 +00:00
1sonhadorandPaperclip 563f644861 compose: add admin-ui service on port 3040 (Next standalone)
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]>
2026-03-23 19:50:30 +00:00
1sonhadorandPaperclip b0b733d5e1 feat(BIT-247): consolidate error reporting repo from OTT
Merge ingest-api, collector-worker, admin-ui, database/error_reporting, deploy/lxc,
docker-compose, and deployment docs into the dedicated repository. Paths updated
for repo root (ER_REPO_ROOT, systemd WorkingDirectory). Root README documents layout.

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 18:20:27 +00:00