Repository navigation
feat(refs): GitClient — the centralized git layer with a persistent project-scoped cache - #65
Conversation
…roject-scoped cache Every git operation in the loader now goes through one entry point (spec/refs.GitClient) instead of each consumer running git commands itself (issue #423, #208). The client: - caches GitLatestTag + GitDefaultBranch (24h TTL) and GitResolveRef (5m TTL) in a persistent git-cache.json under the project's charly dir (.charly/cache) or the repo cache dir, guarded by the advisory file lock; - caches mutable-ref DOWNLOADS with a 5m TTL — a branch can move, but not on every invocation, so the status fan-out resolving the envelope multiple times pays the download once; - loads the persisted cache on construction, so a warm cache is honored across invocations; - exposes WarmUp for the first-startup prefetch with user feedback. The freshness contract is preserved: GitResolveRef stays uncached at the primitive level (live commits), and the download TTL bounds how stale a mutable branch may be.
Review — BLOCKHead SHA: Change class: code change — new Go files in Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes; PR does not touch the validator spec or rulebook. Checklist: All applicable rules PASS or NA. Prior comment disposition:
Placement: CORRECT — the GitClient wraps the existing Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain changes; PR does not touch the validator spec or rulebook. Checklist: All applicable rules PASS or NA. Prior comment disposition:
Placement: CORRECT — the GitClient wraps the existing Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
Introduces
spec/refs.GitClient— the centralized git layer that every loader git operation goes through, instead of each consumer running git commands itself (issues #423, #208).git-cache.jsonunder the project's charly dir (.charly/cache) or the repo cache dir, guarded by the advisory file lock.LatestTag/DefaultBranch24h,ResolveRef5m, mutable-refDownload5m — a branch can move, but not on every invocation.WarmUpfor the first-startup prefetch with user feedback.GitResolveRefstays uncached (live commits); the download TTL bounds mutable-branch staleness.How tested
The GitClient's cache/persist/TTL/warm-up behavior is covered by
git_client_test.go(cache hit, TTL expiry, persistence round-trip, warm-up cold detection). The full-stack timing evidence (version 13.5s→0.31s, status 97s→11s) was measured live with the GitClient wired into the sdk loader + charly prescan — that wiring lands in the follow-up sdk PR (this PR is the spec-side primitive only).Rulebook compliance
Change classification
go test ./refs/(unit) + full-stack live timing with the wired stackAssisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (analysed on a live system)