1---2name: p4-code-review3description: Code Review Workflows4---56# Code Review Workflows78Use the `query_reviews` and `modify_reviews` tools to manage P4 Code Review code reviews.910## Querying Reviews1112| Action | Purpose | Key Parameters |13|--------|---------|----------------|14| `list` | List reviews with filters | `review_fields`, `max_results` |15| `dashboard` | Get review dashboard for current user | — |16| `get` | Get full review details | `review_id` |17| `transitions` | Get available state transitions | `review_id` |18| `files` | List files in a review | `review_id` |19| `files_readby` | Check which files have been read by reviewers | `review_id` |20| `comments` | Get all comments on a review | `review_id` |21| `activity` | Get review activity log | `review_id` |2223## Modifying Reviews2425### Lifecycle2627| Action | Purpose | Key Parameters |28|--------|---------|----------------|29| `create` | Create a new review from a changelist | `change_id`, `description` |30| `transition` | Move review to a new state | `review_id`, `transition` |31| `archive_inactive` | Archive stale reviews | `not_updated_since`, `max_reviews` |32| `obliterate` | Permanently remove a review (requires approval) | `review_id` |3334### Voting & Participation3536| Action | Purpose | Key Parameters |37|--------|---------|----------------|38| `vote` | Vote on a review (up/down/clear) | `review_id`, `vote_value` |39| `append_participants` | Add reviewers | `review_id`, `users`, `groups` |40| `replace_participants` | Replace all reviewers | `review_id`, `users`, `groups` |41| `delete_participants` | Remove reviewers | `review_id`, `users`, `groups` |42| `join` | Join a review as participant | `review_id` |43| `leave` | Leave a review | `review_id` |4445### Comments4647| Action | Purpose | Key Parameters |48|--------|---------|----------------|49| `add_comment` | Add a new comment | `review_id`, `body`, `context` |50| `reply_comment` | Reply to an existing comment | `review_id`, `comment_id`, `body` |51| `mark_comment_read` | Mark a comment as read | `review_id`, `comment_id` |52| `mark_comment_unread` | Mark a comment as unread | `review_id`, `comment_id` |53| `mark_all_comments_read` | Mark all comments as read | `review_id` |54| `mark_all_comments_unread` | Mark all comments as unread | `review_id` |5556### Changelist Management5758| Action | Purpose | Key Parameters |59|--------|---------|----------------|60| `append_change` | Add a changelist to a review | `review_id`, `change_id` |61| `replace_with_change` | Replace review content with a new changelist | `review_id`, `change_id` |6263### Metadata6465| Action | Purpose | Key Parameters |66|--------|---------|----------------|67| `update_author` | Change the review author | `review_id`, `new_author` |68| `update_description` | Update review description | `review_id`, `new_description` |69| `refresh_projects` | Refresh project associations | `review_id` |7071## Common Workflows7273### Submit code for review74751. `modify_changelists` → `create` a pending changelist with your edits762. `modify_shelves` → `shelve` the changelist773. `modify_reviews` → `create` a review from the changelist784. `modify_reviews` → `append_participants` to add reviewers7980### Review code81821. `query_reviews` → `dashboard` to see reviews assigned to you832. `query_reviews` → `get` to see review details843. `query_reviews` → `files` to see changed files854. `query_reviews` → `comments` to see existing discussion865. `modify_reviews` → `add_comment` to provide feedback876. `modify_reviews` → `vote` to approve or request changes887. `query_reviews` → `transitions` to see available state changes898. `modify_reviews` → `transition` to approve/reject9091### Update a review92931. Make edits and shelve the updated changelist942. `modify_reviews` → `replace_with_change` to update review content953. Review comments and address feedback9697## Best Practices9899- Check `transitions` before calling `transition` to verify the target state is valid.100- Use `files_readby` to track which reviewers have seen the latest changes.101- Always `shelve` changes before creating a review so reviewers can see the diff.102- Use `append_participants` rather than `replace_participants` to avoid removing existing reviewers.