#10

feat: support inline PR review comments

MergedstylesshContributormerged intofrom

Summary

  • extend try pr review with --comments, --comments-file, and --commit-id
  • validate automation-friendly {path, line, side, body} inline comment input before mutation
  • map RIGHT and LEFT lines to the platform API's new/old review positions and submit comments atomically with the review event
  • extend try pr review-comments with nested resolve COMMENT_ID and unresolve COMMENT_ID actions, without adding another try pr subcommand
  • preserve the existing no-action comment-listing behavior and allow -R and --json before or after nested actions
  • document both workflows and cover command help and outgoing API payloads

Platform API

No server change is required. The existing pull review endpoint already accepts comments and commit_id, and the existing review-comment resolution endpoint accepts a boolean resolved value. This PR exposes both contracts through first-class CLI commands.

Verification

  • 256 Rust unit tests passed
  • all 16 trylle_cli_commands_mock tests passed
  • all 4 root_help_cli tests passed
  • cargo fmt --all -- --check

The repository's broader suite still has existing version_update_cli expectations pinned to v1.1.0 while the checkout is v1.1.1; the focused CLI test coverage passes.

Activity

17
stylessh requested review from xlab4mo ago
trylle-botreviewed4mo ago
trylle-bot4mo ago

What changed

try pr review gains three new flags — --commit-id, --comments, and --comments-file — to submit inline comments anchored to diff lines atomically with the review event. User-supplied side: RIGHT/LEFT is normalized to new_position/old_position before the platform API call. New validation rejects unknown fields, non-positive line numbers, and invalid side values. Integration and unit tests are included.

Risk areas

1. No guard when --comments is used without --commit-id

The code inserts comments into the review body unconditionally when the flag is provided, regardless of whether commit_id is also present. The platform will accept the request but may silently attach inline comments to the wrong (or default) commit. The --commit-id flag is documented as "recommended" in the README, but that wording understates the risk — omitting it when inline comments are present is almost certainly a user error.

See inline comment for the specific location.

2. Pre-existing CI failure (version_update_cli)

The PR description acknowledges that version_update_cli tests are pinned to v1.1.0 while the checkout is v1.1.1. This is unrelated to the change but means CI has pre-existing red. Worth resolving before merge to keep CI signal clean and reviewable.

Suggested follow-ups

  • In the if let Some(comments) branch (src/trylle/mod.rs): emit a warning or return a soft error when comments is Some and commit_id is None.
  • The stdin-conflict error path (--body-file - --comments-file -) is validated but not exercised by the mock integration test — consider a run_fail case in trylle_cli_commands_mock.rs.
  • The README example shows only uppercase "RIGHT"/"LEFT", but the implementation accepts any casing via to_ascii_uppercase(). Minor doc alignment opportunity.
xlabMember4mo ago

Will add codex review to this repo

xlabrequested changes4mo ago
xlabMember4mo ago
  1. readme cleanup
  2. --commit-id required when inline comment expected
stylesshContributor4mo ago

@trylle-bot can you fix Max's comment?

trylle-bot4mo ago

@stylessh re Max's review (#515):

2) --commit-id required when inline comments are submitted — already resolved. src/trylle/mod.rs returns TrylleCliError::InvalidArguments("--commit-id is required when submitting inline comments") whenever review_comments_body(...) yields Some and commit_id is None (added in 9c5dcdf1, "fix: require commit for inline reviews"), and the README already states --commit-id is required whenever inline comments are submitted. This directly addresses my earlier inline note on that branch. Nothing left to do here.

1) README cleanup — still open, and I can't apply it myself: this bot only has read/comment access to this PR (no push/write permissions), so I can't commit the change.

Max's specific ask (inline comment on README.md:82): the new ### Submit inline pull request reviews section (README.md, roughly lines 82–122 — the JSON comment schema, the try pr review --commit-id/--comments-file/--comments walkthrough, and the review-comments resolve/unresolve examples) is automation-facing reference material, not a short tool summary, so it doesn't belong in README.

Suggested concrete fix: move that whole block into the CLI's skill docs (e.g. a new references/inline-reviews.md alongside the existing skill reference files, linked from the main skill file since automations rely on this heavily), and replace it in README with a one- or two-line pointer — matching how --stacked mode is only summarized in README today.

@stylessh — could you make that move? Happy to take another pass once it's pushed.

xlab merged commit 60983cc into master3mo ago

Branch stylessh/add-inline-pr-review-comments has been merged.

Checking branch