Task · MDE-0044

Make DNS cache clear linearizable with in-flight resolution

Description

Wave 3 found clear_cache resets cache and counters while in-flight resolver work can later repopulate entries and publish pre-clear backlog state. The authenticated clear operation therefore does not define a reliable generation boundary.

Acceptance Criteria

Definition of Done

Implementation Plan

Wave 2 L3: add a failing blocked-lookup-across-clear test first; capture a generation token per resolution batch and reject cache and metric publication after a clear; run focused checks and return evidence without tracker or external writes.

Implementation Notes

Wave 3 reproduced the generation race between clear_cache and in-flight resolution. The fix is a concurrency contract, not a local field update.

Wave 2 red: test_clear_cache_discards_in_flight_resolution returned the pre-clear hostname and repopulated the cache. A generation token now fences cache writes, outcome counters, queue metrics, and batch results across clear_cache. Green: 17 DNS resolver tests, typecheck, and just check with 2913 passed.

Final Summary

Parked after audit. Resume by adding a cache generation token captured by each batch and rejecting pre-clear publications, with a blocked-lookup regression for cache and queue metrics.

Wave 2: made DNS cache clearing linearizable by rejecting every publication from a pre-clear resolution generation, including cache, counters, queue metrics, and results. Verified by the blocked-lookup regression, resolver suite, and just check.

View the source file on GitHub