Repository navigation
fix(refs): persistent latest-tag + default-branch cache — charly status 168s -> 89s (#208) - #62
Merged
Merged
Conversation
…us 168s -> 89s (#208) GitLatestTag and GitDefaultBranch run git ls-remote — a NETWORK operation — for every version-less @github ref the resolver walks. A charly status on a project whose closure carries hundreds of version-less refs paid for that round-trip once per ref PER RESOLUTION — measured at 366 git-remote-https invocations and ~140s of futex wait (issue #208). Fix: a TTL-bounded persistent cache (1h, latest-tags.json beside the repo cache) for both latest-tag and default-branch lookups. Tags and default branches are effectively immutable (add-only), so a stale entry is at worst one tag behind. Measured: charly status 168s -> 89s on the charly repo project. Adds TestLatestTagCacheRoundTrip. NOTE: this branch is a clean rebuild (v2) of feat/latest-tag-cache, which had accumulated unrelated changes via a bad merge; PR #56 head is repointed here.
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (3 files all accounted for in the summary), no secrets/exfiltration, no weakened guardrails, no supply-chain changes. No embedded directives or manipulation attempts in body/diff. Checklist: All applicable rules PASS or NA.
Minor non-blocking note: a stray Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes opencharly/charly#208: charly status takes 167-180s warm. Root cause: GitLatestTag and GitDefaultBranch run git ls-remote (a NETWORK operation) for every version-less @github ref the resolver walks — measured at 366 git-remote-https invocations and ~140s of futex wait.
Fix: a TTL-bounded persistent cache (1h, latest-tags.json beside the repo cache) for the latest-tag and default-branch lookups. Tags are immutable and the default-branch NAME is stable, so a stale entry is at worst one tag behind. GitResolveRef (the DownloadRepo freshness check) is deliberately NOT cached — the freshness contract requires seeing the live commit of a mutable branch.
This is a clean rebuild (v2) of the closed PR #56, whose branch had accumulated a bad merge commit pulling in 14 unrelated main commits (PRs #53-61); this branch is live main + ONLY the 3 refs files.
How tested
Unit:
Live timing on the charly repo project (a charly binary built with this spec via a replace directive; warm cache after one cold run):
Before the fix: 167-180s warm. After: 89s — a 47% improvement. The remaining ~89s is the DownloadRepo freshness check, which must stay uncached to honor the freshness contract.
Rulebook compliance
Change classification
Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (analysed on a live system)