Skip to content

Isolate cached identity assertions from startup maintenance - #148

Merged
bazer merged 1 commit into
masterfrom
codex/cache-identity-test-maintenance
Sep 17, 2026
Merged

bazer merged 1 commit into
masterfrom
codex/cache-identity-test-maintenance

Conversation

@bazer

@bazer bazer commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Why

PR #147's first CI run failed EmployeesInstanceEqualityTests.Immutable_EqualsSameCachedInstance on SQLite-file. Primary-key equality and hash equality passed; only the reference-identity assertion at line 28 failed. Original evidence: job 105242345298, attempt-1 artifact, SHA-256 cd92c61374f9ba73c8270d82e544f05c290000bf65c900f286d8ec093d14abed.

Each fixture already has a separate provider/cache. However, the cleanup scheduler performs an initial maintenance pass, and age cleanup advances the publication generation even if it removes no cached rows. A first read overlapping that pass can legitimately return an uncached object; the next read returns an equal but different instance.

A controlled constructor gate reproduces this exact assertion failure by running scheduled cleanup while the first row is being constructed. The historical CI artifact does not itself trace the scheduler interleaving, so this identifies and reproduces a concrete race consistent with the failure rather than claiming a captured execution trace.

Changes

  • Stop only this fixture's cleanup scheduler before the identity-sensitive reads. Preserve all existing equality, hash and reference assertions.
  • Add deterministic coverage of cleanup overlapping construction: zero rows removed, equal results with different references, then stable identity on subsequent reads once publication succeeds.
  • Use the existing per-provider constructor gate; no sleeps, retries, global serialization or weaker identity assertions.

No production code, cache policy, driver dependency or pooling behavior changes. This is independent of the upstream SQLite pool ownership defect (W0-F1); it does not waive that release limitation. Target master first, then merge forward to v0.10 under the accepted branch workflow.

Validation

  • Negative control on master-based source: the forced overlap fails the original same-reference expectation at the exact asserted condition (local artifacts/cache-identity-forced-red.json).
  • Release / .NET 10 SQLite-file anchor shard: 516/516 passed at maximum parallelism 8.
  • Release / .NET 10 SQLite-memory anchor shard: 516/516 passed at maximum parallelism 8.
  • Modified-checkout local development verification, not frozen release evidence. Original failed CI attempt and the local negative control are retained; neither is erased by these passes.
  • Diff whitespace checks passed. CI must still pass on the committed PR head.

Stop background cleanup in the identity-specific test while preserving all equality and reference assertions. Add a controlled construction/cleanup interleaving to prove that a rejected publication returns an equal uncached result and later reads retain cached identity.
@bazer
bazer merged commit fe5a372 into master Sep 17, 2026
12 checks passed
bazer added a commit that referenced this pull request Sep 17, 2026
Preserve master ancestry and integrate #148 after the development integration PR passed its required gate. No production behavior or driver changes; W0-F1 remains open.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant