Files
Edward Cheng-I Wu f38d73f8c1 feat(cache): #541 staleness advisory + opt-in live re-validation for the citation-verification cache (#557)
* feat(cache): #541 staleness advisory + opt-in live re-validation for the citation-verification cache

VerificationCache gains entry_age_days/stale_report (oldest-live-row age per
citation; ARS_CACHE_STALE_ADVISORY_DAYS threshold, default 30, 0 disables,
malformed falls back). Phase A A0.5 emits ADV-CACHE-<n> advisory rows for
stale cache-served verifications (checkpoint display via the #547 template;
never gates); ARS_CACHE_REVALIDATE=1 verifies HIGH-IMPACT-supporting stale
references live (#549 tier composition). Invalidation cascade documented at
the command + gate. Summary schema gains optional cache_age_days +
cache_stale_advisory. 5 new pytest cases; SETUP en/zh-TW document both envs.

External motivation: Ren et al. (2026, arXiv:2607.13104 §6.2.3) — scheduled
review and attenuation; staleness/inconsistency as the signature failure mode
of integrated external knowledge.

Closes #541

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hi625UBf6GX7aeWJpJpSnE

* fix(cache): #541 codex round 1 — real cache-through wiring at the gate, robustness hardening, prose aligned to executable reality

P1: verify_citation/verify_passport run cache-through by default (closes the
#182 Delta-2 forward-decl): four resolvers route via new detailed
contamination-signals wrappers (interoperable cache keys; queried_by kept on
hits; bool-only signal layer preserved byte-for-byte via require_queried_by
parametrization); CLI gains --no-cache; ARS_CACHE_REVALIDATE=1 re-verifies
stale rows live per-row at the gate. P1: the HIGH-IMPACT tier coupling is
dropped (tiers are assigned at E1, unavailable at A0; gate-level stale-row
revalidation replaces it, cost documented). P2s: naive timestamps read as UTC,
malformed rows are misses, clock-skew clamps to 0, advisory flag computed from
the emitted rounded value; conservative oldest-live-row contract stated in the
schema; checkpoint template vocabulary extended to ADV-CACHE-<n> (lock
re-hashed); cascade made unconditional; §6.2.3 framed as design inference.
CLI tests isolated from the real user cache (autouse tmp fixture).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hi625UBf6GX7aeWJpJpSnE

* fix(cache): #541 codex round 2 — omitted-argument sentinel defaults + typed hit validation for the gate

P1: verify_citation/verify_passport use an _UNSET sentinel — omission
constructs the default VerificationCache and derives revalidation from
ARS_CACHE_REVALIDATE; explicit cache=None stays the live opt-out. The
documented non-CLI gate path now caches/revalidates by default. P2: gate
callers require typed hit payloads (matched: real bool, queried_by in
{id,title}) so a malformed row can never launder into lookup_verified; the
bool signal wrapper keeps its historical looser criteria. Gate/transport test
suites gain autouse tmp-cache isolation (default-on can never touch the real
user cache) + sentinel/env-revalidation/malformed-payload cases (145 green).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hi625UBf6GX7aeWJpJpSnE

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 14:30:49 +08:00
..