Skip to main content

Module cache_safety

Module cache_safety 

Source
Expand description

Cache-preservation telemetry for the proxy’s frozen-region prose rewrites (#710).

The proxy only ever rewrites prose inside the cache-safe frozen window [cached_prefix_len, boundary) — never inside the client-cached prefix and never in the live tail. This module turns that invariant into a measurable production signal: every request that performs a frozen-region prose rewrite reports whether the rewrite stayed cache-safe, and /status surfaces the resulting ratio (1.0 = every rewrite was provably cache-safe, the healthy steady state). A value below 1.0 is a regression signal.

Structs§

CacheSafety
Point-in-time view of the cache-safety counters for /status.

Functions§

ratio
Cache-preservation ratio: safe / total, or 1.0 when nothing has been rewritten yet (the trivially-safe empty state). Pure, so it is unit-tested independently of the global counters.
record
Record one request’s frozen-region prose activity.
record_cold_repack
Record one deliberate cold-prefix repack (#480). Counted on its own gauge, never against record’s cache-safe ratio.
snapshot