Skip to content

refactor(cron): reuse isolated run suite hooks - #137341

Merged
steipete merged 1 commit into
mainfrom
codex/test-cron-common-suite-hooks
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-cron-common-suite-hooks

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The auth cold-path and diagnostic-event suites repeat environment restoration and harness reset plumbing already owned by the shared isolated-cron suite helper.

Why This Change Was Made

Use the existing helper before each suite's local resets. Keep the strict job fixtures, every test body and assertion, per-case overrides, and diagnostic listener cleanup unchanged. This removes 16 test lines with no production or shared-harness changes.

User Impact

No product behavior changes. Auth cold-path, configured-profile propagation, diagnostic lifecycle/disablement/session attribution, and usage-accounting coverage remain intact.

Evidence

  • All 16 cases across both full target suites and the auth-propagation/usage-accounting siblings passed before and after the change, in the same natural file and case order.
  • Scoped formatting, the full two-path LOCAL changed gate, and independent Codex P2 review passed.
  • The extra hook await and the existing helper's fresh default-session assignment were checked explicitly; local resets and per-case overrides retain their order, and all listener finally cleanup remains unchanged.
  • Production delta: 0. Tests: +6/-22, net -16. Proof ran on the fixed de2382a754063b2625fe1190ef6ccab2f98889e8 base with the frozen dependency graph reconciled.

Use the existing suite helper for auth cold-path and diagnostic tests.
Keep suite-specific resets and every case and assertion unchanged.

Validation: 16 paired cases, scoped formatting, the LOCAL changed gate,
and independent Codex P2 review passed. Production delta 0; tests -16.
@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 14:16
@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, 10:23 AM ET / 14:23 UTC.

ClawSweeper review

What this changes

The PR replaces duplicated isolated-cron test suite setup and teardown hooks in two tests with the established shared suite helper.

Merge readiness

✅ Ready for maintainer review

Keep open. This is a unique, test-only cleanup that current main does not yet contain; the shared helper preserves the removed environment reset, harness reset, default-session setup, and restoration lifecycle. No correctness or security defect was found, and the maintainer label rules out automated closure.

Priority: P3
Reviewed head: 80d0673c3278aff2f7eee9c1be23e982927fa9c2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-neutral consolidation that follows the established helper pattern and has no supported correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only refactor has no contributor real-behavior-proof gate; focused suite validation is the relevant evidence path.
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 refactor has no contributor real-behavior-proof gate; focused suite validation is the relevant evidence path.
Evidence reviewed 5 items Shared lifecycle matches removed hooks: The helper clears the fast-test environment, resets the isolated-turn harness, restores the default cron-session mock, and restores the environment in afterEach; this subsumes the removed shared plumbing while leaving local suite resets in place.
Harness reset already establishes the same session default: The harness reset restores resolveCronSessionMock with makeCronSession(), so the helper's explicit default is consistent with the previously direct reset path.
Suite-specific behavior remains after shared setup: Both introduced calls occur before their suite-local beforeEach hooks; auth source mocking and diagnostic-state cleanup remain suite-owned.
Findings None None.
Security None None.

How this fits together

Isolated cron tests invoke the agent-turn runtime through a shared harness. The suite helper resets environment and mock state for each test, then each suite applies its own mocks and assertions.

flowchart LR
  A[Vitest suite] --> B[Shared suite helper]
  B --> C[Environment and harness reset]
  C --> D[Suite-specific mock reset]
  D --> E[Isolated cron turn]
  E --> F[Assertions and cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -16. Total -16 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 6 22 -16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 6 22 -16

Review metrics

Metric Value Why it matters
Production vs test delta production 0; tests +6/-22 (net -16) The branch removes duplicated test lifecycle plumbing without changing runtime or shared-harness production code.

Technical review

Best possible solution:

Use the shared suite helper for common lifecycle state while retaining suite-specific mock and diagnostic cleanup in each test file.

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

Not applicable: this PR refactors test-suite lifecycle setup rather than repairing a reported runtime defect.

Is this the best way to solve the issue?

Yes. The helper is already the established isolated-cron suite pattern and preserves the prior shared reset/restore ordering while avoiding duplicate plumbing.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a low-risk test maintenance refactor with no intended user-visible 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, test-only refactor has no contributor real-behavior-proof gate; focused suite validation is the relevant evidence path.

Label justifications:

  • P3: This is a low-risk test maintenance refactor with no intended user-visible 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, test-only refactor has no contributor real-behavior-proof gate; focused suite validation is the relevant evidence path.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • 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 9061e30 into main Sep 3, 2026
165 of 174 checks passed
@steipete
steipete deleted the codex/test-cron-common-suite-hooks branch September 3, 2026 16:18
@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
* refs/remotes/origin/main:
  fix(plugins): reject unverifiable pinned npm installs (#136725)
  improve(ui): lift sidebar section headers on hover and mark online owners (#136985)
  test(cron): reuse isolated run suite hooks (#137341)
  test(channels): reuse shared indexed call guards (#137350)
  fix(ui): sidebar header controls read misaligned after the + button lost its border (#137317)
  fix(qa-channel): preserve conversation kind for implicit actions (#137343)
  fix: target the source checkout in Control UI repair commands (#137354)
  chore: reduce CI job count and database test overhead (#137352)
  fix(ios): preserve chat live edge across keyboard transitions (#136660)
  refactor(control-ui): consolidate mention inbox requests (#137375)
  fix(openai): preserve ChatGPT HTTP status for retry pacing (#137146)
  fix(mcp): hide policy-denied plugin tools from ACP sessions [AI] (#136546)
  test(queue): reuse shared deferred fixtures (#137338)
  fix(gateway): repair the Gateway E2E shard (browser suite project, skill resource argv, Codex diagnostic) (#137358)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
Use the existing suite helper for auth cold-path and diagnostic tests.
Keep suite-specific resets and every case and assertion unchanged.

Validation: 16 paired cases, scoped formatting, the LOCAL changed gate,
and independent Codex P2 review passed. Production delta 0; tests -16.
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