Scale unique answer tracking

This commit is contained in:
hz
2026-07-13 02:11:54 -05:00
parent 700da4e415
commit f2c59388eb
23 changed files with 1064 additions and 131 deletions
+15
View File
@@ -19,6 +19,21 @@ STEP-style question bank service for study games and clients.
Player reads require `USER` or `SUPER` JWT auth. Authoring endpoints require `SUPER`.
## Answer tracking
The `QuestionAttempts` collection is the immutable source of truth and enforces
one first attempt per question and user with a unique compound index. Choice
percentages are served from 32-way materialized counter buckets and cached for
up to five minutes. A background service backfills counters on the first deploy
and reconciles recently active questions every five minutes.
- `GET /readyz` verifies MongoDB connectivity for readiness checks.
- `GET /metrics` exposes Prometheus-format service and reconciliation metrics.
The manifests in `k8s/` configure 2-10 API replicas. The cluster must have
Kubernetes Metrics Server installed before applying them with
`kubectl apply -k k8s/`.
Questions submitted through authoring endpoints must have authoritative direct
reference links recorded as described in the repository's **Question
Verification References** policy. The references must verify the keyed answer