Apply these rules to reviews and self-review alongside the project's coding and contribution requirements. Read outside the diff as needed, but report only issues introduced by the change. Verify findings against code, tests, and documentation; do not report speculation or repeat an existing discussion without a new regression.
For each finding, identify the defect, provide concrete evidence, explain the consequence, and ask the author to address it. Leave implementation choices to the author; do not provide replacement code, documentation, or patches unless requested.
For documentation changes, check sources and links. Inspect rendered pages or build artifacts only if already available; do not start a local documentation build solely for this checklist. Do not report a rendering-dependent finding as verified without rendered output.
Before reviewing a changed file, read its opening comment block, even if absent from the diff; for deleted files, read the previous revision. Skip findings on output identified by its header as generated, and review changed schemas, generators, and templates instead. Recognize banners such as:
Allow variations in case, whitespace, and comment syntax without requiring AUTOGENERATED. Templates such as .jinja remain in scope even if they contain a future output banner; ordinary references to generation do not make a file generated.
Carry the review through to completion in the current task. After each finding or progress update, continue with the remaining work on your own. Whenever you can name an authorized next step, take it before giving a final answer.
Before finishing, compare what you reviewed with the full requested scope. Account for every changed file in scope, apply the relevant review rules, and finish investigating each potential finding.
If a review item cannot be verified with the available evidence, skip it and immediately review the next item.
Check backward compatibility even when there are no callers in this repository. Public headers live under */include/userver/ and are included as <userver/...>; impl and detail are internal. Use documentation to identify other user-facing interfaces. Compare old and new contracts for:
A private implementation change alone is not an API violation. For each finding, show a previously valid call, interface implementation, or configuration that breaks, and explain why. Request restored compatibility or, for intentional breakage, a migration guide identifying the affected API and user migration steps. Do not choose the new API or design compatibility wrappers for the author. Respect migrations documented in the change description and the deprecation policy; do not require preservation beyond that policy or assume ABI guarantees without evidence.
Avoid duplicating logic. For added or changed helpers and repeated logic, look for suitable public userver::utils functions in universal/include/userver/utils/, core/include/userver/utils/, then the module's dependencies. Read candidates' declarations, implementations, and tests; similar names do not imply equivalence.
Suggest reuse only when it preserves semantics and simplifies code. Check missing-value and error handling, constness, ownership, lifetime, copies, allocations, complexity, and module availability. Do not add a higher-layer dependency solely for reuse or suggest deprecated, impl, or detail entities. Name the function and public include header and explain why they fit. Do not report unsuitable alternatives or request changes to unchanged code outside the diff.
Keep documentation concise and easy to understand; use @brief where possible.
Check that each new public method, including overloads, documents its contract. Special member functions may omit doc comments under the rule in section 18. Check that each added or changed enum value documents its meaning. Update documentation when contracts change. Read declarations, implementations, tests, and documentation before reporting gaps. Accept inherited documentation or working Doxygen references that fully cover the contract instead of requiring duplicate prose.
In added or changed Doxygen prose, reference userver entities with fully qualified @ref targets, including namespaces, and verify that they resolve correctly. Exclude identifiers in code examples and literal configuration values. In self-referential headings such as a component's "Static options", use the fully qualified type name as plain text to avoid Doxygen recursion warnings.
Do not use @code blocks. Code examples must use @snippet from code built and exercised by tests; verify the file and markers. Explicitly labeled illustrative output and pseudocode are not executable API examples.
Identify the undocumented contract, missing or incorrect reference, or untested example, and explain the unclear behavior, missing API navigation, or risk of example drift that the author should address.
## 4. Make ownership clear and avoid unnecessary copies
Use values or std::unique_ptr for owned objects, and std::shared_ptr only when shared ownership is required. For every added std::shared_ptr, verify that more than one owner must extend the object's lifetime; otherwise request a value or std::unique_ptr. For borrowed objects, use references when their lifetime is guaranteed.
For clients provided by component dependencies, a reference is usually sufficient, including as a member: the component system guarantees that these clients outlive the component using them. See References from components and lifetime of clients.
At copy-producing ownership transfers in added or changed code, check whether moving at the source's last use avoids a nontrivial copy without changing behavior. Inspect the type, constness, selected overload, and callee's ownership contract; an lvalue alone does not prove a copy.
Verify that the source is no longer needed on all affected paths, including aliases, captures, cleanup, and exception handling. Do not suggest moving borrowed values, values still needed by their owner, scalars, const sources that would still be copied, or arguments to borrowing calls. Do not wrap returned locals in std::move when that prevents copy elision. Identify the actual copy and explain why the final use can transfer ownership without changing the contract.
## 5. Keep public headers minimal and self-contained
Check whether implementation details in public headers can move to src/, including those in impl or detail namespaces. Keep definitions visible only when required by templates, constexpr evaluation, inline behavior, or type completeness.
Prefer utils::FastPimpl when hiding implementation details.
Check affected includes against declarations, inline definitions, templates, macros, and complete-type requirements. Include direct dependencies; never rely on transitive includes. Dependencies needed only out of line belong in the source. Respect intentional, documented umbrella headers; preserve the public API and behavior.
Name each unnecessary exposed detail or include, explain its added dependency or exposure and why consumers do not need it, and request extraction to src/ or removal while preserving a self-contained header.
## 6. Follow the PR style guide
Check the title and description against the conventions below, distinguishing requirements from recommendations. Do not report personal wording preferences. Explain a violation's consequence for reviewers or public release notes.
### PR titles and descriptions
Write titles and descriptions in English for public readers and release notes. Use public issue links for context; omit private identifiers, private links, and organization-specific tooling details, and do not request them in review.
#### Title
Use type component: message. Prefer at most 72 characters for readable GitHub listings; clarity takes precedence over this recommendation.
| Type | Use for | | -— | ----— | | bug | Fixing a noticeable bug. | | fix | Fixing a bug. | | feat | Adding publicly visible functionality. | | refactor | Substantially changing code without adding functionality. | | typo | Trivial typos or minor corrections that do not belong in release notes. | | cc | Coding conventions, comments, documentation, or userver's own tests. |
Choose the component primarily affected:
Describe the PR's result in the imperative (fix, add, remove, not fixes, added, removed), completing "If applied, this change would ...".
Bad: logging: fixed message formatting omits the change type and uses a past-tense message.
Good: fix logging: correct message formatting identifies the change type and component and describes the change in the imperative.
#### Description
Explain the problem and resulting behavior; a linked public issue that fully explains the change can replace the description. Separate the description from the title, and optional trailers from the description, with blank lines.
Put any needed Changelog entry: and Migration guide: sections first. Omit unneeded sections entirely, without placeholders or no-entry statements. Keep the text consistent with the final diff and include the same sections in the integration commit message: the release tool reads commit messages. When updating a PR, preserve author-written text unless the final change makes it inaccurate.
Separate these sections from the detailed description with a standalone ---, surrounded by blank lines. If neither section is needed, start directly with the description.
Write the detailed description after --- in Markdown. When the optional sections are omitted, use Markdown for the entire description:
Add context, rationale, or implementation explanations in paragraphs when they are not evident from the diff. Keep the prescribed Doxygen syntax in the Changelog entry: and Migration guide: sections.
Do not edit release changelog files or run release-wide generation just to prepare a PR description.
Prefer public issue links over Relates: trailers; this trailer is not required. Do not add a Validation section or another "how tested" section to PR descriptions. Report performed checks and material limitations in the handover chat instead.
## 7. Check algorithmic complexity
Determine time and space complexity of added or changed algorithms, stating what the input sizes represent. Include work in callees and container operations, repeated searches, copies, and allocations. Nested loops alone do not prove quadratic complexity; check total work.
For O(N * N) time or worse, suggest an improvement or explicitly request one. Verify that alternatives preserve behavior and account for their memory cost. If input bounds or requirements prevent improvement, explain the constraint instead of claiming an unsuitable alternative is equivalent. For example, an index replacing repeated searches must preserve duplicate handling and ordering.
## 8. Extract template-independent implementation
For large template classes, identify state and methods independent of template parameters. Where behavior is preserved, extract them into a non-template impl class stored as a member of the original class, with method definitions in a .cpp file to avoid repeated parsing and instantiation by consumers.
Check ownership, lifetime, layout requirements, and dependencies. Keep definitions visible when required by template instantiation or constexpr evaluation, and preserve the public API and semantics. Identify the state or methods that can be extracted and explain why they can move out of the header.
## 9. Prefer meaningful enums and structs to ambiguous parameters
Avoid bool function parameters where possible: boolean arguments make call sites hard to read because their meaning is hidden in the function declaration. Use enums with meaningful values instead. As an illustrative example, replace Call(true, false) with Call(kHighPriority, kReadOnly), where kHighPriority and kReadOnly are enum values describing the requested behavior.
If a function, a method or a constructor takes parameters that tune its behavior, pass them as one struct with named fields. Then a call site names every value, for example Connect(host, {.timeout = 1s, .max_retries = 3}).
## 10. Write clear and defensive code
Use modern C++20 and established project practices. Make contracts explicit and use defensive checks. Check invariants with UASSERT and UASSERT_MSG from <userver/utils/assert.hpp>. Configuration errors must be informative and include hints on how to fix them where possible. Avoid no-op code, which can be misleading. Do not conflate absent, null and empty values when they mean different things, e.g. a missing JSON field, an explicit null and "".
Keep code simple and self-explanatory: use clear names and small, focused functions. Replace magic numbers and strings with named constexpr constants or equivalents. Code comments should clarify intent, rationale, and contracts rather than paraphrase the implementation. Explanations of how the implementation works are appropriate for non-obvious implementation details.
## 11. Tests
Follow Writing tests.
## 12. Use userver synchronization and I/O primitives
Do not use C++ standard library or libc synchronization or blocking I/O on the main task processor. Use userver primitives instead; see The Basics and Synchronization Primitives.
## 13. Keep production changes focused
Check whether the production-code diff can be reduced without compromising functionality, performance, or readability. Exclude tests and documentation from this check.
## 14. Use fmt for formatting
Use the fmt library for formatting instead of std::format and similar APIs. Build strings with fmt::format. Standalone integer conversions may use std::to_string. Format floating-point values with fmt.
## 15. Protect component-lifetime tasks from overload cancellation
When a component starts a non-critical task with an Async variant, check whether the task is expected to keep running until the component is destroyed, for example in a loop that stops only during component shutdown. If task processor overload cancellation is enabled, the cancellation can make the task exit permanently and stop the work it performs.
Report this risk when the task has no restart mechanism. Ask the author to use the corresponding CriticalAsync variant or override USERVER_TASK_PROCESSOR_QOS for the relevant task processor so overload does not cancel the task.
## 16. Check behavior on errors, cancellation and concurrency
For added or changed code paths, check that:
## 17. Keep logs and metrics useful
Log a failure once, at the level that handles it, rather than on every layer it passes through. Do not log unbounded data, personal data or secrets. Metric labels must have bounded cardinality: no user ids, request ids or other unbounded values. Metric names and descriptions must match what is actually measured.
## 18. Follow local code formatting conventions
Separate USERVER_NAMESPACE_BEGIN and USERVER_NAMESPACE_END from adjacent code, leave a blank line after a namespace opening, and separate member function declarations with a blank line, except for the special member functions below.
Special member functions may omit doc comments when they have no special behavior that needs explaining. Place them consecutively after ordinary constructors, in this order: copy constructor, move constructor, copy assignment, move assignment, destructor. Do not put blank lines within this group.
During code review or self-review, check these separators explicitly; formatter success alone does not establish compliance with local spacing conventions.
## 19. Qualify free function calls in headers
In header files, qualify calls to free functions with their namespace, even when the function is declared in the current namespace, to prevent unintended argument-dependent lookup (ADL). Unqualified calls can find unrelated overloads in argument types' namespaces, causing ambiguity or changing behavior. Keep unqualified calls only where ADL is an intentional customization mechanism.
-------—