Skip to content

perf(update): the inventory asks for the Count's issues, and later pages only for what is left - #284

Merged
sweepies merged 4 commits into
mainfrom
perf/inventory-issues
Nov 12, 2026
Merged

sweepies merged 4 commits into
mainfrom
perf/inventory-issues

Conversation

@sweepies

@sweepies sweepies commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Consult 7, PR 4a. Every real run walked every branch and every open issue in one document per page, and each page repeated the issue bodies and the constants. On large repositories that was tens of pages at about 3.5 s each, on every run including a no-op.

  • The Count's issues only. The first page asks issues(states: [OPEN], filterBy: {createdBy: $actor}) when a stored hint names the run's actor (inventory-actor state, per credential scope). createdBy takes the REST login of a bot (renovate[bot]), which is viewer.login. With no hint, or when the answer's viewer.login differs, the read falls back to the unfiltered document and stores the login: a wrong hint costs one request. dashboard::issue still scans the actor's open issues and still refuses two dashboards.
  • Later pages ask only for what is left. Continuation documents carry viewer, the default branch's name and OID for the per-page race check, and only the connections that still have pages, together when both do (inventory-next.graphql), alone otherwise. A finished connection is never sent again.
  • A cold read restarts its issues filtered. When the first page was unfiltered and its issues have another page, the issue walk restarts with createdBy set to that page's viewer.login, alongside the remaining branch pages.

No behaviour change.

Proof:

  • tests/inventory.rs: an Inventory built with the old single document and with the new ones over seeded fakes is equal, and so are the decisions taken from it. The fakes cover two dashboards by the actor plus one by another author, 101 issues, 250 branches, an unreadable node, a stale hint, and a cold read whose issues page and restart on the actor.
  • dashboard.rs pins the request sequence: cold first → next → issues → issues, warm first → next → issues.
  • FakeGitHub models issues(states:, filterBy: {createdBy}, first:, after:) and panics on anything it does not.
  • Recorded read-only cassette fixtures/update/inventory.json (renovatebot/github-action, whose dashboard renovate[bot] opened), replaying the unfiltered and then the filtered read through production code.
  • Transcripts change only because the inventory query text changed and pages split.

Live inventory reads (requests):

repository before after, cold after, warm
mastodon/mastodon 45 3 (11 s) 3 (10 s)
grafana/grafana 27 14 (57 s) 14 (48 s)
getsentry/sentry 87 87 87

Before, the same reads took about 100 s on mastodon and 79 s on grafana. The old code could not finish a cold sentry walk in 8 tries: each fat page widened the window for a branch race. What remains is branch pages; 4b reads only the Count's branches in steady state.

View guided diff Turn on auto-fix

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 12, 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 1da5f04 Commit Preview URL

Branch Preview URL
Nov 12 2026, 11:40 PM

@sweepies
sweepies force-pushed the perf/inventory-issues branch from 07aa677 to 7ee82fc Compare November 12, 2026 23:20
sweepies and others added 4 commits November 12, 2026 23:27
…ges only for what is left

The first page asks everything once, with open issues filtered to the
run's actor (createdBy) when a stored hint names it; continuation pages
ask only the connections that still have pages, together, plus viewer and
the default branch's head for the race check. A cold read that started
unfiltered restarts its issue walk on the first page's viewer login. A
wrong hint costs one request.
The split walk reads nodes(ids:$closed), the merge settings and the
default branch's rules, history and update rule from its first page
alone; the old single document re-asked them every page and the last
answer won. A walk that pages now ends on one small re-read of exactly
those fields, so a closed receipt that reopened mid-walk is acted on
open again — the actor and head checks hold the closing page to the
same bar as the continuations.

The actor hint is stored as soon as the first page's viewer.login is
known, even when the walk goes on to fail, so a cold repository never
stays cold and the hundred-thousand-node budget is restored. A broken
issue node authored by someone else is never received by the hinted
read, and the inventory-actor state is documented.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sweepies
sweepies force-pushed the perf/inventory-issues branch from 7ee82fc to 1da5f04 Compare November 12, 2026 23:39
@sweepies
sweepies merged commit e9bbab0 into main Nov 12, 2026
13 checks passed
@sweepies
sweepies deleted the perf/inventory-issues branch November 12, 2026 23:49
@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