Skip to content

fix(evict): heal index after out-of-band deletes + add richer monitoring metrics - #65

Merged
rolandjitsu merged 4 commits into
mainfrom
fix/self-healing-cache-index
Oct 31, 2026
Merged

rolandjitsu merged 4 commits into
mainfrom
fix/self-healing-cache-index

Conversation

@rolandjitsu

@rolandjitsu rolandjitsu commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

What kind of change does this PR introduce?

  • fix
  • feat
  • refactor
  • perf
  • docs
  • test
  • build / ci
  • chore

Summary

The cache-size gauges come from an in-memory index that assumes the proxy owns the cache dir, so a mirror deleted by hand left them stale until restart - see #59. The eviction task now reconciles the index against disk on a timer, dropping entries whose path has vanished and refreshing the gauges.

Also, address pt. 2 and 3 from #57.

Tests

  • Added / updated tests (unit, plus integration where it fits)
  • Not relevant, because: ...

Checklist

  • CI is green locally: cargo fmt --all --check, cargo clippy --all-targets --all-features --locked -- -D warnings, cargo test --all-features
  • Commits follow Conventional Commits; AI-assisted commits carry an Assisted-by: trailer (see CONTRIBUTING.md / AGENTS.md)
  • Preserves the read-only, pull-only invariant (no push or proactive replication to upstream)
  • Docs / README updated if behavior or flags changed

Breaking change?

No.

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.12%. Comparing base (40f2696) to head (0374173).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
+ Coverage   96.97%   97.12%   +0.14%     
==========================================
  Files           6        6              
  Lines        2218     2333     +115     
==========================================
+ Hits         2151     2266     +115     
  Misses         67       67              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The cache-size gauges come from an in-memory index that assumes the
proxy owns the cache dir, so a mirror deleted by hand left them stale
until restart. The eviction task now reconciles the index against disk
on a timer, dropping entries whose path has vanished and refreshing the
gauges.

Closes #59.

Assisted-by: Claude:claude-opus-4-8
Document that the cache is self-managing and that `--cache-max-mb` is the
intended way to reclaim disk, since manual mirror deletion is tolerated but
not the supported lever (see #59).

Assisted-by: Claude:claude-opus-4-8
@rolandjitsu
rolandjitsu force-pushed the fix/self-healing-cache-index branch from 4eab554 to 04f7ca0 Compare October 31, 2026 07:12
Expose the configured cache cap (cache_max_bytes) and fetch TTL
(fetch_ttl_seconds) as static gauges set at startup, so a dashboard can
compute cache utilization without hardcoding the cap (see #57).

Assisted-by: Claude:claude-opus-4-8
Add cache_outcome_total{outcome=cloned|fetched|cached}, recorded once
per info/refs advertisement where the clone/fetch/TTL decision is made.
It is the local-vs-upstream signal: the share served without touching
upstream is cached / sum without (outcome) (...). The outcome was
already computed by ensure_fresh and discarded; this wires it up.

Closes #57.

Assisted-by: Claude:claude-opus-4-8
@rolandjitsu rolandjitsu changed the title fix(evict): heal index after out-of-band deletes fix(evict): heal index after out-of-band deletes + add richer monitoring metrics Oct 31, 2026
@rolandjitsu
rolandjitsu merged commit 623148c into main Oct 31, 2026
13 checks passed
@rolandjitsu
rolandjitsu deleted the fix/self-healing-cache-index branch November 3, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant