Skip to content

Ubiquitous Language - Code Review Automation

Core Domain Concepts

ReviewRequest

Definition: A request to review code changes before merging into a target branch. Platforms: GitLab calls this "MergeRequest", GitHub calls this "PullRequest". Internal usage: Always use ReviewRequest in domain code.

ReviewAction

Definition: An atomic action to execute on a ReviewRequest via platform CLI (glab/gh). Types: THREAD_REPLY, THREAD_RESOLVE, POST_COMMENT, ADD_LABEL, FETCH_THREADSImportant: This is a unified concept. Both Initial Review and Follow-Up Review produce ReviewAction[]. Location: entities/reviewAction/

ExecutionContext

Definition: The context needed to execute ReviewActions on a specific platform. Contains: platform, projectPath, mrNumber, localPathLocation: entities/actionExecution/

ExecutionResult

Definition: The result of executing a batch of ReviewActions. Contains: total, succeeded, failed, skippedLocation: entities/actionExecution/

ReviewJob

Definition: A scheduled unit of work representing one code review execution. States: queuedrunningcompleted | failed | cancelledIdentity: Unique jobId generated at creation.

ReviewRequestTracking

Definition: The lifecycle tracking of a ReviewRequest across multiple reviews. States: pending-reviewpending-fixpending-approvalapprovedmerged | closed

Thread

Definition: A code comment discussion that requires resolution. Synonyms: GitLab "discussion", GitHub "review comment". Metric: openThreads = unresolved discussions count.

FollowupReview

Definition: A subsequent review triggered after the author pushes new commits to address previous feedback. Trigger condition: Push on ReviewRequest with openThreads > 0 and state pending-fix. Difference from initial review: Uses "review-followup" skill, focuses on addressed issues.

Platform Mapping

Domain TermGitLab TermGitHub Term
ReviewRequestMergeRequest (MR)PullRequest (PR)
reviewRequestNumberiidnumber
ThreadDiscussionReview Comment
AuthorAuthorUser
ReviewerReviewerRequested Reviewer
AssigneeAssigneeAssignee

State Machines

ReviewJob States

queued ──→ running ──→ completed

              ├──→ failed

              └──→ cancelled

ReviewRequestTracking States

pending-review ──→ pending-fix ──→ pending-approval ──→ approved ──→ merged
      │                │                  │               │
      └────────────────┴──────────────────┴───────────────┴──→ closed

Valid State Transitions

FromCan transition to
pending-reviewpending-fix, pending-approval, closed
pending-fixpending-review, pending-approval, closed
pending-approvalapproved, pending-fix, closed
approvedmerged, closed
merged(terminal)
closed(terminal)

Review Types

TypeTriggerSkillPurpose
Initial ReviewReviewRequest assigned to ClaudereviewFull code review
Followup ReviewPush on ReviewRequest with open threadsreview-followupReview of fixes

InitialReview vs FollowUpReview

Both produce ReviewAction[]. The distinction lives in the Use Case layer: initial reviews find all issues, followup reviews verify fixes. Both use the same ReviewAction entity and ReviewActionGateway for execution.

Scoring

ReviewScore Components

  • blocking: Issues that must be fixed before merge (errors, security issues)
  • warnings: Issues that should be addressed (code smells, minor issues)
  • suggestions: Optional improvements (style, performance)

Severity Levels

  • critical: blocking > 0
  • warning: blocking = 0 && warnings > 0
  • info: blocking = 0 && warnings = 0 && suggestions > 0
  • clean: No issues found

Value Objects

Value ObjectPurposeLocation
ReviewRequestStateState machine for ReviewRequest tracking, validates transitionsentities/reviewRequest/
ReviewScoreReview metrics with computed severity (critical/warning/info/clean)entities/review/
DurationTime duration with formatting (2m 5s)entities/

Agents

Claude review uses specialized agents for different aspects:

AgentFocus
clean-architectureArchitecture layer violations
dddDomain-driven design patterns
solidSOLID principles adherence
testingTest coverage and quality
code-qualityGeneral code quality
react-best-practicesReact/frontend specific

Events

Webhook (External): merge_request/pull_request (ReviewRequest changes), push (new commits).

Domain (Internal): ReviewRequested, FollowupRequested, ReviewCompleted, ReviewFailed, ThreadsUpdated.

Abbreviations

MR (MergeRequest), PR (PullRequest), VO (Value Object), ACL (Anti-Corruption Layer) — only in platform-specific or technical documentation contexts. In domain code, always use full terms.

Architecture Patterns

For the full architecture with gateways, adapters, ACLs, and use cases, see Target Architecture.

Released under the MIT License.