feat: add pr review (task 0013) #13

Merged
alexion merged 1 commits from task-0013-pr-review into main 2026-07-13 21:52:29 -04:00
Owner

Implements .claude/tasks/0013-pr-review.md.

Summary

Adds pr review <n> with the three action switches --approve, --request-changes, and --comment, plus --body/--body-file. Exactly one action flag is required — zero or multiple raise VALIDATION_ERROR before any API call, mirroring pr merge's conflicting-selector rule (adapted from "at most one, with a default" to "exactly one, no default"). Body requirements are left to Gitea: a body-less event it rejects surfaces its 422 as VALIDATION_ERROR carrying the server's message, via the shared classifyHttpError. Output is review: { number, action }.

Built test-first via the test-driven-development skill (one behavior per RED→GREEN cycle); test/pr-review.test.ts adds 10 tests. Full suite 311 passing, typecheck clean.

Deliberate deviations (see the task's Implementation Notes):

  • The success block appends a pr view <n> --reviews suggestion line — house style shared by every sibling mutation command, kept over the bare output contract.
  • Introduced a named ReviewAction interface in place of a repeated inline type (addressing a review nit; matches the local MergeMethod/UpdateStyle convention).

Review

Risk — Overall: Medium

  • Blast radius: Low — self-contained prReview/resolveReviewAction plus one dispatch branch, reuses existing helpers.
  • Reversibility: Low — additive subcommand, no migrations/schema/deletions.
  • Test coverage: Low — new vitest file covers all three actions, zero/multiple-flag validation, 422 passthrough, both body sources.
  • Sensitive domain: Medium — PR reviews gate merge approvals, though Gitea enforces auth.
  • Size & complexity: Low — ~80 lines, flat control flow.
  • Runtime criticality: Low — developer-facing CLI tooling.

Unaddressed findings:

  • Standards (Duplicated Code, judgement call): resolveReviewAction echoes resolveMergeMethod's flag-count-and-throw shape. Left separate — the rules genuinely differ (merge permits a default; review requires exactly one), so the shared shape is too thin to extract honestly.
  • Spec (house-style note): the appended pr view --reviews suggestion line exceeds the literal review: { number, action } output contract. Kept — every sibling command adds the same kind of hint.
Implements `.claude/tasks/0013-pr-review.md`. ## Summary Adds `pr review <n>` with the three action switches `--approve`, `--request-changes`, and `--comment`, plus `--body`/`--body-file`. Exactly one action flag is required — zero or multiple raise `VALIDATION_ERROR` before any API call, mirroring `pr merge`'s conflicting-selector rule (adapted from "at most one, with a default" to "exactly one, no default"). Body requirements are left to Gitea: a body-less event it rejects surfaces its 422 as `VALIDATION_ERROR` carrying the server's message, via the shared `classifyHttpError`. Output is `review: { number, action }`. Built test-first via the `test-driven-development` skill (one behavior per RED→GREEN cycle); `test/pr-review.test.ts` adds 10 tests. Full suite 311 passing, typecheck clean. Deliberate deviations (see the task's Implementation Notes): - The success block appends a `pr view <n> --reviews` suggestion line — house style shared by every sibling mutation command, kept over the bare output contract. - Introduced a named `ReviewAction` interface in place of a repeated inline type (addressing a review nit; matches the local `MergeMethod`/`UpdateStyle` convention). ## Review **Risk — Overall: Medium** - Blast radius: Low — self-contained `prReview`/`resolveReviewAction` plus one dispatch branch, reuses existing helpers. - Reversibility: Low — additive subcommand, no migrations/schema/deletions. - Test coverage: Low — new vitest file covers all three actions, zero/multiple-flag validation, 422 passthrough, both body sources. - Sensitive domain: Medium — PR reviews gate merge approvals, though Gitea enforces auth. - Size & complexity: Low — ~80 lines, flat control flow. - Runtime criticality: Low — developer-facing CLI tooling. **Unaddressed findings:** - Standards (Duplicated Code, judgement call): `resolveReviewAction` echoes `resolveMergeMethod`'s flag-count-and-throw shape. Left separate — the rules genuinely differ (merge permits a default; review requires exactly one), so the shared shape is too thin to extract honestly. - Spec (house-style note): the appended `pr view --reviews` suggestion line exceeds the literal `review: { number, action }` output contract. Kept — every sibling command adds the same kind of hint.
alexion added 1 commit 2026-07-13 20:45:39 -04:00
feat: add pr review (task 0013)
All checks were successful
CI / test (pull_request) Successful in 38s
7d72f94746
Add `pr review <n>` with the three action switches --approve,
--request-changes, and --comment, plus --body/--body-file. Exactly one
action flag is required; zero or multiple raise VALIDATION_ERROR before
any API call, mirroring the merge shorthand-conflict rule. Body
requirements are left to Gitea: a body-less event it rejects surfaces its
422 as VALIDATION_ERROR carrying the server's message. Output is
`review: { number, action }`.
alexion merged commit ba5171bb59 into main 2026-07-13 21:52:29 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alexion/gitea-axi#13