Skip to content

Cache Semantics

The cache stores canonical raw state — not profile-specific snapshots. Every cache hit re-projects through the requested profile, ensuring projection isolation.

Canonical Cache Architecture

Cache Storage: Canonical Raw State (profile-agnostic)
        ├── ?profile=fast     → FAST projection
        ├── ?profile=standard → STANDARD projection
        └── ?profile=full     → FULL projection

Invariants

No Profile Leakage

Cached FULL data never leaks into FAST responses:

jsonc
// FULL cached → FAST requested:
// diagnostics: omitted (FAST rule)
// preview.placeholder: omitted (FAST hides generated)
// preview.palette: omitted (FAST hides computed)
// Only provider-native preview survives FAST projection

No Richness Degradation

Cached FAST data never limits FULL richness. FULL always includes diagnostics even when the cache was warmed by FAST.

Non-Regression Through Cache

Processing state never becomes stale. If workers complete between requests, the second request reflects updated canonical state.

Response Source Tracking

ScenarioresponseSourcecachedHTTP
First request"fresh"false200
Cache hit"cache"true200
Inflight attachment"inflight"false202
FULL upgrading partial"fresh"false200

Provenance Immutability

Critical Rule

enrichmentSources is immutable across cache hits. responseSource may change to "cache", but provenance stays as originally recorded.

jsonc
// Request 1 (fresh):
{ "responseSource": "fresh", "enrichmentSources": { "semantic": "fresh" } }

// Request 2 (cache hit) — provenance preserved:
{ "responseSource": "cache", "enrichmentSources": { "semantic": "fresh" } }

Two distinct concepts:

  • responseSource — how was this response fulfilled (transport)
  • enrichmentSources — when was this data produced (provenance)

Shared Orchestration

Multiple profiles for the same resource share a single job. FAST and STANDARD share the same job ID. Duplicate FULL requests reuse existing jobs.

Infrastructure Documentation — Behavior-Driven, Schema-Governed