Add caching at one boundary, with clear rules for clearing it
A cache designed with its clearing rules from the start, rather than added after somebody notices out-of-date data.
The ticket
Add a cache at one boundary, with explicit invalidation and tests for every path.
Acceptance criteria
- Hit, miss, and invalidation each have a test
- The invalidation trigger is explicit rather than time-based alone
- Cached data carries no per-user content unless the key includes the user
- Hit rate is measurable after deploy
What lands as proof
Tests for all three paths, especially invalidation, which is the one that causes the incidents.
Why teams defer it
- Caching is easy and invalidating correctly is not, so the cache lands and the invalidation is deferred.
- Stale data bugs surface far from the cache, which makes them expensive to diagnose.
Questions
- What does the agent actually change?
- The ticket is scoped to one outcome: add a cache at one boundary, with explicit invalidation and tests for every path. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.
- How do I know the work is done?
- The pull request carries the evidence, not only the diff. Here that means hit, miss, and invalidation all covered by tests, so a reviewer can confirm the result without reproducing the work locally.
- How much oversight does this need?
- The run stops once the plan is written. Somebody reads the approach and approves it before any code exists, which is the cheapest moment to redirect the work.