Skip to content

feat: support SLA alerting, referral fraud review, treasury sweep preview, risk metadata staleness paging - #632

Merged
Abidoyesimze merged 1 commit into
Neurowealth:mainfrom
dslegacy:feat/support-referral-treasury-risk
Oct 20, 2026
Merged

Abidoyesimze merged 1 commit into
Neurowealth:mainfrom
dslegacy:feat/support-referral-treasury-risk

Conversation

@dslegacy

Copy link
Copy Markdown
Contributor

Closes #618
Closes #619
Closes #620
Closes #621

Summary

  • Support tickets: SLA timers, priority transitions, and stale-ticket alerting #618 Support tickets: firstResponseAt set on the first public admin reply; breach judged against it. Invalid status transitions return 409. A scheduled job flags SLA breaches and tickets untouched for SUPPORT_STALE_HOURS, publishes support_tickets_sla_breached{priority} / support_tickets_stale, and alerts via the alerting service. Prometheus rules added. docs/SUPPORT_TICKETS.md updated.
  • Referral fraud: admin review queue and score calibration report #619 Referral fraud: admin endpoints under /api/v1/admin/referrals/fraud: paginated queue (score band, flag, date filters), bulk-review (per-item AdminAuditLog row), calibration. scripts/referral-calibration.ts produces the monthly report. Fraud thresholds and weights are now env-driven; defaults match the old hard-coded values. Documented in docs/REFERRAL_PROGRAM.md.
  • Treasury sweep: dry-run/policy preview before enabling sweeps #620 Treasury sweep: POST /treasury/sweep/preview is read-only (tests assert no sweep, envelope or outbox writes). POST /treasury/policies/:id/enable requires the exact text SWEEP. Failed sweeps raise a critical alert. Runbook in docs/TREASURY.md.
  • Protocol risk metadata: admin update flow and staleness alerting to PagerDuty #621 Risk metadata: admin list/upsert endpoints with history and audit log (risk-metadata:* scopes now enforced). Staleness job pages through alertingService and is now scheduled. /api/protocols/risk returns riskMetadataStale, a penalised score and rawScore; the rebalancing router uses the penalised score. Documented in docs/PROTOCOL_RISK_SCORING.md.

Behaviour changes to note

  • Treasury sweep policies now default to sweepsEnabled = false, including existing ones after migration 20261020090000_ticket_sla_treasury_enable. Each must be previewed and enabled before the cadence job sweeps.
  • The PagerDuty dedup_key in alerting.ts was DLQ-specific; it now uses the alert's own dedupKey when provided.
  • New migration includes a rollback.sql.

Testing

  • tsc --noEmit, eslint, prettier --check pass; OpenAPI drift check passes; docs/API_KEYS.md regenerated.
  • New/updated tests: support SLA job and service, referral review queue and calibration, treasury preview/enable/failure alerts, risk metadata upsert and staleness alerting.
  • fraudDetection, admin-route-boundaries, refresh-token.service fail on main as well (confirmed by stash comparison); referral/service, config/secrets and some migrationProcess tests also fail and were assumed pre-existing, not compared.

…ep preview, risk metadata staleness paging

- support tickets: firstResponseAt, SLA breach/stale job, metrics and alert rules, 409 on invalid transitions (Neurowealth#618)
- referral fraud: admin review queue, bulk approve/reject with audit log, calibration report, config-driven thresholds (Neurowealth#619)
- treasury: sweep preview endpoint, typed SWEEP confirmation to enable policies, failure alerts (Neurowealth#620)
- risk metadata: admin upsert with audit, staleness paging via alerting service, riskMetadataStale in API (Neurowealth#621)
@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@dslegacy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants