Skip to content

refactor(logging): remove redundant stderr spy casts - #137238

Merged
steipete merged 1 commit into
mainfrom
codex/test-logging-stderr-spy-casts
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-logging-stderr-spy-casts

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Four stderr spies use double type assertions even though the stream write method already returns boolean.

Why This Change Was Made

Return true directly, matching the existing transport and console test pattern. The two files retain all nine scenarios and every assertion, queue drain and cleanup step. Production code is unchanged; test code decreases eight lines.

User Impact

No runtime behavior changes. Environment warning deduplication, JSON diagnostics, file rotation and continued writes remain covered, along with the existing transport durability, privacy and console error-handling tests.

Evidence

  • The same four complete canonical suites passed on baseline and candidate: 53 tests each, with identical per-file ordered cases.
  • The full normal two-file changed gate passed, including services test typechecking, formatting, lint, repository guards and all three dead-export scans.
  • Independent Codex review through P2: scoped-clean, no findings.
  • The installed dependency graph matched the source lock. The selected stale Vitest cache was cleared once through its normal command before baseline; no install, dependency change or cache override was needed.
  • Hosted CI has not run for this unpublished candidate.

Use the existing boolean stderr spy pattern in the environment and file-cap tests. Preserve all nine scenarios, assertions, queue drains and cleanup while removing four unnecessary double assertions.
@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.

@steipete
steipete marked this pull request as ready for review September 3, 2026 10:11
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels 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, 6:18 AM ET / 10:18 UTC.

ClawSweeper review

What this changes

The PR replaces four doubly asserted stderr test spies with direct boolean-returning spies in two logging test suites.

Merge readiness

✅ Ready for maintainer review

Keep open. This fresh, maintainer-labeled PR is a correct, behavior-neutral test cleanup; the current main revision still has the redundant casts and no blocking correctness or security concern was found.

Priority: P3
Reviewed head: 531fdb21c38e05ba94e86a9225a7a51fc6c3af84

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-only cleanup aligned with an established local pattern.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only cleanup does not change production behavior, so real-behavior proof is not applicable.
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, test-only cleanup does not change production behavior, so real-behavior proof is not applicable.
Evidence reviewed 4 items Verified introduced scope: The pinned introduction changes only four test spy return expressions in two test files; it does not alter production logging code or assertions.
Current main has not absorbed cleanup: The fetched current-main revision retains the prior doubly asserted stderr spy in this suite.
Owner boundary and existing pattern: The changed spies observe stderr diagnostics emitted by environment validation and file transport; the sibling file-transport tests already use the same direct boolean spy form.
Findings None None.
Security None None.

How this fits together

OpenClaw logging writes diagnostic output to stderr for invalid log-level configuration and file-log transport failures. The changed tests intercept that output while preserving assertions over those diagnostic paths.

flowchart LR
  Config[Logging configuration] --> Env[Environment validation]
  Config --> Transport[File log transport]
  Env --> Stderr[stderr diagnostics]
  Transport --> Stderr
  Stderr --> Tests[Logging test spies]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -8. Total -8 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 4 12 -8
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 4 12 -8

Review metrics

Metric Value Why it matters
Production vs test LOC production 0; tests +4/-12 (net -8) The patch is confined to test-double simplification and leaves production logging behavior untouched.

Technical review

Best possible solution:

Retain the direct boolean-returning spies so the affected tests follow the established logging-test idiom without changing runtime behavior.

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

Not applicable: this PR changes no runtime behavior and only simplifies existing test doubles.

Is this the best way to solve the issue?

Yes: deleting the redundant casts at the test seam is the narrowest maintainable cleanup, and the sibling logging tests already use direct boolean spies.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a small, behavior-neutral test cleanup with no user-facing impact.
  • 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, test-only cleanup does not change production behavior, so real-behavior proof is not applicable.

Label justifications:

  • P3: This is a small, behavior-neutral test cleanup with no user-facing impact.
  • 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, test-only cleanup does not change production behavior, so real-behavior proof is not applicable.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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 acd0ccc into main Sep 3, 2026
165 of 173 checks passed
@steipete
steipete deleted the codex/test-logging-stderr-spy-casts branch September 3, 2026 11:06
@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 3, 2026
* commit '13b1f71c7010baaf2394555198e2fc04bef03586': (283 commits)
  fix(ui): retire stale MCP feedback across context changes (#128490)
  fix(agents): clarify set-identity workspace output (#126320)
  fix(auth): preserve OAuth metadata during session SDK refresh (#127988)
  fix(agents): recover catalog worker after generation mismatch (#127712)
  fix(memory-wiki): reject out-of-range claim confidence (#125656)
  ci: remove redundant contract runs and costly test work (#137220)
  fix(release): assert the Codex CLI pin the candidate declares (#137136)
  test(voice-call): reuse shared guards and deferred gates (#137262)
  fix(cron): isolate scheduler-disabled shared-store writes (#131733)
  fix(telegram): surface allowed custom reactions in react guidance (#129817)
  test(infra): reuse the shared npm call presence guard (#137254)
  fix: generated images disappear after failed tool calls (#131226)
  fix(docs): match source anchor checks to published sections (#137157)
  fix(backup): preserve audit capture across slow snapshots (#130962)
  fix(release): preserve legacy gh log reads (#137016)
  fix(memory-core): make forget rewrites atomic (#131383)
  fix(agents): write settings atomically (#131431)
  fix(plugins): keep the memory indexing runtime with the selected slot owner (#131779)
  fix(ci): pin iOS screenshot evidence to workflow revision (#136334)
  test(logging): remove redundant stderr spy casts (#137238)
  ...

# Conflicts:
#	scripts/e2e/lib/codex-release-package-assertions.mjs
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
Use the existing boolean stderr spy pattern in the environment and file-cap tests. Preserve all nine scenarios, assertions, queue drains and cleanup while removing four unnecessary double assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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