Repository navigation
Commit add6954
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
371 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
372 | 377 | | |
373 | 378 | | |
374 | 379 | | |
| |||
0 commit comments