name: deep-review description: Deep, production-critical review workflow for TiKV changes. Use when asked to review a PR, branch, commit range, or diff in this repository and produce a markdown review report with findings, risk analysis, and TiKV-specific validation results.
Deep Review
Goal
Produce a production-critical review for TiKV that:
- explains the problem being solved
- explains how the change works in concrete code terms
- identifies correctness, safety, performance, and operability risks
- follows TiKV repository rules from
AGENTS.md - writes the review to a markdown file under the target folder
- runs the repo-prescribed formatting and lint checks from
./Makefile
Inputs and Defaults
- Determine the repository root and run all commands from that root.
- Determine the target output folder.
- If the target folder is not provided, use
./target. - If the filename is not provided, use
review-report-YYYYMMDD-<summary>.md. - Do not overwrite an existing report. Choose a distinct filename instead.
TiKV-Specific Rules
- Treat
make formatandmake clippyas the authoritative static checks because TiKV’sMakefileadds required setup and repository-specific scripts. - Do not substitute raw
cargo clippyformake clippyunless the user explicitly asks for a narrower check. - Read
AGENTS.mdbefore judging engineering-rule compliance. - When unfamiliar code appears, read the surrounding subsystem rather than inferring from symbol names alone.
- Respect a dirty worktree. Never revert unrelated user changes while fixing review-discovered issues.
Workflow
Confirm inputs
- Identify the repository root, target output folder, and output filename.
- If the review scope is not explicit, use the current branch diff against
origin/HEAD.
Collect the change set
- Prefer the diff provided by the user.
- Otherwise run
git diff origin/HEAD...HEADfrom the repository root. - If
origin/HEADis unavailable or the diff command fails, stop and ask for guidance.
Understand the intent
- Read the PR description, issue link, commit messages, or nearby code comments when available.
- State the concrete system problem the change is trying to solve.
- If intent is still unclear, infer from code and label the inference as an assumption.
Read the affected TiKV subsystems
- Follow changed code into the owning modules, not just the diff hunk.
- Typical subsystems include:
src/storage,src/storage/mvcc,src/storage/txnsrc/servercomponents/raftstore,components/raftstore-v2components/cdccomponents/pd_clienttests/
- Read enough nearby code to understand invariants, concurrency assumptions, error propagation, and test coverage.
Explain how the change works
- Walk through each non-trivial logic change.
- Explain control flow, data flow, state transitions, and failure paths in plain language.
- Reference concrete files, symbols, and lines when discussing findings.
Evaluate costs and negative impacts
- Explicitly assess:
- correctness
- security
- robustness and failure modes
- compatibility and behavioral shifts
- CPU cost
- memory cost
- log volume or log-signal quality
- operability and debuggability
- cognitive load and maintainability
- Explicitly assess:
Run TiKV static validation from
./Makefile- Run
make formatfrom the repository root. - Then run
make clippyfrom the repository root. - Treat the
Makefilebehavior as part of the review:make formatrunspre-format, which installsrustfmtand bootstraps the pinnedcargo-sortversion before runningcargo fmtandcargo sortmake clippyruns repository checks including redact-log, log-style, dashboards, docker-build, license, deny, and finallyscripts/clippy-all
- If
make formatormake clippyreports code issues in the working tree:- inspect the failing files
- fix the errors when the fix is local and safe
- rerun the failing command
- If
make clippyfails inscripts/deny, record that separately from Rust lint results becauseclippy-allmay not have run yet. - If the failure is environmental, toolchain-related, or blocked by unavailable external dependencies:
- record the exact blocker in the report
- do not claim the code passed
- Do not revert unrelated user changes while making fixes.
- Run
Check engineering rules
- Verify alignment with
AGENTS.md, especially:- repository-specific build and test entrypoints
- required validation expectations such as
make dev - PR-title, issue-link, and release-note requirements when relevant to the review
- Verify alignment with
Write the review output
- Write a markdown report under the target folder.
- If no findings exist, say so explicitly.
- Still document residual risks, assumptions, and any validation gaps.
Review Output Template
### Deep Review
#### Problem Summary
- [Explain the concrete problem the change targets]
#### Solution Walkthrough
- [Explain how the change solves the problem; cover all non-obvious logic]
#### Findings (ordered by severity)
- [Issue or risk with file/line references]
#### Costs and Negative Impacts
- Correctness:
- Security:
- Compatibility:
- Robustness:
- Operability:
- Cognitive Load:
- CPU:
- Memory:
- Log Volume:
#### Static Validation
- `make format`:
- `make clippy`:
#### Engineering Rules Check
- [List code or process mismatches against `AGENTS.md`, or "None"]
#### Questions and Assumptions
- [List unknowns or assumptions made]
#### Suggested Tests / Validation
- [Targeted tests or checks to validate behavior]