Skip to content

refactor: finish shared test helper migrations - #120996

Merged
steipete merged 5 commits into
mainfrom
steipete/test-helper-migration-codemod-e22b2e
Aug 9, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/test-helper-migration-codemod-e22b2e

Conversation

@steipete

@steipete steipete commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a stalled test-maintenance migration where hundreds of tests still carried local copies of shared deferred-promise and temporary-directory helpers. The duplicates had drifted across core, UI, packages, and plugins, including repeated macOS temp-path canonicalization workarounds.

Why This Change Was Made

This completes the migration to the canonical shared helpers while preserving owner boundaries: core/root tests use test/helpers, plugin tests remain behind existing Plugin SDK surfaces, and semantic outliers with permission, lifecycle, deterministic-layout, or migration-path contracts stay local. The shared temp-dir helper now owns canonical default temp roots while preserving explicitly supplied lexical roots. Obsolete test-only deferred aliases are removed.

AI-assisted: yes. The final diff was manually coordinated, fully gated, simplified, and reviewed.

User Impact

No runtime or product behavior changes. Test setup is smaller and more consistent, cleanup ownership is clearer, and macOS path comparisons no longer need scattered default-temp realpath compensation.

Evidence

  • Final production delta: 0 lines; test/support diff: 349 paths, +2,478/-4,114 (net -1,636).
  • Full changed-file gate passed on Blacksmith Testbox: https://github.com/openclaw/openclaw/actions/runs/31301189218
  • SDK surface plus 38 focused files: 1,406 tests passed: https://github.com/openclaw/openclaw/actions/runs/31302319022
  • Additional focused batch proof: 6,413 deferred assertions; 1,590 core temp tests; 535 plugin temp tests; 457 simplification tests.
  • Earlier post-rebase focused conflict proof passed 108 tests across six integration-affected files.
  • pnpm plugin-sdk:surface:check, extension import boundaries, helper duplicate audits, and git diff --check passed.
  • Exact-head CI initially exposed one missed cron test-harness consumer, now migrated and focused-tested. It also exposed a stale Plugin SDK API manifest that failed identically on clean origin/main; current main has absorbed that red-main repair, so the final rebased PR correctly carries no generated manifest delta.
  • Follow-up proof: pnpm plugin-sdk:api:check passed; the focused cron test passed 7/7; focused lint passed; follow-up autoreview was clean.
  • The second exact-head CI run exposed repository-wide formatting drift in test files, including one pre-existing red-main format failure. The required test-only repair is included and focused-tested.
  • Patch-identical CI run https://github.com/openclaw/openclaw/actions/runs/31305713206 attempt 2 is fully green: 66 successful jobs and 7 intentional skips, including the previously failing compact shard.
  • Final rebase proof at 0ae187485aa4ce1dbbe1d501cd54a26dec08624a: whole-repo oxfmt --check passed across 27,898 files; focused tests passed 17/17 across three shards; pnpm plugin-sdk:api:check, helper duplicate audits, and git diff --check passed.
  • Full-branch autoreview was clean in 3/3 passes. ClawSweeper reported no concrete defects or actionable findings; its remaining optional exact-head/full-head proof move is satisfied.

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 7:41 AM ET / 11:41 UTC.

ClawSweeper review

What this changes

Migrates test-local deferred-promise and temporary-directory setup to existing shared helper APIs across core, UI, scripts, and bundled plugin tests.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review. The available source supports reusing the existing helper seams, but this read-only checkout cannot retrieve the exact PR head and cannot satisfy the required sibling Codex-source gate.

Priority: P3
Reviewed head: eb10009816c1a63d40fbf62221aca01d8014ee4a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The helper direction is sound in the inspected scope, but exact-head and Codex-contract evidence are unavailable in this environment.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-associated test-only refactor has no user-visible behavior requiring after-fix runtime proof.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-associated test-only refactor has no user-visible behavior requiring after-fix runtime proof.
Evidence reviewed 7 items Existing deferred contract: The public plugin SDK helper delegates to the canonical deferred implementation, whose resolver accepts a value or promise-like value.
Existing temp-workspace API: The published temp-path SDK entrypoint already exports the workspace helpers used by the supplied migration hunks.
Established plugin test pattern: QA Lab already creates a workspace under the preferred OpenClaw temp root and owns cleanup through the workspace object.
Findings None None.
Security None None.

How this fits together

Shared helper APIs provide promise coordination and isolated temporary workspaces to test suites. Core, UI, script, and plugin tests consume them so fixture setup and cleanup remain consistent without changing production behavior.

flowchart LR
  A[Test suites] --> B[Shared helper APIs]
  B --> C[Deferred async coordination]
  B --> D[Temporary workspaces]
  C --> E[Assertions]
  D --> E
  E --> F[CI validation]
Loading

Before merge

  • Resolve merge risk (P1) - The exact PR head cannot be inspected locally and its remaining CI checks are still in progress.
  • Resolve merge risk (P1) - The Codex test slice cannot receive the repository-required direct Codex-source review while sibling ../codex and network access are unavailable.
  • Complete next step (P2) - A maintainer review is needed once exact-head inspection, remaining CI, and the required Codex-source check are available.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test support production 0 claimed; test/support +2,478/-4,091 The supplied PR evidence describes a test-maintenance migration rather than a runtime or public-contract change.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/canvas/doctor-contract-api.test.ts, migration/backfill/repair: extensions/codex/src/migration/provider.test.ts, migration/backfill/repair: extensions/discord/src/monitor/model-picker-preferences-migrations.test.ts, migration/backfill/repair: extensions/imessage/src/state-migrations.test.ts, migration/backfill/repair: extensions/memory-wiki/doctor-contract-api.test.ts, migration/backfill/repair: test/scripts/upgrade-survivor-probe-gateway.test.ts, and 16 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the canonical shared helpers and complete the consumer migration after the exact head is inspectable, its checks finish, and the Codex dependency gate can be satisfied.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the canonical shared helpers and complete the consumer migration after the exact head is inspectable, its checks finish, and the Codex dependency gate can be satisfied.

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

Not applicable: the PR refactors test support and does not report a production failure.

Is this the best way to solve the issue?

Yes for the inspectable scope: migrating consumers to existing public helper seams is preferable to retaining duplicated local helpers; exact-head and Codex-gate evidence still prevent a merge recommendation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a behavior-neutral test-helper cleanup, pending normal maintainer review.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-associated test-only refactor has no user-visible behavior requiring after-fix runtime proof.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Authored the recorded consolidation of deferred-promise construction used by the current shared helper. (role: introduced shared deferred consolidation; confidence: high; commits: 80d129212cf8; files: src/shared/deferred.ts, src/plugin-sdk/extension-shared.ts)
  • Mason Huang: Authored the tracked auto-cleaning temporary-directory helper pattern that this migration follows. (role: introduced temp-helper pattern; confidence: high; commits: 5ff247b99ec1; files: test/helpers/temp-dir.ts)
  • steipete: Recorded history connects this contributor to the public temp-path seam, in addition to the current migration work. (role: recent SDK boundary contributor; confidence: medium; commits: 4f0ad16a00bb; files: src/plugin-sdk/temp-path.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Make the exact PR head available for review and let its remaining CI checks complete.
  • Re-run the Codex slice with sibling ../codex source available, citing the inspected contract.

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 (2 earlier review cycles)
  • reviewed 2026-08-09T08:47:50.886Z sha 48bb5c8ee5b475592d958ca5e3e2a5c0093fb887 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-09T10:40:10.213Z sha de69d6c :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/test-helper-migration-codemod-e22b2e branch 2 times, most recently from 338104d to 0ae1874 Compare August 9, 2026 09:43
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Aug 9, 2026
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 0ae187485aa4ce1dbbe1d501cd54a26dec08624a:

  • Final rebase onto 135278c8968f81c3da3bb51ffb7559f8e5887588 resolved one mechanical generated-manifest conflict. Current main already carries the SDK manifest red-main repair, so that redundant hunk was dropped. One test-only format repair for pre-existing red-main drift remains. Production delta is 0; test/support delta is +2,478/-4,114 across 349 paths.
  • Exact local commands passed: git diff --check origin/main...HEAD; node_modules/.bin/oxfmt --check . (27,898 files); pnpm plugin-sdk:api:check; helper duplicate audits; and node scripts/run-vitest.mjs src/cron/service.remove-session-cleanup.test.ts src/agents/prepared-model-runtime.inbound-registry.test.ts src/worker/worker.fault-injection.test.ts (17/17 across three shards).
  • Blacksmith/Testbox evidence: full changed-file gate run 31301189218; SDK surface plus 38 focused files run 31302319022. GitHub Actions CI run 31305713206 attempt 2 is fully green with 66 successful jobs and 7 intentional skips, including the previously failing compact shard.
  • Full-branch autoreview was clean in 3/3 passes. ClawSweeper found no concrete defect or actionable finding; its remaining optional exact-head/full-head proof move is satisfied. Proof gaps: none.

Review artifacts validated with READY FOR /prepare-pr and issueValidation.status=valid.

@steipete
steipete force-pushed the steipete/test-helper-migration-codemod-e22b2e branch from 0ae1874 to de69d6c Compare August 9, 2026 10:33
@openclaw-barnacle openclaw-barnacle Bot removed the extensions: memory-core Extension: memory-core label Aug 9, 2026
@steipete steipete self-assigned this Aug 9, 2026
@steipete
steipete force-pushed the steipete/test-helper-migration-codemod-e22b2e branch from eb10009 to 752f6a7 Compare August 9, 2026 12:43
@steipete
steipete force-pushed the steipete/test-helper-migration-codemod-e22b2e branch from 752f6a7 to 4fe2dc2 Compare August 9, 2026 12:47
@steipete
steipete merged commit 8616c0c into main Aug 9, 2026
124 checks passed
@steipete
steipete deleted the steipete/test-helper-migration-codemod-e22b2e branch August 9, 2026 13:00
@steipete

steipete commented Aug 9, 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 10, 2026
* test: finish shared helper migrations

* test: fix helper migration CI

* style: fix test import ordering

* test(acpx): restore deferred void types

* test: fix helper migrations after rebase
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Aug 25, 2026
… advance 80)

Resolution (13 raw conflicts; 12 ui resolved by fork-ownership policy):

- pnpm-lock.yaml: regenerated via pnpm install (derived file).
- extensions/openshell/src/openshell-core.test.ts (merge=ours drift): ADOPT-UPSTREAM
  openclaw#129258 fixture dedup + openclaw#120996 tempWorkspace migration + openclaw#126828 canonical-owner
  test (fork's makeTempDir shape + missing test were stale freezes of older upstream
  code, not fork intent). Grafted fork's one genuine delta: required
  SandboxConfig.osSandbox block into createOpenShellBackendSandboxConfig.
- src/agents/cli-runner.reliability.test.ts (merge=ours drift): clean 3-way
  merge-file. Kept fork tests + upstream openclaw#125085 (codex->agent-cli literals,
  watchdog resume tuning test; math verified against merged reliability.ts).
- src/agents/embedded-agent-runner/run/incomplete-turn-recovery.ts: ADOPT-UPSTREAM
  (preflight tsgo-core=1 catch: upstream consumer openclaw#128970 imports
  resolveSettledToolBatchEvidence which merge churn had dropped from the fork
  provider; export surface differs by exactly this extraction; fork toolMetas
  type carries toolCallId?/terminate?/isError?).
- ui/src/ui/markdown.ts: explicit param types on the linkify www plugin callbacks
  (validate/normalize). @types/markdown-it 14.1.2->14.2.0 (upstream dep bump)
  dropped contextual typing for them; the fork-owned ui copy now types them inline
  per linkify-it's Validate/Match signatures (upstream adapted its own ui tree the
  same way). Only ui file needed it; tsgo:test:ui 3->0 locally.

Note: ui tree-hash invariant vs main intentionally broken by this one adaptation —
main's ui does not compile against the new lockfile (baseline 0 was measured with
@types 14.1.2).

No product-collision: no codex/** residuals.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: irc channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: qqbot channel: raft Channel integration: Raft channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call cli CLI command changes commands Command implementations extensions: acpx extensions: anthropic extensions: codex extensions: copilot extensions: device-pair extensions: diagnostics-prometheus extensions: google extensions: memory-wiki extensions: onepassword 1Password plugin extensions: openshell extensions: qa-lab extensions: xai gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: migrate-claude plugin: migrate-hermes rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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