Repository navigation
refactor(tests): reuse setup runtime fixtures - #139920
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 4:10 AM ET / 08:10 UTC. ClawSweeper reviewWhat this changesThe setup-command tests reuse the existing runtime-spy factory at 17 allocation sites while preserving their scenarios and assertions. Merge readiness✅ Ready for maintainer review Keep open: this is a focused, behavior-preserving cleanup that remains absent from current main. No actionable correctness findings were identified; the maintainer-authored, protected PR is not eligible for automatic closure. Priority: P3 Review scores
Verification
How this fits togetherBaseline setup initializes OpenClaw configuration, workspace, and session directories. These tests supply temporary configuration and runtime spies to check setup results and failure handling. flowchart LR
A[Setup test scenarios] --> B[Temporary configuration]
A --> C[Fresh runtime spies]
B --> D[Baseline setup command]
C --> D
D --> E[Configuration and directory results]
D --> F[Logs and exit calls]
E --> G[Existing assertions]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -35. Total -35 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep setup coverage intact while using the existing fresh-spy factory at each original allocation site. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates test fixtures rather than fixing a reported runtime defect. Is this the best way to solve the issue? Yes: reusing the existing factory removes repetition without adding abstractions, sharing mutable spies between cases, or weakening assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 976fde6ae1d0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Setup command tests repeat the same three-spy runtime fixture in 17 places, adding maintenance work without distinct scenario coverage.
Why This Change Was Made
Reuse the existing command test runtime factory at each original allocation site. This removes 35 net test lines while preserving every input, assertion, and case. The helper stays unchanged; it creates fresh spies, has no output writers, and keeps exit non-throwing.
User Impact
No production behavior change. Setup tests keep their existing coverage with less repeated fixture code.
Evidence
All 64 setup and CLI setup-registration cases pass before and after. Full changed-file checks and independent review through P2 pass. Exact replacement normalization confirms all source outside the 17 literals and added import is unchanged. The helper's exit arity and explicit default implementation differ from an empty spy, but setup and these tests do not inspect either distinction.