Skip to content

Slice loaders return all cached rows on a cache hit instead of slicing to n #14

Description

@bamdadd

On a cache hit, load_mmlu_slice / load_gsm8k_slice return every row in the cache file without checking the count against n (src/steerbench/metrics.py:578 and :619). Because n is part of the cache key this is invisible in normal use, but a hand-edited or stale cache file makes load_*_slice(n=1) return however many rows the file holds — silently violating the size contract.

Fix: on the cache-hit path, slice the loaded rows to n (and/or validate the count and re-fetch on mismatch). The accept-path tests added in #13 already assert the n=1 shape and would extend naturally to a too-many-rows fixture.

Surfaced by @Nitjsefnie while writing #13.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions