Review a pull request for ArcticDB
Perform a thorough code review of an ArcticDB pull request.
When invoked from a GitHub Actions workflow the following variables are injected before
this prompt: PR_NUMBER, REPO, EVENT_ACTION, BEFORE_SHA, AFTER_SHA.
When invoked locally as a slash command the PR number is $ARGUMENTS
(e.g. /review-pr 2933). If $ARGUMENTS is empty, detect from the current branch.
# If PR_NUMBER is not set and $ARGUMENTS is empty, detect from current branch:
gh pr view --json number -q .number
# If REPO is not set, detect:
gh repo view --json nameWithOwner -q .nameWithOwner
If is and both and are set:
EVENT_ACTIONsynchronizeBEFORE_SHAAFTER_SHAAttempt to produce the delta diff (new commits only):
git fetch --depth=1 origin <BEFORE_SHA>
git diff <BEFORE_SHA>..<AFTER_SHA>
BEFORE_SHA) or the result is empty,
fall back: fetch the full diff and use it for both inline comments and summary.gh pr diff <PR_NUMBER> # fallback only
Otherwise (event is opened, reopened, ready_for_review, or this is a local run):
Fetch the full diff and use it as both the full diff and the delta diff:
gh pr diff <PR_NUMBER>
Fetch all existing inline review comments (for deduplication):
gh api --paginate "repos/<REPO>/pulls/<PR_NUMBER>/comments" \
--jq '[.[] | {path: .path, line: (.line // .original_line), author: .user.login, body: (.body | .[0:300])}]'
Also fetch the existing sticky summary comment, if any (for incremental updates):
gh api "repos/<REPO>/issues/<PR_NUMBER>/comments" \
--jq '[.[] | select(.body | startswith("## ArcticDB Code Review Summary"))] | last | {id: .id, body: .body}'
Before posting any inline comment, check the existing comments for an entry with the
same path and line:
Post only on lines present in the delta diff, subject to the deduplication rule above.
Only ever mention points that need attention in the summary checklist, not notes that things are fine.
If EVENT_ACTION is synchronize and a previous sticky summary exists:
Otherwise (event is opened, reopened, ready_for_review, or no previous summary):
Evaluate the full diff and post a fresh summary checklist.
Read the file docs/claude/PR_REVIEW_GUIDELINES.md from the repository root using the
Read tool. Apply all sections relevant to the files changed in the PR. The file also
contains the summary checklist format to use when posting the sticky comment.