# Handle an expired cache entry

## Summary

Failing check `python -m pytest -q tests/test_cache.py` passed; 3 commands recorded in the session over 4m 0s, changes touched src/cache.py, tests/test_cache.py.

## Evidence status

- **State:** verified
- **Basis:** the same recorded check failed and later passed
- **Scope:** This verifies the recorded check, not the whole issue.
- **Root cause:** Not inferred by DebugBrief.

## Session metadata

- **Session ID:** `11111111-2222-4333-8444-555555555555`
- **Status:** COMPLETED
- **Project root:** `cache-service`
- **Started:** 2026-01-01 12:02:00 UTC
- **Ended:** 2026-01-01 12:06:00 UTC
- **Git branch:** `fix/cache-expiry`
- **Initial commit:** `a7c40e1`  **Final commit:** `a7c40e1`
- **Notes:** 2  **Commands:** 3  **Failed commands:** 1

## Reproduce and verify

- Reproduce (failed): `python -m pytest -q tests/test_cache.py`
- Verify (passed): `python -m pytest -q tests/test_cache.py`

## Red to green

A check failed at `12:02:12` and `python -m pytest -q tests/test_cache.py` passed at `12:04:12` (window 2m 0s).

Between the failing and passing checks, these files changed (correlation, not proven cause):
- `src/cache.py`
- `tests/test_cache.py`

## Observed error

Excerpt from recorded command output:

```
E AssertionError: expired entry returned instead of a cache miss
```

## Modified files

_2 file(s) changed, +14 / -3 lines._

- `M` modified: `src/cache.py`
- `M` modified: `tests/test_cache.py`

## Timeline

- `12:02:12` (command) `python -m pytest -q tests/test_cache.py` -> failed (exit 1) [0.4s]
- `12:03:00` (note) Expired entries still reach the read path. Check the expiry boundary.
- `12:04:00` (note) Return a cache miss when the entry expires. Added the boundary case to the test.
- `12:04:12` (command) `python -m pytest -q tests/test_cache.py` -> passed (exit 0) [0.4s]
- `12:05:12` (command) `python -m ruff check src tests` -> passed (exit 0) [0.08s]

## Verification and tests

- [passed] test (pytest): `python -m pytest -q tests/test_cache.py`
- [passed] check (ruff): `python -m ruff check src tests`

## Failed attempts

- `python -m pytest -q tests/test_cache.py` -> failed (exit 1)

---

_Generated by DebugBrief. This report is built from explicitly recorded notes, executed commands, and Git state when available. DebugBrief does not use AI and does not infer root causes, intent, or results._
