Skip to content

perf(update): in steady state the inventory walks only the Count's branches - #290

Merged
sweepies merged 2 commits into
mainfrom
perf/inventory-prefix
Nov 13, 2026
Merged

sweepies merged 2 commits into
mainfrom
perf/inventory-prefix

Conversation

@sweepies

@sweepies sweepies commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Consult 7, PR 4b (behaviour change accepted by the user). After #284 the inventory's remaining cost on a large repository is its branch pages, one per hundred branches on every run. Every branch the Count creates shares the configured prs.branch prefix, and a stored write receipt proves the Count has written there before.

  • With a verified-write-receipts entry for this repository and prefix, the inventory asks refs(refPrefix: "refs/heads/", query: $prefix). GitHub's query is a case-insensitive substring match (checked live), so the client keeps only names that start with the prefix; undecodable nodes still count against completeness. The filter travels on every continuation page.
  • Without a receipt (a first run, a cold cache, a changed prefix) no query is sent and every branch is walked as before. That run is a full write, and cleanup lists every branch itself.

Behaviour change, the only one: restore_inventory marks a run partial when it sees an owned branch no plan wants, including one outside the prefix whose commit carries the Count's trailers. Such a branch exists in steady state only when a person copies one of the Count's branches to another name. Today the next run deletes the copy; now the next full write does. Documented in guide/pull-requests.md and internals/cache.md.

Proof (crates/update/tests/inventory_prefix.rs):

  • many_foreign_branches_decide_alike: 150 in-prefix and 203 foreign branches, including an infix hit (vendor/patchula/thing) and a case hit (Patchula/case) that GitHub's query returns, paged. The full walk reads 353 names and the prefix walk exactly the 150. RestoreOutcome, dashboard Controls, tooling evidence and visible pull requests are identical.
  • a_copy_of_a_counts_branch_is_obsolete_only_to_the_full_walk pins the one intended difference.
  • a_plan_settles_alike_under_either_walk.
  • FakeGitHub::refs_connection models refPrefix (must end /), query (case-insensitive substring), first and after, and panics on anything else.
  • The recorded fixtures/update/inventory.json requests carry the new query text; variables are unchanged and no refQuery means no filter.
  • Transcript changes come from the added variable. Depth pins unchanged.

Live (read-only; the warm case seeds an empty receipt into a local in-memory cache, nothing is written to these repositories):

repository no receipt with a receipt branches walked
grafana/grafana 15 requests, 47.1 s 3 requests, 2.2 s 1,314 → 0
getsentry/sentry 88 requests, 342.2 s 3 requests, 2.8 s 8,645 → 0

View guided diff Turn on auto-fix

…anches

* a stored write receipt proves every branch the Count wrote shared the
  prefix, so the refs walk asks refs(query:) for it and keeps only the
  names that start with it; a cold cache or a changed prefix walks every
  branch, and that run is a full write whose cleanup lists every branch
  itself
* the one behaviour change: a branch a person copied to a name outside
  the prefix is invisible to the warm walk and is cleaned up by the next
  full write instead of the next run

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 669f572 Commit Preview URL

Branch Preview URL
Nov 13 2026, 01:57 AM

…osed

A branch renamed outside prs.branch keeps its open pull request on
GitHub, so the refs walk narrowed to the prefix cannot see it; the
receipts still name it. Guard the walk two ways: a repository-scoped
receipts-prefix marker names the prefix the most recent save used, so a
prs.branch flip away and back walks every branch once before narrowing
again, and a receipted branch absent from a narrow walk — with no plan
rewriting it — takes the full write path, whose REST pull listing and
cleanup branch list see it exactly as an unfiltered run would.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sweepies
sweepies merged commit 4171008 into main Nov 13, 2026
13 checks passed
@sweepies
sweepies deleted the perf/inventory-prefix branch November 13, 2026 02:04
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 13, 2026
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