State Diagram template

Code Review Process State Diagram Template

A state diagram template mapping every stage of a pull request lifecycle, ideal for engineering teams standardizing their code review workflow.

A code review process state diagram visualizes every discrete status a pull request can occupy—from the moment a developer opens a PR through approval, revision cycles, and final merge or closure. Each node represents a state such as "Open," "In Review," "Changes Requested," "Approved," or "Merged," while the arrows between them capture the events or decisions that trigger a transition, like a reviewer requesting changes or a CI pipeline failing. This makes it immediately clear which paths lead to a successful merge and which lead to abandonment or rework, giving the entire team a shared mental model of how code moves through the system.

## When to Use This Template

This template is especially valuable when onboarding new engineers who need to understand your team's review conventions quickly, or when your current process has grown inconsistent and you need to document the intended flow before enforcing it in tooling. It also serves as a foundation for automating PR workflows in platforms like GitHub Actions or GitLab CI—mapping the states first ensures your automation logic mirrors reality rather than an idealized version of it. Product managers and engineering leads will find it useful for identifying bottlenecks: if PRs frequently cycle between "In Review" and "Changes Requested" more than twice, the diagram makes that loop visible and prompts a conversation about review quality or scope.

## Common Mistakes to Avoid

One of the most frequent errors when diagramming a code review process is conflating reviewer actions with system states. "Reviewer left a comment" is an event, not a state—the resulting state is "Changes Requested." Keeping this distinction clean prevents diagrams that are impossible to implement in automation. Another common pitfall is omitting terminal states like "Closed Without Merge" or "Draft," which leads to a diagram that only models the happy path and fails to capture real-world scenarios. Finally, avoid creating too many granular states for edge cases that rarely occur; a diagram with fifteen states for a two-person team adds cognitive overhead without practical benefit. Aim for a diagram that is complete enough to be actionable but simple enough to be understood at a glance.

View Code Review Process as another diagram type

Related State Diagram templates

FAQ

What states should a code review process state diagram include?
At minimum, include Draft, Open, In Review, Changes Requested, Approved, Merged, and Closed. Add states like CI Failed or Blocked if your workflow requires them.
How is a state diagram different from a flowchart for a PR process?
A state diagram focuses on the status of the PR object itself and the events that change it, while a flowchart typically models the sequence of human tasks. State diagrams are better suited for automation and tooling design.
Can this template be used for GitHub or GitLab pull request workflows?
Yes. The states in this template map directly to PR statuses in GitHub and GitLab, making it straightforward to translate the diagram into branch protection rules or CI/CD pipeline triggers.
How many reviewers or roles should I represent in a code review state diagram?
State diagrams model the PR's status, not individual roles. Roles are better captured in a swimlane diagram. Keep your state diagram focused on transitions and use a separate RACI or swimlane chart for role responsibilities.