Skip to content

Commit add6954

Browse files
committed
refactor(git): model review-url resolution with typed entries
Addresses the review on #45. Move `review-url` out of `git.rs` into `src/commands/git/review_url.rs`, so `git.rs` holds the command variants and local VCS work again rather than GraphQL queries, feed pagination, and API decoding. `git.rs` returns to roughly its pre-feature size. Replace the raw-`Value` merge pipeline with typed deserialization and a serializable `ReviewEntry`. Sources merge into one map keyed by GitHub pull request URL, with the agent-session fallback inserted first so a notification result replaces it — precedence is now the merge's structure rather than a convention about ordering. Missing fields are `Option`s instead of silent nulls, and a pull request Linear returns without a URL yields no entry rather than one with a null identity. Resolution is modelled as resolved plus unresolved pull requests. Previously an issue with two attached pull requests where only one resolved printed that one URL and exited 0, saying nothing about the other. Unresolved pull requests are now part of the output contract: `-o json` returns `{"resolved": [...], "unresolved": [...]}` and the plain-text form names them on stderr. The command still fails only when it resolved nothing. Drop the private cursor state machine in favour of `paginate_until`, a short-circuiting paginator alongside `paginate_nodes` in `pagination.rs`. It follows the canonical cursor rules — including stopping when a connection claims `hasNextPage` without returning an `endCursor`, which the private loop would have answered by rereading the first page until its five-page cap. It stops as soon as every wanted pull request is found, so the common resolved-on-the-first-page case still costs one request rather than five. Also drop a trailing blank line in `initiatives.rs` that failed `cargo fmt --check` and so kept Clippy from running.
1 parent e7623d2 commit add6954

5 files changed

Lines changed: 926 additions & 382 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,13 @@ linear-cli g review-url LIN-123 # Linear review URL for the iss
367367
the one public place a pull request is paired with its review page — and falls
368368
back to the pull requests linked to the issue's agent sessions. A pull request
369369
that has produced neither (a brand-new PR with no CI result, comment, or review
370-
activity yet) has nothing to resolve, and the command says so instead of guessing
371-
a URL.
370+
activity yet) has nothing to resolve, and the command reports it instead of
371+
guessing a URL.
372+
373+
Unresolved pull requests are part of the output, not a silent omission: `-o json`
374+
returns `{"resolved": [...], "unresolved": [...]}`, and the plain-text form prints
375+
the review URLs on stdout while naming any unresolved pull request on stderr. The
376+
command fails only when it resolved nothing at all.
372377

373378
### Import / Export
374379

0 commit comments

Comments
 (0)