Skip to content

refactor(gateway): consolidate doctor test fixtures - #118478

Merged
steipete merged 1 commit into
mainfrom
codex/refactor-doctor-test-fixtures
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/refactor-doctor-test-fixtures

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The 1,867-line doctor RPC test suite repeated method invocation plumbing, memory-manager mocks, and dense dreaming-entry fixtures. That repetition made the suite harder to audit while extending doctor memory behavior.

Why This Change Was Made

This maintainer-requested cleanup replaces the repeated setup with one typed doctor invocation helper plus typed memory-manager and dreaming-entry fixture builders. It preserves all 45 test titles and their order, exact request parameters, cron-context presence, response assertions, status/error strings, mocks, environment handling, and cleanup. Production code and product behavior are unchanged.

AI-assisted: yes. The diff was implemented and verified with Codex, including an isolated gpt-5.6-sol xhigh autoreview.

User Impact

No user-visible impact. Maintainers get the same doctor RPC coverage with 156 fewer net test lines and fewer fixture shapes to keep synchronized.

Evidence

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 3, 2026
@steipete
steipete marked this pull request as ready for review August 3, 2026 04:55
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 3, 2026, 1:11 AM ET / 05:11 UTC.

ClawSweeper review

What this changes

The PR replaces repeated Gateway doctor-memory test invocation plumbing and dream-memory fixture construction with typed shared helpers in the doctor RPC test suite.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This is a focused, test-only cleanup that preserves the doctor RPC test contract while consolidating repeated invocation and fixture setup. The refreshed head has no actionable correctness or security finding; keep it open for normal maintainer merge review. Likely related people: steipete (high confidence).

Priority: P3
Reviewed head: 63b89fe1164b5cafa64fd323223a630534f0c3f4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-only refactor with preserved named coverage, an aligned handler contract, and reported focused validation; no code defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-requested, test-only refactor has no user-visible runtime behavior to demonstrate; focused regression runs and the preserved test contract are the appropriate proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-requested, test-only refactor has no user-visible runtime behavior to demonstrate; focused regression runs and the preserved test contract are the appropriate proof.
Evidence reviewed 5 items Consolidated test boundary: The proposed helper centralizes invocation of the seven doctor-memory target methods plus the REM harness, preserving request, response, runtime-context, and optional cron setup in one typed path.
Current handler contract: Current main reads scheduler state only through the memory-status flow; the other doctor-memory handlers resolve the target workspace and call their memory operation without cron access, matching the shared helper’s conditional cron context.
Test-contract preservation: The ordered describe/it title extraction from the PR base and head was identical, so the refactor retains the suite’s named coverage surface.
Findings None None.
Security None None.

How this fits together

Gateway doctor RPC handlers process diagnostic and memory-maintenance requests using runtime configuration, optional scheduler data, and the memory subsystem. This PR changes the test harness that supplies those inputs and checks the handlers’ responses; production request handling is unchanged.

flowchart LR
  Client[Diagnostic RPC request] --> Handler[Gateway doctor handler]
  Handler --> Runtime[Runtime configuration]
  Handler --> Scheduler[Optional scheduler status]
  Handler --> Memory[Memory maintenance services]
  Memory --> Reply[Diagnostic response]
  Tests[Shared test helpers] --> Handler
Loading

Before merge

  • Add real behavior proof - Not applicable: This maintainer-requested, test-only refactor has no user-visible runtime behavior to demonstrate; focused regression runs and the preserved test contract are the appropriate proof.
  • Complete next step (P2) - No repair lane is needed because the review found no concrete patch defect; this protected maintainer-review PR should proceed through normal exact-head merge gating.
Agent review details

Security

None.

PR surface

Tests -156. Total -156 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 197 353 -156
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 197 353 -156

Review metrics

Metric Value Why it matters
Production versus test LOC production +0, tests -156 The entire patch is in the doctor test suite and reduces repeated fixture code without expanding runtime behavior.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/gateway/server-methods/doctor.test.ts, unknown-data-model-change: src/gateway/server-methods/doctor.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Merge the shared test helpers if the final exact-head merge and required checks remain clean; retain the handler-facing test cases and their existing response assertions as the canonical behavior contract.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR refactors test fixtures rather than reporting a user-facing defect. The relevant verification is preservation of the existing doctor-handler test contract, which source comparison supports.

Is this the best way to solve the issue?

Yes: a single typed invocation helper with conditional cron context matches the current handler boundary and removes duplicate fixture shapes without changing production behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b58b2057a340.

Labels

Label justifications:

  • P3: This is a low-risk test-maintenance refactor with no claimed user-visible or production-runtime change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-requested, test-only refactor has no user-visible runtime behavior to demonstrate; focused regression runs and the preserved test contract are the appropriate proof.

Evidence

What I checked:

  • Consolidated test boundary: The proposed helper centralizes invocation of the seven doctor-memory target methods plus the REM harness, preserving request, response, runtime-context, and optional cron setup in one typed path. (src/gateway/server-methods/doctor.test.ts:76, 63b89fe1164b)
  • Current handler contract: Current main reads scheduler state only through the memory-status flow; the other doctor-memory handlers resolve the target workspace and call their memory operation without cron access, matching the shared helper’s conditional cron context. (src/gateway/server-methods/doctor.ts:616, b58b2057a340)
  • Test-contract preservation: The ordered describe/it title extraction from the PR base and head was identical, so the refactor retains the suite’s named coverage surface. (src/gateway/server-methods/doctor.test.ts:1, 63b89fe1164b)
  • Feature-history provenance: Blame on the current test helper area attributes the preceding fixture consolidation to the same area contributor; the PR head then applies the doctor-fixture consolidation. This makes steipete the clearest routing candidate for the test surface. (src/gateway/server-methods/doctor.test.ts:74, bd3c2b8f496b)
  • Validation reported for the reviewed head: The PR body reports focused 45/45 doctor-test runs after the change and after rebase, plus a successful Blacksmith Testbox run; the supplied check context also shows the changed-boundary, gateway-runtime, lint, type, dependency, and security checks succeeding. A local diff-integrity rerun was unavailable because this partial checkout attempted to fetch a missing promisor object while network DNS was unavailable. (src/gateway/server-methods/doctor.test.ts:1, 63b89fe1164b)

Likely related people:

  • steipete: Current-main blame attributes the adjacent doctor test-fixture refactor to this contributor, and the reviewed head is the subsequent focused doctor-fixture consolidation. (role: recent area contributor; confidence: high; commits: bd3c2b8f496b, 63b89fe1164b; files: src/gateway/server-methods/doctor.test.ts, src/gateway/server-methods/doctor.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-03T05:00:10.184Z sha 2aa706e :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/refactor-doctor-test-fixtures branch from 2aa706e to 63b89fe Compare August 3, 2026 05:06
@steipete
steipete merged commit 0fadfc6 into main Aug 3, 2026
95 checks passed
@steipete
steipete deleted the codex/refactor-doctor-test-fixtures branch August 3, 2026 05:12
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant