Skip to content

fix: make update test fixtures faster and independent of umask - #154235

Merged
steipete merged 1 commit into
mainfrom
codex/compile-update-test-fixtures
Sep 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/compile-update-test-fixtures

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Update tests repeatedly compile source imports inside fresh children, and their temporary-directory helper can fail before the intended assertion when the host uses a group-writable umask.

User Impact

No product behavior changes. Delegated update tests start faster with the same real child processes, assertions, and 30-second deadline. Shared test directories remain private under either a restrictive or group-writable host umask.

Why This Change Was Made

Reuse the existing compiled update-fixture declaration owner for the executor, channel-config writer, and config reader. The imports share one compiled graph, preserving the real filesystem interception. Remove the test-local source-URL factory.

The broader CLI proof exposed a separate defect in its fixture producer: with umask 0002, withTestDir created a 0775 case directory beneath its private prefix. The filesystem library correctly rejected that writable ancestor before the cleanup-error test reached its intended path. Request 0700 when creating case and nested directories in the async, sync, and suite helpers. Existing directories, the host umask, runtime permission checks, and cleanup ownership remain unchanged.

Production behavior delta is zero; test and test-support delta is +21/-14 across three files.

Evidence

On the same isolated Linux worker (four CPUs, 16.46 GB RAM, Node 24.19.0, pnpm 12.4.0), the complete delegated-include file passed 3/3 before and after with one Vitest worker:

Measurement Source children Compiled children
Command wall time 52.185s 27.277s
Vitest wall time 49.70s 24.88s
Summed case time 27.282s 5.817s
Worker preparation 14.135s 14.211s

Existing child output verified compiled JavaScript URLs, distinct child PIDs, parent binding, and the original successful/refused effects.

The first full CLI proof retained 8,730 passes, one artifact-cleanup failure, and 91 platform/tool availability skips. The unchanged artifact file reproduced the same failure (3 passed, 1 failed) under umask 0002. After the helper correction, all four artifact cases and all three helper tests passed; the previously failing case took 6.4ms. Async, sync, nested, and suite-created directories measured 0700, and all probe paths were cleaned. Formatting and independent review through P2 passed.

The original CI delegated-include case recorded 30.498s with empty stdout and no readiness message. Its assertion did not retain the underlying command outcome; the standalone source baseline passed. This is a measured startup improvement, without claiming the exact CI failure was reproduced in isolation. An earlier remote attempt ran zero tests because checkout/dependencies exhausted the temporary-filesystem quota; relocating that owned workspace to the intended worker disk resolved the environment failure.

The corrected complete CLI replay passed: 382 files passed, two skipped; 8,731 cases passed and 91 skipped, in 765.44s of Vitest time (769.634s command wall). It used the captured CI descriptor, two effective workers, unchanged umask 0002, and unchanged deadlines. Exact-head CI run 35550040324 passed. Its three delegated cases took 1.775s, 1.352s, and 1.354s (4.481s summed case time) in the CLI job; these are CI observations, separate from the paired benchmark. This does not establish an eight-minute whole-CLI result. The remote full CLI inventory is one case behind the later main sample, which added a restart-health address case; its 40 additional PowerShell skips reflect tool availability, not removed tests.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS maintainer Maintainer-authored PR labels Sep 21, 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 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 9:16 PM ET / September 21, 2026, 01:16 UTC.

ClawSweeper review

What this changes

The PR reuses compiled update-test imports to reduce child-process startup time and creates private test directories under group-writable host umasks.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a focused fixture repair that remains useful on current main. No introduced correctness defect was found, and the maintainer-authored, protected PR is not eligible for cleanup closure.

Priority: P3
Reviewed head: bc0182c737c30a2a179486a652ffaf8e5362981f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture repair with preserved behavioral coverage and useful reported measurements; no actionable defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored test-support change is exempt from external-contributor runtime proof; its body nevertheless reports real child-process outcomes, directory-mode probes, and a complete CLI replay matching the changed fixtures.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored test-support change is exempt from external-contributor runtime proof; its body nevertheless reports real child-process outcomes, directory-mode probes, and a complete CLI replay matching the changed fixtures.
Evidence reviewed 8 items Introduced scope: The pinned introduction changes only test declarations, their delegated-update consumer, and temporary-directory test support. It preserves assertions, child-process execution, and the 30-second deadline.
Existing compilation owner: The fixture declaration is already registered for compiled resolution, and the build owner consumes all its entries. Adding the config writer and reader therefore uses the existing compilation mechanism.
Directory repair stays in fixture ownership: All five affected mkdir calls request 0700 for newly created async, sync, nested, and suite case directories. Existing root ownership, cleanup, and the process umask are unchanged.
Findings None None.
Security None None.

How this fits together

OpenClaw’s update tests launch real child processes to verify configuration writes and refusal behavior. Shared fixture declarations select compiled modules, while temporary-directory helpers provide isolated filesystem state and cleanup.

flowchart TD
  A[Update test scenarios] --> B[Shared fixture declarations]
  B --> C[Compiled child processes]
  D[Private test directories] --> C
  C --> E[Configuration write or refusal]
  E --> F[Assertions and cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +7. Total +7 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 21 14 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 21 14 +7

Review metrics

Metric Value Why it matters
Reported delegated-test runtime 52.185s → 27.277s command wall time The same-worker comparison reports roughly 48% less elapsed time with all three scenarios and their deadlines preserved.

Technical review

Best possible solution:

Keep fixture compilation centralized and make test-owned directories private at creation while retaining the existing real-process assertions and cleanup.

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

Yes for the directory-permission mechanism: current main omits mkdir mode, allowing 0775 case directories under umask 0002. The PR reports an isolated failing artifact test and successful correction; this review did not execute it or reproduce the original CI timeout.

Is this the best way to solve the issue?

Yes. The patch repairs fixture creation and reuses the existing compiled-worker owner without weakening assertions, extending deadlines, or changing production safeguards.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a4e3a5d5f88f.

Labels

Label changes:

  • add P3: This improves internal test reliability and runtime without changing product behavior.
  • 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: The maintainer-authored test-support change is exempt from external-contributor runtime proof; its body nevertheless reports real child-process outcomes, directory-mode probes, and a complete CLI replay matching the changed fixtures.

Label justifications:

  • P3: This improves internal test reliability and runtime without changing product behavior.
  • 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: The maintainer-authored test-support change is exempt from external-contributor runtime proof; its body nevertheless reports real child-process outcomes, directory-mode probes, and a complete CLI replay matching the changed fixtures.

Evidence

What I checked:

  • Introduced scope: The pinned introduction changes only test declarations, their delegated-update consumer, and temporary-directory test support. It preserves assertions, child-process execution, and the 30-second deadline. (src/cli/update-cli/update-command-include-delegated.test.ts:18, bc0182c737c3)
  • Existing compilation owner: The fixture declaration is already registered for compiled resolution, and the build owner consumes all its entries. Adding the config writer and reader therefore uses the existing compilation mechanism. (scripts/lib/vitest-worker-build-entries.mts:103, bc0182c737c3)
  • Directory repair stays in fixture ownership: All five affected mkdir calls request 0700 for newly created async, sync, nested, and suite case directories. Existing root ownership, cleanup, and the process umask are unchanged. (src/test-helpers/temp-dir.ts:130, bc0182c737c3)
  • Still necessary on fetched main: Comparison with fetched main shows these same fixture changes remain absent there. The latest supplied release also creates case directories without an explicit mode. (src/test-helpers/temp-dir.ts:128, ec9c1a13db89)
  • Main comparison: The current-main comparison independently confirms that the compiled-import conversion and private-directory creation remain branch-only work. (src/cli/update-cli/update-command-include-delegated.test.ts:18, a4e3a5d5f88f)
  • Reported validation: The captured PR body reports delegated-case command time falling from 52.185s to 27.277s with all three cases passing; directory probes measured 0700 under umask 0002; the complete CLI replay passed 8,731 cases. It explicitly distinguishes the startup improvement from reproducing the original CI timeout. These are contributor-reported results; this read-only review did not execute tests. (bc0182c737c3)

Likely related people:

  • Peter Steinberger: 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 merged commit 0ef87e5 into main Sep 21, 2026
180 checks passed
@steipete
steipete deleted the codex/compile-update-test-fixtures branch September 21, 2026 02:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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