Commit Graph
131 Commits
Author SHA1 Message Date
Peter Spark 5307fcddee docs: document BIT-887 ERRSIG 90a47beec0d7 in CRM due_time runbook
Extend RUNBOOK_REPORTER_CRM_TASKS_DUE_TIME with the recurrence linked to
BIT-887 (same empty-string TIME bind as BIT-885), er-cli query, and §5.2.

Paperclip-Issue: BIT-887
Made-with: Cursor
2026-04-05 02:06:28 +00:00
Peter Spark 76d436e57a docs(wdmi): document ERRSIG 7c4f662f5151 classic op_4 feed upload (BIT-886)
- Extend RUNBOOK_REPORTER_WDMI_FEED_UPLOAD with §5.6 and er-cli queries
- Cross-link BIT-883 (tier feed_op_4) vs BIT-886 (classic _upload_feed_via_api)

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-886
Paperclip-Run: 12016482-5ebb-48ab-883b-d0c6159a9960
Made-with: Cursor
2026-04-05 02:05:06 +00:00
Peter Spark 91b9a9da1f docs: runbook for CRM crm_tasks.due_time empty string (BIT-885)
Add RUNBOOK_REPORTER_CRM_TASKS_DUE_TIME.md for ERRSIG:3be5c05002bd:
MySQL rejects '' for TIME columns; normalize to NULL in CRM before bind.
Link from RUNBOOK_TRIAGE related docs.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-885
Paperclip-Run: 6b1f0af9-ac3e-4eb8-9a53-cc22e64f15c4
Made-with: Cursor
2026-04-05 02:03:45 +00:00
Peter Spark 1f21128745 docs(wdmi): document ERRSIG 3a9267fb1478 (BIT-884) in feed upload runbook
- Index BIT-884 in runbook intro and hub CLI §5 queries
- Add §5.4 case (feed_id op_2, classic upload path) alongside BIT-882

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-884
Paperclip-Run: d2064b65-2953-4f13-b572-87b7f351402d
Made-with: Cursor
2026-04-05 02:01:51 +00:00
Peter Spark e42df98416 docs(runbook): document BIT-883 feed_op tier upload signature
Add §5.4 and intro cross-ref for ERRSIG:1a8be255a9c2 (upload_feed_tier / feed_op_*).

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-883
Paperclip-Run: 50b3378e-3cea-4d33-9820-1db1e765b381
Made-with: Cursor
2026-04-05 02:00:21 +00:00
Peter Spark cdf1d44bb4 docs: document BIT-863 ERRSIG 9b4561a43025 (Sheets Portes / supplier fees)
Add hub runbook section 5.2 for cURL 35 on sheets.googleapis.com from
_maintenance_sync_product_supplier_fees.php, cross-link BIT-862, and note
recurrence as deploy or persistent network/TLS.

Paperclip-Agent: david-santos
Paperclip-Issue: BIT-863
Paperclip-Run: b924d445-99ed-429c-b1a2-950c0978781a
2026-04-05 01:58:57 +00:00
Peter Spark 2f81db5573 docs(wdmi): document BIT-882 ERRSIG 0981a9d165e5 in feed upload runbook
Add §5.3 for the classic feed upload fingerprint seen on wdmi-store recurrence
loops; clarify parity with BIT-875 triage and er-cli queries.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-882
Paperclip-Run: a95c759f-916c-4ba8-9327-e61c552394c2
Made-with: Cursor
2026-04-05 01:57:46 +00:00
Peter Spark 674d11c5c4 docs: extend Google reporter runbook for DNS / CURLE 6 (BIT-880)
- Document CURLE_COULDNT_RESOLVE_HOST (oauth2.googleapis.com) vs TLS 35
- Add DNS reproduction commands and checklist ordering (classify errno first)
- Add ERRSIG:c67961dfa92a and stack via _maintenance_sync_product_supplier_fees.php
- Update RUNBOOK_TRIAGE cross-reference for cURL 6

Paperclip-Issue: BIT-880
Paperclip-Run-Id: a53625bf-b8e7-49f2-bb9a-0b121d5aca61
Made-with: Cursor
2026-04-05 01:54:13 +00:00
Peter Spark 016511b15f docs: extend CRM Logger mkdir runbook for BIT-879 / ERRSIG aa30e641f164
Document recurrence alongside BIT-878: same stack and root cause (CRM host
permissions / log path), distinct hub fingerprint. Add er-cli query for the
new signature and a small table in §5.1.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-879
Paperclip-Task: 2134c338-de72-41d1-8aad-9e287910b69c
Paperclip-Run: 18910b59-5b0b-4cc0-8e1e-d80c27a6f798
Made-with: Cursor
2026-04-05 01:52:46 +00:00
Peter Spark a467b28e38 docs: runbook for CRM Logger mkdir permission denied (BIT-878)
Add RUNBOOK_REPORTER_CRM_LOGGER_MKDIR.md for ERRSIG:76ad405bed13:
triage on host (Logger path, PHP user, permissions), infra and code
mitigations, and er-cli queries. Link from RUNBOOK_TRIAGE.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-878
Paperclip-Run: f47e59b9-c7a3-49e6-96b0-b2ad7bac70fd
Made-with: Cursor
2026-04-05 01:51:40 +00:00
Peter Spark 0adaea93cd docs: triage runbook for wdmi feed tier upload (BIT-876)
Document upload_feed_tier / Feed tier upload failed alongside legacy _upload_feed_via_api.
Clarify that incident "ingest host" metadata is the error hub, not the feed upload URL.
Add §1.1 when the configured target is errors.bitreport.pt (JSON ingest only).
Cross-link from RUNBOOK_TRIAGE.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-876
Paperclip-Run: ada7140f-8269-4098-98b1-1e642014766b
Made-with: Cursor
2026-04-05 01:50:14 +00:00
Peter Spark 80366ae870 docs: runbook for wdmi-store feed upload API failures (BIT-875)
Add RUNBOOK_REPORTER_WDMI_FEED_UPLOAD.md for ERRSIG:51107371e21a and
_upload_feed_via_api / clients.wdmi.pt triage. Cross-link from triage
and Flexit runbooks.

Paperclip-Task: 3eeb15eb-2f4c-40f9-b5b6-f3c13eef1393
Paperclip-Run: 169957f9-f53f-4420-8f8e-e7408319e358
Made-with: Cursor
2026-04-05 01:48:40 +00:00
Peter Spark 550a5cdd3f docs: runbook for CRM View @errormonitoring/dashboard (BIT-873)
Add RUNBOOK_REPORTER_CRM_ERRORMONITORING_VIEW.md for ERRSIG:f51049a03fba
(View.php missing module view on crm.pmx.bet). Cross-link from RUNBOOK_TRIAGE
and RUNBOOK_OPERATIONS.

Paperclip-Issue: BIT-873
Paperclip-Run: 4e3500e4-fdbf-4386-b3f1-bd001356b769
Paperclip-Agent: david-santos
Made-with: Cursor
2026-04-05 01:46:05 +00:00
Peter Spark 4f4a66b925 docs: document BIT-903 Flexit ERRSIG 5278058355a5 in wdmi runbook
- Add hub query example and §5.2 case (malformed/truncated XML pattern)
- Cross-link Paperclip [BIT-903](/BIT/issues/BIT-903)

Paperclip-Agent: jos-alves
Paperclip-Issue: BIT-903
Paperclip-Run: e12cefbe-7e98-4c17-b9f9-30328af3fbcf
Made-with: Cursor
2026-04-05 01:45:33 +00:00
Peter Spark bafe573cbc docs: runbook for wdmi-store Flexit simplexml_load_file (BIT-877)
Add RUNBOOK_REPORTER_WDMI_FLEXIT_XML.md with triage for ERRSIG:6f82e20ec332
(_flexit.php / __maintenance_build.php). Link from RUNBOOK_TRIAGE.

Paperclip-Issue: BIT-877
Paperclip-Run: 2cc00999-26eb-466e-8a13-0bb214a07349
Paperclip-Agent: jos-alves
Made-with: Cursor
2026-04-05 01:43:25 +00:00
Peter Spark 249b839de8 docs: extend Google TLS runbook for Sheets API (BIT-867)
Document ERRSIG:d7787d22e1a5 and sheets.googleapis.com:443 failures
distinct from oauth2 token path; add curl/openssl checks, er-cli
queries, and wdmi-store maintenance sync playbook.

Verification: npm test -- --run in ingest-api (26 passed, 6 skipped).

Paperclip-Board-Issue: BIT-867
Paperclip-Run-Id: b1095be5-1d7f-4502-a0c4-44e298924ced
Made-with: Cursor
2026-04-05 01:42:34 +00:00
Peter Spark 4a3ecc1088 docs: add runbook for Google OAuth TLS failures on PHP reporters
New RUNBOOK_REPORTER_GOOGLE_TLS.md documents triage for cURL error 35 /
SSL_connect reset to oauth2.googleapis.com from Guzzle/Google client stacks
(e.g. wdmi-store Importer). Cross-linked from RUNBOOK_TRIAGE and
RUNBOOK_OPERATIONS.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-866
Paperclip-Run: acd11e33-7d18-468f-a2c1-2e15647f2fd4
Made-with: Cursor
2026-04-05 01:40:51 +00:00
Peter Spark 8767e40bb6 docs(ops): hub parity tooling — HTTP contracts, runbooks, Prometheus
Add canonical HTTP_CONTRACTS with curl for hub + ingest endpoints, operator
runbooks for ingest debugging and five common hub flows, and Grafana/Prometheus
scraping notes. Extend ERROR_MONITORING_PUBLIC_API with stats + curl examples;
align purge and resolve-by-pattern docs with the Fastify implementation.
Add optional smoke scripts under scripts/examples/.

Paperclip-Agent: 5d084b36-f38f-42a5-a92a-520005afda4f
Paperclip-Issue: BIT-736
Paperclip-Run: ad2c5129-df54-44aa-afd4-6f9f7486c1a1
Made-with: Cursor
2026-04-02 20:36:57 +00:00
Peter Spark f5f62571fd feat(ingest-api): ingestion hardening — fingerprints, per-key rate limits (BIT-735)
- Migration: er_ingest_keys.rate_limit_max and rate_limit_window_ms (nullable overrides).
- Fingerprint policy v2: server-side digest includes normalized stacktrace (UUID/hex/line noise).
- In-memory fixed-window limits: per API key after auth; per-IP for unauthenticated POSTs
  (INGEST_ANON_IP_*). Removed @fastify/rate-limit dependency.
- OpenAPI documents 429; runbook at docs/operations/ingest-hardening-runbook.md.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-735
Paperclip-Run: 0a91be22-6f8f-4c60-b889-44b99048d3a2
Made-with: Cursor
2026-04-02 19:45:27 +00:00
Peter Spark c6e4305c79 feat(observability): stats endpoint, Prometheus metrics, SLO tracking, Grafana dashboard (BIT-734)
- GET /api/error-monitoring/stats: 24h ingestion volume, severity
  distribution, per-project metrics with resolution rates, hourly trend
- Prometheus /metrics on both api (port 3200) and ingest-api (port 3041)
  with HTTP request duration histograms, ingest SLO latency (p50/p95/p99),
  event throughput counters, domain gauges
- Grafana dashboard JSON (deploy/grafana/) with SLO panels, error volume,
  severity/state distribution, per-project charts, Node.js process metrics
- SLO runbook (docs/RUNBOOK_SLO.md): alert rules, scrape config,
  triage procedures for latency, error rate, and availability breaches

Paperclip-Agent: Peter Spark (urlKey peter-spark; id 49ce66f8-6be6-4644-afd3-eb6d8d0d4b3e)
Paperclip-Issue: BIT-734
Paperclip-Run: f45bcdc4-4757-4829-8e75-b60a8f9a7be4
2026-04-02 18:26:24 +00:00
David Santos 5c97326d11 feat(ops): tooling CLI + runbook canónico de triagem
- scripts/er-cli.sh: CLI operacional sem UI com comandos list-open,
  export, resolve, resolve-by-pattern e purge; idempotente, dry-run
  em resolve-by-pattern e purge, autenticação via ERROR_RESOLVE_API_KEY
- docs/RUNBOOK_TRIAGE.md: runbook completo de triagem, resolução, deploy
  e fecho com checklist de validação pós-deploy e tabela de escalada

Paperclip-Issue: BIT-730
Paperclip-Run: f06292f3-5ab7-4715-9b61-6dee07a47ad7
2026-04-02 18:03:23 +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 7b2be679cd feat(api): harden error-monitoring mutations (audit, rate limit, 403)
Document the public CRM-shaped API matrix, emit audit rows for resolve,
bulk-resolve, and purge (including dry run), apply a dedicated per-IP
rate limit on mutation routes, and return 403 when a valid session lacks
RBAC for the action. Add Vitest coverage for authorizeMutation.

Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-731
Paperclip-Run: 7d0edfac-5676-41fa-85c2-86d01a808894
Made-with: Cursor
2026-04-02 10:52:40 +00:00
1sonhador c02c300dc3 feat(deploy): version.json generation, webhook promote, verify (BIT-468)
Align LXC deploy with BIT-465: write-version-json.sh, optional
webhook-deploy.sh, verify.sh fails when ER_VERSION_JSON_PATH is set but
missing/invalid, env.example + nginx sketch + runbook updates.
Ignore deploy/lxc/runtime/ (generated on server).
2026-03-24 18:33:37 +00: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 e3a7efc1a3 docs(NPM): domain without :3040 needs no path rewrite; forward + headers
Co-Authored-By: Paperclip <[email protected]>
2026-03-23 21:26:10 +00:00
1sonhadorandPaperclip ff11f79acb docs(compose): admin-ui port 3040 verify + troubleshooting when host not redeployed
Co-Authored-By: Paperclip <[email protected]>
2026-03-23 20:56:50 +00:00
1sonhadorandPaperclip 09eef93b34 docs(deployment): add public NPM/DNS/Cloudflare runbook for LXC (BIT-277)
Document Nginx Proxy Manager (CT 102), DNS for errors.bitreport.pt and
ingest.errors.bitreport.pt, Cloudflare 525 troubleshooting, and external
verification curls alongside existing verify.sh checks.

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 23:33:56 +00:00
1sonhadorandPaperclip 4604606033 feat(errors): migrate error-reporting stack from PostgreSQL to MariaDB (BIT-255)
Replace Postgres with MariaDB 11 in docker-compose; convert all
database/error_reporting and db/migrations SQL to InnoDB-friendly syntax
(DATETIME(6), AUTO_INCREMENT, ON DUPLICATE KEY). Run admin portal DDL in the
same migrate one-shot as error_reporting.

Switch ingest-api, collector-worker, and api from pg to mysql2 (pools,
parameterized queries, transactions). Align ingest writes with
er_incident_occurrences and include project_id on idempotency inserts.

Add scripts/run-mysql-migrations.sh for host-side applies; update LXC
run-migrate/verify, deployment docs, and .env.example (mysql://, ER_MYSQL_*).

Verified: npm run build + npm test in ingest-api and collector-worker;
npm run build in api. Full docker compose not run here (no local daemon).

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 19:29:11 +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
1sonhadorandPaperclip eeb5039a3c feat(BIT-183): admin auth, RBAC, audit logging, rate limiting
Implements BIT-154.7 — Auth administrativa, RBAC e quotas:

- api/src/types/auth.ts: 3 roles (superadmin/admin/viewer), 18 permissions,
  ROLE_PERMISSIONS map as single source of truth
- api/src/plugins/auth.ts: JWT via HTTP-only __Host- cookies (15min access /
  7d refresh), token rotation, timing-safe login
- api/src/plugins/rbac.ts: requirePermission() + requireRole() Fastify
  decorators for route-level enforcement
- api/src/plugins/audit.ts: auditLog() helper + Fastify plugin; writes to
  audit_logs table; failure never aborts main operation
- api/src/plugins/rate-limit.ts: per-route limits (login: 10/5min IP,
  ingest: 1000/min token, global: 500/min) + payload size enforcement
- api/src/routes/admin/auth.ts: POST login, POST refresh, POST logout,
  GET /me — with audit events on all operations
- db/migrations/001–004: admin_users, refresh_tokens, audit_logs tables +
  dev seed (bcrypt superadmin)
- web/src/app/(admin)/login: Velzon Bootstrap 5 login page (Next.js client
  component, credentials:include, HTTP-only cookie flow)
- docs/permission-matrix.md: full permission matrix + audit event catalogue
  + rate/payload limit table (BIT-183 acceptance criterion)

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 04:22:57 +00:00