Skip to content

Search Projection Freshness Latency Proof

Scope

search-service owns copied indexes and sync checkpoints. Its optional freshness worker pulls one or more pages from question-bank, course, exam, and document owner services; it does not own canonical data, add a Gateway route, or replace public catalog ownership.

Each ProjectionFreshnessWorkerResult now records latencyMs, measured from before its current sync-state read through owner fetch, copied-index mutation, and sync-state write or error checkpoint. The production worker emits the same per-source fields in its structured completion/error log.

Verification

bash
GOTOOLCHAIN=go1.25.11 \
go test ./services/search-service/internal/usecase \
  -run '^TestProjectionFreshnessWorkerReportsPerSourceLatency$' -count=1 -v

GOTOOLCHAIN=go1.25.11 \
go test ./services/search-service/internal/http \
  -run '^TestProjectionFreshnessWorkerFromEnvRebuildsOwnerFixturesConcurrently$' \
  -count=1 -v

The first test holds an owner projection for 25 ms and proves the result reports at least that duration after the copied document and SYNCED checkpoint are written. The second test uses four HTTP owner fixtures and proves configured sources enter the worker concurrently, preserve internal ADMIN scope, and produce four copied index rows/checkpoints.

Boundary

This is local worker observability and latency instrumentation. It is not a production latency SLO, broker end-to-end delay measurement, browser proof, or Gateway/default-route promotion. /api/public/catalog* remains course-service owned until separate legacy parity, browser/runtime, and rollback evidence is accepted.

Go-platform documentation is generated from repository Markdown.