Files
zarinpal-analytics-backend/docs/decisions/0016-persisted-page-insight-platform.md

18 lines
1.3 KiB
Markdown

# ADR 0016: Persisted page insight platform and reviewed calendar authority
Status: Accepted
## Decision
Use versioned PostgreSQL snapshots and leased jobs for all six page insights. Page rendering reads the last valid snapshot and never invokes the AI provider. Scheduled, import, calendar, anomaly, and manual triggers enqueue deduplicated work. Keep the growth-report API as a compatibility adapter for one release.
Use a reviewed, activated database calendar as the only forecasting calendar authority. No render or forecast path may depend on a live calendar API. Tone and commercial posture control language safety but never imply financial direction; a direction requires deterministic merchant or eligible-cohort evidence.
## Consequences
- Analytics numbers remain reproducible and independently testable.
- Provider latency and outages degrade to explicit deterministic `PARTIAL` copy without blocking metrics.
- Calendar completeness and human approval become release-readiness gates.
- PostgreSQL remains the durable queue, avoiding a second coordination system while preserving lease recovery and idempotency.
- Worker scheduling is now intentional recurring production work; operations must monitor job age, fallback rate, stale scope count, calendar coverage, provider usage, and cost.