Clean only the current branch diff before review. Preserve behavior absolutely:
this is a narrow pre-review polish pass, never a correctness, safety, or
documentation review.
-
Refresh and establish the exact review range before inspecting code:
git fetch origin main
git merge-base origin/main HEAD
git diff origin/main...HEAD
Use origin/main...HEAD when the merge base is origin/main; otherwise
inspect the merge-base-to-HEAD diff. Never turn this into a repository-wide
search, lint cleanup, or formatting pass.
-
Read every changed hunk with enough surrounding code to determine its local
convention and observable contract. Inspect additions for the slop categories
below. Let existing analyzer diagnostics stand; this pass finds what analyzers
cannot prove.
-
Classify a finding before editing. Remove it inline only if the edit is
trivial and demonstrably behavior-neutral. Preserve API shapes, exceptions,
execution order, resource lifetime, console output, process arguments,
serialization, and PowerShell failure behavior. If any of those could
change, leave the code intact and name the concern for the author.
-
For a C# cleanup, preserve the repository analyzer policy. Directory.Build.props
enables AnalysisMode=All, build-time code-style analysis, and
TreatWarningsAsErrors; rule severities belong in .editorconfig. Never
weaken a rule repository-wide to clear one site. A necessary narrow
suppression needs a written rationale beside the code.
-
For clawctl output, retain the renderable composition contract in
src\OpenClaw.Launcher\ClawCtlConsole.cs: use Spectre.Console renderables
such as Grid, Panel, Paragraph, and Rows, with Paragraph.Append
for styled text. Do not replace that with interpolated markup strings; it
changes escaping and rendering behavior described in
docs\clawctl-output-style.md.
-
For tests in the diff, retain observable assertions. Do not add or preserve
tests that read source files for implementation-string markers. Keep tests
isolated from real user state and deterministic: no sleeps, hardcoded ports,
or inter-test ordering dependencies.
-
Do not treat launcher argument handling as cleanup territory. openclaw
arguments are OpenClaw-owned: do not add host-only switches, consume --, or
rewrite the argument vector.
-
Preserve LF text. Do not use whole-file Set-Content or Out-File rewrites;
.gitattributes and .editorconfig require tracked text to stay LF.
-
Verify only after every edit is complete:
git diff --check
.\scripts\Test-DotNetQuality.ps1
dotnet test .\OpenClaw.Gateway.MSIX.slnx --configuration Release --no-restore
git ls-files --eol
Re-read the final diff against the same merge base. Do not claim a cleanup
was safe merely because it compiles.
-
Report in a few sentences: state whether anything changed, name each
non-trivial item left for the author, and say that code review remains the
required correctness and safety gate.