Commit Graph
313 Commits
Author SHA1 Message Date
spark dc1aa3365e Merge branch 'master' into chore/codeowners-fix
CI / Test ingest-api (pull_request) Successful in 36s
CI / Test api (pull_request) Successful in 36s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m3s
CI / Validate Docker build (pull_request) Successful in 3m2s
2026-10-22 01:16:24 +01:00
spark d987d2aaf4 Merge pull request 'fix(hub): BIT-31442 route /v1/paperclip alias to admin API + accept X-Api-Key header' (#17) from fix/BIT-31442-recent-errors-alias-proxy-and-xapikey into master
CI / Test ingest-api (push) Successful in 25s
CI / Test api (push) Successful in 29s
CI / Lint and typecheck admin-ui (push) Successful in 59s
CI / Validate Docker build (push) Successful in 4m24s
2026-10-21 20:40:24 +01:00
David Santos d4059d801a fix(hub): BIT-31442 route /v1/paperclip alias to admin API + accept X-Api-Key header
CI / Test ingest-api (pull_request) Successful in 41s
CI / Test api (pull_request) Successful in 44s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m24s
CI / Validate Docker build (pull_request) Successful in 6m2s
The recent-errors handler (api/src/routes/public/recentErrors.ts) registers
both GET /api/error-monitoring/recent-errors and the alias
GET /v1/paperclip/recent-errors on the admin API (port 3200). However the
admin-ui Next.js rewrite sent all /v1/* to ingest-api (port 3041), which has
no such route, so the alias returned 404 in production while the
/api/error-monitoring path worked (401 without a key).

Changes:
- admin-ui/next.config.ts: add a specific /v1/paperclip/:path* -> admin API
  rewrite before the generic /v1/:path* -> ingest-api rule (rewrite order
  matters; first match wins).
- api/src/lib/errorMonitoringAuth.ts: authorizeReadQuery now also accepts an
  X-Api-Key header carrying either ERROR_RESOLVE_API_KEY/ERROR_REPORTING_API_KEY
  or DEBUG_VIEW_ERRORS_KEY, so programmatic callers avoid leaking keys in
  URLs/access logs. Backward compatible with the existing query params.
- api/src/routes/public/recentErrors.test.ts: cover the alias path and the
  X-Api-Key header (resolve key, view key, invalid key).
- docs/HTTP_CONTRACTS.md, docs/permission-matrix.md: document the header and
  the proxy ordering requirement.
2026-10-21 18:16:05 +01:00
1sonhador 9e318b5b9a chore: corrige CODEOWNERS para contas existentes no Gitea
CI / Test ingest-api (pull_request) Successful in 2m12s
CI / Test api (pull_request) Successful in 2m2s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m37s
CI / Validate Docker build (pull_request) Successful in 4m59s
2026-10-21 17:33:02 +01:00
spark 954b0ced2e Merge pull request 'chore(hub): BIT-30701 add per-slug freshness override + exclude synthetic smoke-test events from fleet audit' (#15) from chore/BIT-30701-fleet-audit-per-slug-threshold-and-synthetic-filter into master
CI / Test ingest-api (push) Successful in 1m2s
CI / Test api (push) Successful in 1m11s
CI / Lint and typecheck admin-ui (push) Successful in 2m6s
CI / Validate Docker build (push) Successful in 5m11s
2026-09-28 08:22:42 +01:00
David Santos 9dd88db4ae chore(hub): BIT-30701 add per-slug freshness override + exclude synthetic smoke-test events from fleet audit
CI / Test ingest-api (pull_request) Successful in 55s
CI / Test api (pull_request) Successful in 1m1s
CI / Lint and typecheck admin-ui (pull_request) Successful in 2m9s
CI / Validate Docker build (pull_request) Successful in 5m55s
netvision's real error rate dropped sharply after the 2026-08-25..08-29 bug-fix
wave; at the global 168h threshold the weekly audit fired 3 weeks running for a
now-quiet app, not a broken pipe (BIT-30273/BIT-30527). Each investigation sent
a synthetic verification event to confirm the reporter still works, but those
events were then counted as "fresh" traffic by the next week's run, masking
the real last-event date until the synthetic row itself aged past the
threshold.

Add PAPERCLIP_FLEET_AUDIT_MAX_AGE_HOURS_OVERRIDES (CSV slug=hours) so a slug's
threshold can differ from the global default, and exclude events matching the
"[BIT-xxxxx] <actor> ... smoke test" marker convention from freshness scoring
so future liveness checks no longer pollute the metric.
2026-09-28 08:22:16 +01:00
spark 52e75a8760 Merge pull request 'chore(hub): BIT-30044 restore multi-status filter in fleet audit script' (#14) from chore/BIT-30044-restore-multistatus-audit-filter into master
CI / Test ingest-api (push) Successful in 1m28s
CI / Test api (push) Successful in 1m30s
CI / Lint and typecheck admin-ui (push) Successful in 2m42s
CI / Validate Docker build (push) Successful in 6m25s
2026-09-07 09:40:05 +01:00
David Santos b190d6fa1b chore(hub): BIT-30044 restore multi-status filter in fleet audit script
CI / Test ingest-api (pull_request) Successful in 54s
CI / Test api (pull_request) Successful in 1m6s
CI / Lint and typecheck admin-ui (pull_request) Successful in 2m37s
CI / Validate Docker build (pull_request) Successful in 6m56s
Revert the BIT-25722 workaround now that BIT-30040 fixed the recent-errors
mega-incident query hang (verified <1s in prod with status=open,investigating,resolved,ignored&limit=2000).
2026-09-07 09:39:28 +01:00
spark 3da9e47873 Merge pull request 'fix(hub): BIT-30040 stop ROW_NUMBER from materializing mega-incident partitions' (#13) from fix/BIT-30040-recent-errors-mega-incident-fastpath into master
CI / Test ingest-api (push) Successful in 1m26s
CI / Test api (push) Successful in 1m41s
CI / Lint and typecheck admin-ui (push) Successful in 3m28s
CI / Validate Docker build (push) Successful in 7m8s
2026-09-07 09:12:28 +01:00
David Santos a1fd3d2db0 fix(hub): BIT-30040 stop ROW_NUMBER from materializing mega-incident partitions
CI / Test ingest-api (pull_request) Successful in 1m9s
CI / Test api (pull_request) Successful in 1m22s
CI / Lint and typecheck admin-ui (pull_request) Successful in 2m30s
CI / Validate Docker build (pull_request) Successful in 8m52s
BIT-29730's incident-first fast path still ran ROW_NUMBER() OVER
(PARTITION BY incident_id ...) across ALL occurrences of every
selected incident before filtering rn = 1. MariaDB can't turn a
PARTITION BY window function into a loose index scan, so it
materializes and sorts each partition in full. At fleet-audit scale
(status=open,investigating,resolved,ignored&limit=2000) several
"mega-incidents" with 48k-148k occurrences each landed in the
selected page, and sorting those partitions hung the query for 70s+.

Replace the ROW_NUMBER CTE with a `LIMIT 1` correlated subquery per
selected incident. EXPLAIN confirms this walks
er_incident_occurrences_incident_time_idx (incident_id, occurred_at
DESC) and stops at the first row per incident instead of scanning the
rest of its history.

Verified against MariaDB (docker compose) seeded with the production
shape from the bug report (3235 resolved / 20 open incidents, 5
mega-incidents at 48k-148k occurrences each, ~425k occurrence rows
total): status=open,investigating,resolved,ignored&limit=2000 dropped
from 2.1s to 0.44s with identical result rows, and
status=resolved&limit=10 stayed at ~0.3s untouched by the
mega-incidents.
2026-09-07 09:05:52 +01:00
spark 7f76c5287d Merge pull request 'fix(hub): BIT-29730 stop timeout on GET recent-errors?status=resolved' (#12) from fix/BIT-29730-recent-errors-resolved-timeout into master
CI / Test ingest-api (push) Successful in 49s
CI / Test api (push) Successful in 50s
CI / Lint and typecheck admin-ui (push) Successful in 1m29s
CI / Validate Docker build (push) Successful in 4m27s
2026-08-24 09:02:38 +01:00
David Santos 7987aa94ae fix(hub): BIT-29730 stop timeout on GET recent-errors?status=resolved
CI / Test ingest-api (pull_request) Successful in 1m13s
CI / Test api (pull_request) Successful in 1m12s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m45s
CI / Validate Docker build (pull_request) Successful in 5m11s
recent-errors built its result by ranking ALL occurrences of every
matching incident with ROW_NUMBER() before applying LIMIT, so
status=resolved (the majority, longest-lived incident state) forced a
scan of the full historical occurrence log just to return one page.
admin/incidents.ts already filters/orders er_incidents directly for
this reason; apply the same pattern here: page through er_incidents
first (small, indexed by current_state), then rank occurrences only
for that page. The q= search path is kept on the old occurrence-first
query since it needs to match occurrence content across an incident's
full history.

Adds er_incidents_state_seen_idx (current_state, last_seen_at) so the
new incident-first path stays indexed even without a project_slug
filter, and backfills the docker/local migration runners that had
drifted behind deploy/lxc/run-migrate.sh (missing three prior
migrations), since the new migration needs to run through them too.

Verified locally against MariaDB (docker compose) with 3k resolved /
20 open incidents and ~90k synthetic occurrences: the reported repro
curls now return HTTP 200 in <100ms (previously reproduced as a hang
via manual EXPLAIN/timing of the old query, ~2s at this seed size and
scaling with total occurrence history).
2026-08-24 08:32:26 +01:00
David Santos 308ff624cf fix(noise): remove stale_bundle_* rules — functions no longer exist (BIT-26793)
CI / Test ingest-api (push) Successful in 54s
CI / Test api (push) Successful in 58s
CI / Lint and typecheck admin-ui (push) Successful in 1m29s
CI / Validate Docker build (push) Successful in 5m0s
switchSelectionEditorTab and descriptionEditorReady are absent from the
current codebase; continuing to suppress ReferenceErrors for these names
would silently hide real errors if the names were ever reused. Ruleset
bumped to 1.0.7.
2026-07-17 23:02:36 +00:00
David Santos 23704d2e59 feat(ingest): label er_ingest_events_total skipped_noise by rule_id
CI / Test api (push) Successful in 54s
CI / Test ingest-api (push) Successful in 57s
CI / Lint and typecheck admin-ui (push) Successful in 1m48s
CI / Validate Docker build (push) Successful in 5m19s
Break down noise filter counters per noise policy rule for Prometheus observability.

Paperclip-Agent: David Santos (urlKey david-santos; id 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376)
Paperclip-Issue: BIT-26791
Paperclip-Run: cea24469-2886-457d-9f6f-09d83aaf9e4a
2026-07-17 23:01:35 +00:00
David Santos caeb37ff0a feat(hub): time-limited fixed patterns — expire after N days (BIT-26790)
CI / Test ingest-api (push) Successful in 48s
CI / Test api (push) Successful in 47s
CI / Lint and typecheck admin-ui (push) Successful in 1m20s
CI / Validate Docker build (push) Successful in 4m29s
Add optional addedAt + expiresAfterDays to FixedPattern so each pattern
has a TTL. The resolve-fixed-patterns handler now skips expired patterns,
letting persistent errors resurface and forcing a real code fix instead
of indefinite suppression.

- Transient infra patterns (WSREP, Google API, session write) carry addedAt
  for audit but no expiry — they are permanent noise with no code fix.
- fix-duplicate-logo.js expires 14 days after 2026-07-17; if still firing
  after that the deploy or client filter is broken and needs attention.
- Response includes expired_pattern_count and per-pattern expired/expires_at.
2026-07-17 22:42:56 +00:00
David Santos 37ab9f1ccb fix(hub): BIT-25223 add fix-duplicate-logo.js resolve pattern + auto-apply on deploy
CI / Test api (push) Successful in 1m8s
CI / Test ingest-api (push) Successful in 1m9s
CI / Lint and typecheck admin-ui (push) Successful in 1m30s
CI / Validate Docker build (push) Successful in 5m22s
- resolveFixedPatterns.ts: add '%fix-duplicate-logo.js%' entry so any
  Chrome-style CRM JS error that reaches the hub is auto-resolved on deploy
- webhook-deploy.sh: call resolve-fixed-patterns after every service restart
  so code fixes clear stale hub incidents automatically (uses ERROR_RESOLVE_API_KEY
  from /etc/error-reporting/env which is already sourced by the script)

The 5 open incidents for ERRCLUSTER:33b4e527d8fd were bulk-resolved directly
(IDs 747145, 747381, 753209, 753550, 753551). Client-side noise filter (CRM PR #684)
prevents new occurrences.
2026-07-17 22:20:18 +00:00
David Santos 615d771ade fix(tools): drop multi-status filter in fleet audit — hub times out on comma-separated status values
CI / Test ingest-api (push) Failing after 40s
CI / Lint and typecheck admin-ui (push) Failing after 43s
CI / Validate Docker build (push) Failing after 42s
CI / Test api (push) Failing after 10m49s
Paperclip-Task-Id: BIT-25722
2026-06-22 07:22:16 +00:00
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
David SantosandPaperclip be735a16b6 feat(tools): add fleet error reporting audit script (BIT-25194)
CI / Test ingest-api (push) Successful in 2m18s
CI / Test api (push) Successful in 2m24s
CI / Lint and typecheck admin-ui (push) Successful in 3m14s
CI / Validate Docker build (push) Successful in 12m14s
Weekly routine that queries errors.bitreport.pt for each expected slug,
checks freshness against a configurable threshold, and creates Paperclip
correction issues for silent or stale reporters. Reads config from
/etc/paperclip/paperclip-fleet-error-audit.env.

Paperclip-Task-Id: BIT-25194
Co-Authored-By: Paperclip <[email protected]>
2026-06-15 07:21:16 +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
spark bebbfb3e57 Merge pull request 'feat(hub): add resolve-fixed-patterns endpoint for CRM routing parity (BIT-25072)' (#11) from task/BIT-25072-resolve-fixed-patterns into master
CI / Test ingest-api (push) Successful in 2m52s
CI / Test api (push) Successful in 2m53s
CI / Lint and typecheck admin-ui (push) Successful in 3m14s
CI / Validate Docker build (push) Successful in 12m41s
feat(hub): add resolve-fixed-patterns endpoint for CRM routing parity (BIT-25072)
2026-06-14 02:04:22 +01:00
David Santos 7fe045d314 feat(hub): add resolve-fixed-patterns endpoint for CRM routing parity (BIT-25072)
CI / Test ingest-api (pull_request) Successful in 2m12s
CI / Test api (pull_request) Successful in 2m12s
CI / Lint and typecheck admin-ui (pull_request) Successful in 2m51s
CI / Validate Docker build (pull_request) Successful in 15m33s
POST /api/error-monitoring/resolve-fixed-patterns — resolves hub incidents
matching known-fixed/transient patterns from config/resolveFixedPatterns.ts.
Fixes 404 from run-error-loop-with-resolve.sh when CRM_RESOLVE_API_URL points
to the hub (CRM module removed in BIT-24199; hub now owns all error monitoring).

Patterns file is extensible; initial set covers Galera/WSREP transients,
Google API backendError, session_write_close cascades, and storage COMMIT noise.

Paperclip-Issue: BIT-25072
Paperclip-Agent: tiago-neves
2026-06-13 22:36:56 +00:00
spark 1181093739 Merge pull request 'docs(deploy): add .env runtime preservation rule (BIT-25008)' (#10) from task/BIT-25008-env-preservation into master
CI / Test ingest-api (push) Successful in 1m4s
CI / Test api (push) Successful in 2m3s
CI / Lint and typecheck admin-ui (push) Successful in 2m28s
CI / Validate Docker build (push) Successful in 13m22s
2026-06-11 17:31:48 +01:00
David SantosandPaperclip 2b8976551f docs(deploy): add .env runtime preservation rule (BIT-25008)
CI / Test ingest-api (pull_request) Successful in 2m7s
CI / Test api (pull_request) Successful in 2m11s
CI / Lint and typecheck admin-ui (pull_request) Successful in 3m21s
CI / Validate Docker build (pull_request) Successful in 15m49s
Adds .cursor/rules/bitreport-env-preservation.mdc enforcing DEPLOY_STANDARD.md §3.1.

Co-Authored-By: Paperclip <[email protected]>
2026-06-11 16:25:57 +00:00
spark 8bb129ac77 Merge pull request 'docs(deploy): add .env runtime preservation rules (BIT-25005)' (#9) from task/BIT-25008-env-preservation into master
CI / Test ingest-api (push) Successful in 1m29s
CI / Test api (push) Successful in 56s
CI / Lint and typecheck admin-ui (push) Successful in 2m37s
CI / Validate Docker build (push) Successful in 21m52s
docs(deploy): add .env runtime preservation rules (BIT-25005)
2026-06-11 17:13:56 +01:00
David Santos f19ff03dd6 docs(deploy): add .env runtime preservation rules (BIT-25005)
CI / Test ingest-api (pull_request) Successful in 1m35s
CI / Test api (pull_request) Successful in 2m14s
CI / Lint and typecheck admin-ui (pull_request) Successful in 3m1s
CI / Validate Docker build (pull_request) Successful in 24m7s
Propagate DEPLOY_STANDARD.md §3.1: add warning that cp .env.example .env is
only for initial bootstrap, prohibit overwriting existing prod .env, mandate
PRODUCTION_ACCESS_SYNC_LOG entries for ER_MYSQL_* changes.

Paperclip-Task: BIT-25008
2026-06-11 15:37:24 +00:00
spark 47f77e85de Merge pull request 'feat(hub): retire WDMI projects from error reporting (BIT-24704)' (#8) from task/BIT-24704-retire-wdmi into master
CI / Test ingest-api (push) Successful in 14m57s
CI / Test api (push) Successful in 19m18s
CI / Lint and typecheck admin-ui (push) Successful in 20m37s
CI / Validate Docker build (push) Failing after 11m9s
Merge BIT-24704: retire WDMI projects from error reporting

Revokes all WDMI-family ingest keys, deactivates collector sources,
and deletes project rows. ingest-api now returns 401 for retired slugs.

Deploy issue: BIT-24705
2026-06-08 15:44:48 +01: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
1sonhador ea41eb2205 ci: quote Gitea workflow YAML trigger keys as 'on'
CI / Test ingest-api (push) Successful in 30s
CI / Test api (push) Successful in 34s
CI / Lint and typecheck admin-ui (push) Successful in 1m11s
CI / Validate Docker build (push) Successful in 3m59s
CI / Test ingest-api (pull_request) Successful in 25s
CI / Test api (pull_request) Successful in 29s
CI / Lint and typecheck admin-ui (pull_request) Successful in 57s
CI / Validate Docker build (pull_request) Successful in 3m43s
2026-05-01 02:40:17 +01:00
spark 3ae3ac4fd1 Merge pull request 'feat(ingest-api): export error_hub_* Prometheus metrics (BIT-4932 / BIT-4903)' (#6) from task/BIT-4932-error-hub-prometheus-metrics into master
CI / Test ingest-api (push) Successful in 34s
CI / Test api (push) Successful in 39s
CI / Lint and typecheck admin-ui (push) Successful in 1m25s
CI / Validate Docker build (push) Successful in 5m24s
2026-04-21 07:42:41 +01:00
David Santos b7cbf528ee ingest-api: export error_hub_* Prometheus metrics for hub freshness alerts
CI / Test ingest-api (pull_request) Successful in 38s
CI / Test api (pull_request) Successful in 43s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m30s
CI / Validate Docker build (pull_request) Successful in 5m45s
Join er_projects in ingest auth to expose lowercase project slug. Record
error_hub_last_event_timestamp from stored events occurred_at and
error_hub_ingest_failures_total on HTTP 500 batches (BIT-4903 / BIT-4932).

Add integration assertion when ERROR_REPORTING_TEST_DATABASE_URL is set.

Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-4932
Paperclip-Run: 00b93610-8794-4264-81a9-6f4cb39a9d8d
Made-with: Cursor
2026-04-21 05:08:42 +00:00
spark 988b4c57a4 Merge pull request 'chore: add CONTRIBUTING and CODEOWNERS baseline (BIT-3492)' (#5) from task/BIT-3492-tier2-contributing-codeowners into master
CI / Test ingest-api (push) Successful in 25s
CI / Test api (push) Successful in 29s
CI / Lint and typecheck admin-ui (push) Successful in 1m10s
CI / Validate Docker build (push) Successful in 3m39s
2026-04-17 20:44:37 +01:00
David Santos 87e563f9c5 chore: add CONTRIBUTING and CODEOWNERS baseline
CI / Test ingest-api (pull_request) Successful in 27s
CI / Test api (pull_request) Successful in 31s
CI / Lint and typecheck admin-ui (pull_request) Successful in 1m1s
CI / Validate Docker build (pull_request) Successful in 3m46s
Paperclip-Agent: Diana Neves (urlKey diana-neves; id 4427016d-7e8f-46e9-9694-3d062e78cc3a)
Paperclip-Issue: BIT-3492
2026-04-16 16:50:58 +00:00
David Santos 7daa867374 chore(lab): sync working tree from Paperclip execution host (10.10.50.17)
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
2026-04-16 10:24:33 +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 1099cbb724 collector-worker: bound ingest POST with INGEST_PUSH_TIMEOUT_MS (BIT-2600)
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
Add AbortController timeout to pushEventsToIngest (error ingest_push_timeout),
env INGEST_PUSH_TIMEOUT_MS (default 60s, minimum 1s), Vitest coverage, and
compose/env.example documentation.

Made-with: Cursor
2026-04-12 11:51:03 +00:00
David Santos b29f72bef4 feat(api): BIT-2601 rate-limit typing, login preset, and rejection metrics
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
Align hub rate-limit error context with @fastify/rate-limit types, parse RATE_*
and body-size env vars via parsePositiveIntEnv, wire POST /admin/auth/login to
the login preset, increment er_api_rate_limit_rejections_total per bucket, and
document ingest_token_id plus Prometheus scraping notes.

Made-with: Cursor
2026-04-12 11:29:31 +00:00
David Santos 6c22dc8bb9 ingest-api: serialize idempotent ingest to fix SQLSTATE 23000 races
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
Concurrent POSTs with the same Idempotency-Key could pass the initial
SELECT and collide on INSERT into er_ingest_idempotency (unique on
ingest_key_id + idempotency_key), surfacing ER_DUP_ENTRY and risking
duplicate occurrences. Acquire a per-key MySQL named lock before the
idempotency read; on duplicate insert, roll back and replay the stored
response. Document 503 idempotency_busy when GET_LOCK times out.

Adds an integration test for parallel identical idempotent requests (BIT-2530).

Made-with: Cursor
2026-04-12 10:34:15 +00:00
David Santos 78003b001d chore(errors): incremental tech debt — rate-limit typings, legacy web on Next 15
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
- api: Align rate-limit plugin docs with actual store (in-memory unless wired in
  index); type errorResponseBuilder context; augment FastifyRequest with optional
  ingest_token_id instead of casting to any.
- web: Upgrade to Next 15 / React 19; add ESLint 9 flat config, tsconfig,
  next-env.d.ts; outputFileTracingRoot so file tracing stays within this product tree.

Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-2479
Paperclip-Run: e3292ca4-a7b9-42f1-83ca-bc3d78906532
2026-04-12 09:23:04 +00:00
David Santos 0bd13bac5b feat(ci): implement Gitea Actions CI/CD pipeline
Add automated test, build, and validation pipeline:
- Test stages: npm test for ingest-api and api (Vitest)
- Lint/typecheck: admin-ui (Next.js ESLint + TypeScript)
- Docker build validation: validate all service containers
- Parallel jobs with Node 20, npm cache for fast iteration
- Documentation: docs/CI_PIPELINE.md with setup and troubleshooting

Addresses BIT-2498, BIT-2481 acceptance criteria for CI pipeline.

Paperclip-Agent: Patrícia Santos (urlKey patr-cia-santos; id 0f76874a-ad67-4a54-86f1-68a54dd1996f)
Paperclip-Issue: BIT-2498
2026-04-12 09:23:04 +00:00
David Santos 14df06dca3 Align api Fastify range with ingest-api (BIT-2517).
Set fastify to ^4.28.1 in api/package.json and sync the lockfile
metadata. npm run build && npm test passed for api and ingest-api.

Made-with: Cursor
2026-04-12 08:37:08 +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 Santos 1533b359df docs: add MONITORING.md hub entry point linked to fleet index (BIT-1949)
Add docs/MONITORING.md with links to OBSERVABILITY_PROMETHEUS.md, RUNBOOK_SLO.md,
deploy/grafana dashboard JSON, paperclip MONITORING_INDEX (BIT-221), and
ENVIRONMENTS § Observability. Extend README § Docs with the same entry point.

Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-1949
Paperclip-Run: 1f160242-9803-4a1b-a07b-828d0dc629aa
2026-04-09 21:58:41 +00:00
David Santos 6f991a85c4 docs: add hub runbook index (docs/runbooks/README.md)
Pointer-only index of triage, ingest, reporter, SLO, ops, deployment, and
reference docs; cross-links to paperclip company runbooks and hub contract.

Paperclip-Agent: Bug Squasher (urlKey bug-squasher; id 4669adc7-6368-43ef-bf27-5a601a6b7b83)
Paperclip-Issue: BIT-1948
Paperclip-Run: 7d4e556d-80f6-4674-acb6-efdb6c650ae7
2026-04-09 21:54:39 +00:00
spark 8eb0196400 Merge pull request 'feat(hub): php-error bridge + gitea_repo on recent-errors (BIT-1541, BIT-1291)' (#4) from feat/php-error-bridge-and-gitea-repo into master
Reviewed-on: #4
2026-04-08 19:34:15 +01:00
spark 0e4d359c09 Merge branch 'master' into feat/php-error-bridge-and-gitea-repo 2026-04-08 02:00:27 +01:00
David Santos ab992382bc fix(deploy): restart Fastify API on webhook promote + git safe.directory
BIT-1599 follow-up: recent-errors changes live in api/; restart
bitreport-error-reporting-api.service alongside other units.

Register ER_REPO_ROOT as a safe directory when root runs git against a
tree owned by error-reporting (avoids dubious ownership failure on
write-version-json / verify).

Paperclip: BIT-1599
Made-with: Cursor
2026-04-08 00:56:12 +00:00
David Santos 6e5d3ca2fc Merge branch 'feat/client-gitea-repo-context' (BIT-1599 php-error bridge + recent-errors gitea_repo) 2026-04-08 00:49:04 +00:00
David SantosandPaperclip 17781da9ec feat(api): expose gitea_repo on recent-errors rows (BIT-1291)
Extract gitea_repo from context_json and include it as a top-level field
on each row returned by GET /api/error-monitoring/recent-errors.
Supports gitea_repo, giteaRepo, repo_full_name, and repository keys.

Added unit tests covering the include and omit cases.

Paperclip-Issue: BIT-1291
Co-Authored-By: Paperclip <[email protected]>
2026-04-08 00:48:43 +00:00