100%

05 — tests-freshness-invariant-status

Goal

Lock the freshness invariant with tests + status reporting: every query serves content-current cheap-leg data (each in-scope file’s indexed content hash matches on-disk); the gate is zero-cost when fresh; content-divergence deltas are correct; GDS lag is bounded and observable. Wire the new freshness fields into intel-query.sh status parallel to the existing stale/cpg_stale/embedding_stale/insights_stale flags.

Implementation Sketch

Add intel_repo/tests coverage: fresh-path zero-cost (no sync, no Neo4j writes, even with a dirty/uncommitted tree), changed-path content-hash-delta correctness (only hash-diverged files re-indexed), per-file SCIP suppression scoping, GDS-deferred lag bound (insights catch up within one gate), graceful-degradation (gate error serves stale). Extend status to report ensure_fresh last-gate outcome + the content-hash manifest digest (NOT a git/HEAD marker).

Spec References

intel_repo/tests/test_staleness.py; intel_repo/tests/test_intel_query_cli.sh + test_query_graph_exit_codes.sh; intel_repo/CLAUDE.md §CLI Routing Tests + §AIMS-State Freshness Invariant

Work Items

  • Tests: fresh zero-cost (even dirty tree), changed-path content-hash-delta correctness, per-file SCIP scoping, GDS lag bound, graceful degradation
  • status reports ensure_fresh last-outcome + content-hash manifest digest (no git/HEAD marker)
  • Freshness-invariant pin: a query never serves cheap-leg data whose indexed content hash differs from on-disk when the gate is on
  • test-all wiring: the new harnesses run under intel_repo pytest + the CLI runner