SIGN IN SIGN UP

test(cache): pin the invariant that keeps padding off disk

The paged/disk cache is safe only because every extractor that feeds
store_cache() reads `.state`, which slices to `:offset`. A live KVCache
allocates in 256-token chunks, so its buffers routinely carry trailing rows
that are not tokens; `.keys`/`.values` expose them.

That invariant is load-bearing and otherwise unguarded. Plain-KV layers
persist no offset (meta_state is empty), so on restore the length is taken
from the on-disk tensor shape — meaning a single extractor "optimised" to read
`.keys` directly would write zero rows as though a user had sent them, and
every later restore of that block would inherit them.

dots3 shipped the in-memory version of this in v1.6.34. This pins the disk
side with a sentinel-filled pad (7.0) so a regression fails here rather than
in production, and sweeps offsets 1/99/100/128/255/256 because testing only
step multiples is exactly what hid the original defect.

Verified the test catches it: making the fixture expose raw buffers instead of
`.state` fails 7 of 9 with "a pad row reached the store path".
J
Jinho Jang committed
a05109aee39e5fdcf3999e198f08ab95efdb645b
Parent: ed5bbde