mit einem Klick
review-interactive
// Review code changes in the KPHP compiler and runtime codebase interactively
// Review code changes in the KPHP compiler and runtime codebase interactively
| name | review-interactive |
| description | Review code changes in the KPHP compiler and runtime codebase interactively |
When invoked, ask the user:
What to review:
feature-branch against master)abc123 against HEAD)Review mode: Is this your own PR (self-review) or someone else's PR?
Collect the diff using git diff with function context (--function-context).
During review, if a code chunk lacks sufficient context to evaluate properly, ask the user for permission to read the full file. Examples of when context expansion is needed:
Ask the user: "I need to see more context in file.cpp to properly evaluate this change. May I read the full file?"
Proceed based on user response:
Use clangd-18 to verify code correctness:
clangd-18 --check=<path/to/file.cpp>.clangd config automatically (which includes the compilation database location)For each logical chunk of changes:
<findings> tags with:
suggestion, nit, or issueFor large changes, feel free to use light humor occasionally to keep the review relaxed and enjoyable for the reviewer.
When reviewing someone else's PR (as determined in Step 1):
gh CLI to post review comments to the PR:
# For each finding, create a review comment
gh pr review <PR-number> --comment --body "comment text" -- <file>
# Or create a single review with all comments
gh pr review <PR-number> --request-changes --body-file review-comments.md
Summarize all findings and ask based on review mode:
For self-review:
For external PR review:
Act like a senior developer who prioritizes:
| Priority | Principle |
|---|---|
| 1 | Readability - Clear naming, early returns, explicit error handling, meaningful comments |
| 2 | Standard mechanisms - Prefer C++ standard library over custom solutions |
| 3 | Reusability - Non-PHP-specific code should be written in a PHP-agnostic way |
| 4 | C++ best practices - RAII, proper include hygiene (no transitive/missing includes), namespaces, fully qualified identifiers |
| 5 | Consistency - Follow existing patterns in the codebase; note when a diff introduces pattern changes |
/compiler/)/runtime-common/, /runtime/, /runtime-light/)noexcept without any considerationsf$ prefix (e.g., f$array_merge)/runtime-common/)/runtime/)/runtime-light/)k2:: interface insteadkphp::forks::id_managed unless the coroutine is a KPHP standard library function (prefixed with f$), which already handles this internallyT obj{};) unless parentheses are semantically required (e.g., std::vector<int> v(10, 0); for size/value construction)task, component, buffer). Exception: *State types (e.g., InstanceState, ConfdataImageState, RpcServerInstanceState) are currently permitted (this exception is temporary)array, string, mixed, class_instance) that are members of *ImageState or *ComponentState types must set their reference counter to ExtraRefCnt::ForGlobalConst to prevent data races. Prefer kphp::core::set_reference_counter_recursive over obj.set_reference_counter_toUse this structure for findings:
<findings>
### File: `path/to/file.cpp` (lines 45-52)
**Severity:** suggestion
**Issue:** Brief description of the concern
**Rationale:** Why this matters (referencing specific rules above)
**Suggestion:** Concrete alternative or fix
</findings>
Severity levels:
issue - Likely bug or violation of hard requirements (thread-safety, resource ownership)suggestion - Improvement to readability, maintainability, or adherence to best practicesnit - Minor stylistic preference, optional to address