Skip to content

test(cli): reuse canonical directory mock call helper - #137640

Merged
steipete merged 1 commit into
mainfrom
codex/test-directory-mock-call-guard
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-directory-mock-call-guard

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The directory CLI tests had a local wrapper duplicating the shared mock-call helper. Reuse mockCall while retaining the existing falsy, object and non-array guards, all ten payload reads, and the existing config, secret-scope and output assertions.

Production code is unchanged; tests shrink by seven lines. The same 35 cases passed before and after, with no skips; all 20 normal local changed checks and Codex P2 review passed. Per-file and observed case order matched, without changing the canonical scheduler.

Remove duplicated call-presence retrieval while preserving the directory tests'
stronger record guard and all payload assertions.
@steipete
steipete marked this pull request as ready for review September 3, 2026 23:21
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Sep 3, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 7:30 PM ET / 23:30 UTC.

ClawSweeper review

What this changes

The PR replaces a local directory-CLI test helper with the shared mock-call assertion helper.

Merge readiness

✅ Ready for maintainer review

No blocking findings. This small maintainer-owned test refactor preserves the first-call and record-validation behavior while removing duplicated test support; the protected maintainer label means it remains for normal maintainer handling rather than automated closure.

Priority: P3
Reviewed head: dab032fc4a4f8c0ad67c6f1fac539a1a89b289dc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A clean, narrowly scoped test-support deduplication with preserved assertions and no identified correctness or security concern.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR changes only src/cli/directory-cli.test.ts; no user-visible runtime behavior changed and the external-contributor real-behavior gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR changes only src/cli/directory-cli.test.ts; no user-visible runtime behavior changed and the external-contributor real-behavior gate does not apply.
Evidence reviewed 4 items Introduced test-only change: The verified PR delta only imports the shared helper and replaces the local first-call retrieval; the local record guard remains intact.
Shared helper contract: The current-main helper reads call zero by default and throws when that call is absent, matching the local helper's relevant control flow before the retained record guard validates argument shape.
Current-main area history: Recent history for the directory CLI test includes multiple directory and CLI fixes by the routing candidate, including a setup/config preservation change.
Findings None None.
Security None None.

How this fits together

Directory CLI tests invoke registered CLI commands against mocked runtime services and inspect their recorded calls. The shared helper retrieves the requested mock invocation, after which the directory test retains its own record-shape assertions.

flowchart LR
  A[Directory CLI test] --> B[Mocked runtime service]
  B --> C[Recorded mock calls]
  C --> D[Shared call assertion helper]
  D --> E[Test-specific record guard]
  E --> F[Payload assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -7. Total -7 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 2 9 -7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 2 9 -7

Review metrics

Metric Value Why it matters
Production versus test delta production 0, tests -7 The entire change is confined to test support and reduces duplicate test code.

Technical review

Best possible solution:

Keep one canonical mock-call retrieval helper and retain the directory test’s narrower record guard for payload-shape assertions.

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

Not applicable: this PR refactors test support and does not report a user-facing defect.

Is this the best way to solve the issue?

Yes. The shared helper preserves first-call retrieval and missing-call failure, while the local record guard continues to enforce the directory tests’ value-shape contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a low-risk test-only cleanup with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR changes only src/cli/directory-cli.test.ts; no user-visible runtime behavior changed and the external-contributor real-behavior gate does not apply.

Label justifications:

  • P3: This is a low-risk test-only cleanup with no production behavior 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-authored PR changes only src/cli/directory-cli.test.ts; no user-visible runtime behavior changed and the external-contributor real-behavior gate does not apply.

Evidence

What I checked:

  • Introduced test-only change: The verified PR delta only imports the shared helper and replaces the local first-call retrieval; the local record guard remains intact. (src/cli/directory-cli.test.ts:74, dab032fc4a4f)
  • Shared helper contract: The current-main helper reads call zero by default and throws when that call is absent, matching the local helper's relevant control flow before the retained record guard validates argument shape. (src/test-utils/mock-call-assertions.ts:5, f1eb466dad64)
  • Current-main area history: Recent history for the directory CLI test includes multiple directory and CLI fixes by the routing candidate, including a setup/config preservation change. (src/cli/directory-cli.test.ts, 2c9a5d6addd7)
  • Exact-head checks: The supplied GitHub context records successful changed-node, lint, type, contract, dependency, and security checks for the PR head; no failing relevant check is shown. (dab032fc4a4f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete steipete self-assigned this Sep 3, 2026
@steipete
steipete merged commit 3d12959 into main Sep 3, 2026
174 checks passed
@steipete
steipete deleted the codex/test-directory-mock-call-guard branch September 3, 2026 23:46
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 4, 2026
…date-command

* origin/main:
  fix(ci): retry transient npm advisory timeouts (#137716)
  fix: keep restored Usage navigation from being replaced by Chat (#137402)
  fix: keep Usage day totals within the selected session scope (#137396)
  refactor: reduce live digest scheduling allocations (#137655)
  fix(ui): submit selected slash arguments in new sessions (#137571)
  fix(ui): expand collapsed task progress on final (#137569)
  fix(test): prevent auth discovery from stalling MCP replacement proof (#137639)
  test(cli): reuse canonical directory mock call helper (#137640)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
Remove duplicated call-presence retrieval while preserving the directory tests'
stronger record guard and all payload assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes 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: XS 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