v0.2.24: GraphQL PR fetch + ez track#23
Merged
Merged
Conversation
Replace the global paginated REST scan in get_all_pr_statuses with a targeted GraphQL query that asks for just the branches we have locally. On repos with thousands of historical PRs (e.g. 10k+) this drops ez sync from ~120s to ~2s. - github::get_pr_statuses_for(remote, branches) uses aliased pullRequests(headRefName: ...) fields in a single GraphQL query. - Parse owner/repo from the local git remote URL (10ms) instead of shelling out to gh repo view (400ms), with a gh fallback for unparseable URLs. - Wire sync.rs and list.rs to the new function. adopt.rs stays on the full scan because it needs the global PR graph. - 11 new unit tests covering URL parsing, query construction (alias ordering + JSON escape), response parsing (MERGED vs CLOSED), and an integration test asserting exactly one GraphQL request is sent for 25 branches. Bumps version to 0.2.24.
Local-only counterpart to ez adopt: pure metadata write that makes an existing branch tracked by ez without rebasing, network, or PR graph. Parent inference: pick the candidate (trunk + tracked branches) whose merge-base with the target is the strictly deepest descendant. Trunk wins on ties so users get the expected default when no closer ancestor is tracked. parent_head is set to merge_base(parent, target) so the next ez sync correctly restacks onto current parent tip. - src/cmd/track.rs: command + infer_parent + 4 pure unit tests for the selection rule (decoupled from git I/O). - src/cli.rs / src/main.rs: Track command and dispatch. - src/error.rs: BranchNotInStack hints at ez track now. - src/git.rs: rev_list_count helper for the commits-ahead reporting. Updates CLAUDE.md 0.2.24 entry to cover both this and the GraphQL change.
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
Two features bundled for 0.2.24.
1.
ez sync/ez listGraphQL PR fetch — 122s → 1.8s on a 10k-PR repoget_all_pr_statusespaginated every PR in the repo (98 round-trips for 9.8k PRs in onyx) to look up status for a handful of local branches. Replaced with a single GraphQL request that asks for just the branches we have, one aliasedpullRequests(headRefName: ...)field per branch.github::get_pr_statuses_for(remote, branches)— single GraphQL round-trip.git::remote_url+ local URL parser — derive owner/repo from.git/config(~10ms) instead ofgh repo view(~400ms). Falls back togh repo viewfor unparseable URLs.cmd/sync.rsandcmd/list.rs.cmd/adopt.rskeeps the full scan since it needs the global PR graph.Behavior note: GraphQL returns
state: "MERGED"for merged PRs where REST returned "CLOSED" +mergedAt. The PR badge inez list/ez lognow shows MERGED (purple) instead of CLOSED for merged PRs — more accurate.PrInfo.mergedis set correctly for cleanup logic.2.
ez track— adopt a raw-git branch into the stackLocal-only counterpart to
ez adopt. Pure metadata write — no rebase, no network, no PR graph.Parent inference walks
merge-base(candidate, target)across trunk + tracked branches and picks the strictly deepest descendant. Trunk wins on ties.parent_headis set tomerge_base(parent, target)so the nextez synccorrectly restacks onto the current parent tip.EzError::BranchNotInStacknow hints atez trackinstead of justez log.Tests
15 new tests, 215 total pass:
GraphQL (11):
ez track(4):Test plan
cargo test— 215 passcargo fmt --all -- --checkcleancargo clippy -- -D warningsclean on lib codeez syncsmoke test in onyx (1.8s) and ez-stack (1.4s)ez trackhappy path + 4 error paths (trunk, missing branch, already-tracked, unknown --parent)