Code review¶
This page sets the rules for pull requests and code review in ConnectSoft repositories. It is written for pull request authors and for reviewers, both people and AI agents. The ConnectSoft PR reviewer agent applies these rules and cites the standards by rule ID.
Rules¶
CS-REV-001: The repository owner approves every pull request before merge¶
Severity: major · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual (target: ENF-023) · Status: active
Why¶
The owner is accountable for what reaches the default branch, which is published on every build. An AI review helps the owner but does not replace the owner's decision.
Do¶
- Wait for the owner's approval before merging.
- Treat findings from an AI reviewer as input to the owner's review.
Don't¶
- Merge your own pull request without the owner's approval.
- Let an AI agent approve or merge a pull request.
How to check¶
The pull request shows an approval by the repository owner before the merge.
CS-REV-002: Write each finding with a rule ID, a severity and a location¶
Severity: minor · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active
Why¶
A finding that cites a rule ID links the author to the reason and the fix. A severity tells the author what blocks the merge. A finding without a location or a failure scenario cannot be checked and wastes a review round.
Do¶
- Anchor each finding to a file and line.
- Give a severity:
blocker,major,minorornit. Their meanings are in How a rule is written. - Cite the rule ID, such as
CS-LOG-005, or the defect pattern ID when one applies. - State what goes wrong and when: the concrete input or state that produces the wrong result.
- When no rule covers the finding, say so. A recurring uncited finding is a candidate for a new rule.
Don't¶
- Raise style preferences that no rule covers as
majororblocker. - Report a finding you have not checked against the code, such as a guess about code outside the diff.
Example¶
major · CS-VAL-003 · Orders.DomainModel.Impl/Validators/CreateOrderInputValidator.cs:24
NotEmpty() on Guid? CustomerId accepts Guid.Empty, so an order with an all-zero
customer reaches the repository. Use Must(id => id.HasValue && id.Value != Guid.Empty)
and add a Guid.Empty test.
How to check¶
Each review comment has a location, a severity and either a rule ID or a statement that no rule applies.
CS-REV-003: Resolve blockers and majors before merge¶
Severity: major · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active
Why¶
The severity scale only means something if it decides what merges.
Do¶
- Fix every
blockerbefore merge. A blocker is never waived. - Fix every
major, or have the owner waive it in the review thread with a reason. - Fix
minorfindings when they are cheap. Otherwise record them as a follow-up work item. - Treat
nitfindings as optional.
Don't¶
- Close a blocker or major thread without a fix or a recorded waiver.
How to check¶
At merge, every blocker thread is resolved with a fix, and every major thread with a fix or the owner's waiver.
CS-REV-004: Review the change, and report pre-existing issues separately¶
Severity: minor · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active
Why¶
The standards apply to new and changed code. Existing code is not rewritten just to follow them (see How to apply the standards). A review that blocks on untouched code punishes the author for history they did not write.
Do¶
- Review the lines the pull request adds or changes, plus the code they call or that calls them.
- Report an issue in untouched code as
pre-existing. It never blocks the merge.
Don't¶
- Block a pull request on issues in lines it does not touch.
- Ask for unrelated refactoring in the same pull request.
How to check¶
Every finding in untouched lines is marked pre-existing and does not block the merge.
CS-REV-005: Describe the change, its reason and its risks in the pull request¶
Severity: minor · Applies to: service, library, api-client, blazor, template, docs, pipelines · Enforced by: manual · Status: active
Why¶
The description is what reviewers read first, and what consumers of a package find when a new version behaves differently.
Do¶
The description contains: - what changes and why, in a few sentences; - the linked work item, when there is one; - breaking changes to public APIs, contracts, configuration or database schema, and the version bump they need (see Versioning and release); - changed log message templates (see CS-LOG-006); - how the change was tested.
Don't¶
- Leave the description empty or generated from commit subjects only, when the change is not trivial.
Example¶
Adds a retry to the payment status poller (AB#4412).
Breaking changes: none.
Log templates: new "Payment status poll retry {Attempt} for {PaymentId}".
Tested: unit tests for the retry policy; acceptance test against the test containers.
How to check¶
The pull request description covers each item in Do that applies to the change.
What reviewers focus on¶
Reviewers put their time where defects hide: - domain logic; - authorization and tenant isolation; - validation; - data access and migrations; - concurrency; - public contracts.
Template-generated code that the pull request does not change is not reviewed line by line. When the change updates a template or its generated output, review the template input and check that the output was regenerated, not hand-edited.