test_splice_generation_counts_and_resets

Tests › tests/test_indexcache_doxygen_cache.py

passed Passed in the packaged run.

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

  1. cache_path = tmp_path / "sidecar.db"
  2. cache = IndexCache(cache_path, tmp_path)
7 more
  1. for expected in (1, 2, 3): cache.record_splice() assert cache.splice_generation() == expected
  2. cache.commit()
  3. cache.close()
  4. reopened = IndexCache(cache_path, tmp_path)
  5. reopened.record_splice(reset=True)
  6. reopened.commit()
  7. reopened.close()
→

When

  1. —
→

Then

  1. ✓ cache.splice_generation() equals 0
  2. ✓ reopened.splice_generation() equals 3
  3. ✓ reopened.splice_generation() equals 0

tests/test_indexcache_doxygen_cache.py:158 · its file's page

What it checks (4)

  1. assert cache.splice_generation() == 0, "a fresh sidecar must start at generation zero" not attributed
  2. assert cache.splice_generation() == expected not attributed
  3. assert 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 attributed
  4. assert 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.