test_splice_generation_counts_and_resets¶
Tests › tests/test_indexcache_doxygen_cache.py
What this test is for
Why it exists
RUN THE GUARD AGAINST THE CASE IT WAS BUILT FOR. The counter exists to bound a MEASURED error: a spliced database carried one call edge a full rebuild does not emit, out of 5168, and nothing in a splice bounds that across many refreshes. A counter that silently failed to advance would restore the unbounded behaviour while reading as protection, so all three properties are pinned — it advances, a full build clears it, and it PERSISTS, because the sidecar is reopened on every build and an in-memory-only counter would reset itself to zero on each one and never reach any limit.
Given
cache_path = tmp_path / "sidecar.db"cache = IndexCache(cache_path, tmp_path)
7 more
for expected in (1, 2, 3): cache.record_splice() assert cache.splice_generation() == expectedcache.commit()cache.close()reopened = IndexCache(cache_path, tmp_path)reopened.record_splice(reset=True)reopened.commit()reopened.close()
When
- —
Then
- ✓ cache.splice_generation() equals 0
- ✓ reopened.splice_generation() equals 3
- ✓ reopened.splice_generation() equals 0
tests/test_indexcache_doxygen_cache.py:158 · its file's page
What it checks (4)
assert cache.splice_generation() == 0, "a fresh sidecar must start at generation zero"not attributedassert cache.splice_generation() == expectednot attributedassert reopened.splice_generation() == 3, ( "the counter did not survive reopening, so every build would start from zero and no " "generation limit could ever be reached — the bound would be decorative" )not attributedassert reopened.splice_generation() == 0, "a full build must clear accumulated drift"not attributed
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-002 measured