Skip to content

test: overlap native fs-safe probes within asset phases - #132168

Merged
steipete merged 1 commit into
mainfrom
codex/testperf-tsdown-native-probes
Aug 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/testperf-tsdown-native-probes

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The relocated native fs-safe artifact tests wait for fourteen independent Node probes in sequence. This adds avoidable wall time to the tooling suite even though each probe has its own data directory and process-local native loader/configuration state.

Why This Change Was Made

Run the four probes with native assets present concurrently, wait for every child to finish, then verify and remove the assets before running the three missing-asset probes concurrently. Keep the runtime and worker builds serial, along with bundle disposal and the rest of the file. Promise.allSettled keeps a failing child from releasing the shared built artifact while its siblings still use it; aggregate failures retain individual probe labels.

All seventeen test registrations, fourteen real Node processes, seven native asset hashes, both environment aliases, shared configuration, default fallback, and missing-native require/off/auto outcomes remain. No production, workflow, runner configuration, dependency, or public behavior changes.

User Impact

Developers get faster tooling tests with the same real build/relocation/native-process coverage. No end-user behavior changes.

Evidence

Measured on one dedicated Blacksmith Testbox, one Vitest worker, separate module cache per invocation, import diagnostics and /usr/bin/time -v. Each set excludes A/B warmups and uses eight balanced AB/BA pairs. The initial full-file set was noisy, so a separate confirmation set was recorded without dropping any initial samples.

Scope Median wall A -> B Saving Favorable pairs Vitest A -> B Test body A -> B Import A -> B
Full file, initial 5.331 -> 5.052 s 5.22% 5/8 1.335 -> 1.019 s 0.960 -> 0.631 s 0.138 -> 0.140 s
Full file, confirmation 4.908 -> 4.742 s 3.37% 8/8 1.195 -> 1.010 s 0.850 -> 0.647 s 0.128 -> 0.131 s
Native table 4.892 -> 4.529 s 7.42% 8/8 0.984 -> 0.707 s 0.621 -> 0.348 s 0.137 -> 0.131 s

Confirmation full-file GNU-time median max RSS: 527,686 -> 542,968 KiB; user CPU 4.975 -> 5.015 s; system CPU 0.495 -> 0.545 s. Sampled descendant peak rises 7 -> 10 and tree RSS peak 901,612 -> 1,040,112 KiB. This trades a bounded peak of four short-lived probes for lower wall time; it is not a CPU or memory reduction. Full-file timing, not filtered timing, determines retention.

The real owner fault tests changed the runtime and worker native-copy destinations independently. Each fault failed exactly its corresponding relocated target, with named native-probe failures, while the sibling target passed. Exact owner bytes were restored; full-file shuffles at seeds 17 and 91 and local seed 37 passed all 17 tests. Observation-only instrumentation counted fourteen distinct child PIDs and fourteen distinct roots, peak four probes, four completions before each native asset deletion, then three missing-asset probes. All children and roots were gone after completion.

Blacksmith proof workflow. Baseline source: a79e6517be830ad930fc9be36d5cc7536f86089c. The test runs real tsdown output and the installed native fs-safe binding; no mocked process, native binding, copied validator, or in-process probe substitution.

Canonical test command (with per-run cache/import/resource instrumentation around it):

node scripts/run-vitest.mjs test/scripts/tsdown-config.test.ts --maxWorkers=1 --reporter=verbose

Test-audit and deslop: no test cases removed or added, no new mocks or test-only production seams. Production LOC +0/-0; test LOC +63/-40 (net +23), for asynchronous process completion and phase-owned failure joining. No incidental coverage removed.

All measured whole-file wall pairs (seconds; no samples omitted)
Set Pair Order A B A - B
Initial 1 AB 4.962 5.105 -0.143
Initial 2 BA 5.470 5.014 +0.456
Initial 3 AB 5.139 5.162 -0.022
Initial 4 BA 5.642 5.090 +0.552
Initial 5 BA 5.330 5.367 -0.037
Initial 6 AB 5.332 4.592 +0.739
Initial 7 BA 5.451 4.587 +0.864
Initial 8 AB 5.105 4.791 +0.314
Confirmation 1 AB 4.797 4.508 +0.288
Confirmation 2 BA 4.807 4.495 +0.312
Confirmation 3 AB 4.893 4.722 +0.170
Confirmation 4 BA 5.062 4.764 +0.298
Confirmation 5 BA 4.759 4.577 +0.182
Confirmation 6 AB 4.923 4.762 +0.160
Confirmation 7 BA 5.364 4.910 +0.454
Confirmation 8 AB 5.285 5.126 +0.159

Complete changed gate passed on the same Testbox (root test types, tooling lint, formatting, dependency and boundary guards). Fresh Codex autoreview reported no actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 28, 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 size: S maintainer Maintainer-authored PR labels Aug 28, 2026
@steipete
steipete marked this pull request as ready for review August 28, 2026 22:31
@steipete steipete self-assigned this Aug 28, 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 Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 6:42 PM ET / 22:42 UTC.

ClawSweeper review

What this changes

This PR overlaps isolated native fs-safe Node probes within each asset phase while preserving the barrier before asset deletion and bundle disposal.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this maintainer-owned PR open: its introduced test-only concurrency change is not on current main and source review found no actionable correctness defect.

Priority: P3
Reviewed head: ca435e4f76ef042e8d19028a33b6985079eb2c63

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-only optimization with a clear lifecycle barrier and no source-supported defect found.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-owned, test-only PR is exempt from the external-contributor proof gate; its body nevertheless documents a real Testbox run of the relocated artifact 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-owned, test-only PR is exempt from the external-contributor proof gate; its body nevertheless documents a real Testbox run of the relocated artifact path.
Evidence reviewed 5 items Introduced lifecycle barrier: The introduced async probe and all-settled join wait for every child before inspecting or deleting native assets, and before the enclosing bundle-disposal finally block.
Probe isolation and owner path: Each child receives its own root directory, while the loaded SDK entry delegates root creation to the fs-safe facade.
Native asset layout contract: The build configuration copies fs-safe native assets to the layout resolved by emitted loaders; the test verifies that layout before the missing-asset phase.
Findings None None.
Security None None.

How this fits together

The tsdown artifact test builds and relocates package output, then uses separate Node processes to check native fs-safe loading modes. Its phase barrier protects the shared copied native assets until every probe has finished.

flowchart LR
  A[Build and relocate artifacts] --> B[Launch isolated native probes]
  B --> C[Wait for all probes]
  C --> D[Verify copied assets]
  D --> E[Remove native assets]
  E --> F[Run missing-asset probes]
  F --> G[Dispose build bundles]
Loading

Before merge

  • Resolve merge risk (P1) - Before landing, confirm the unavailable latest ClawSweeper comment's Rank-up moves and exact-head CI; the supplied context filtered that comment and the GitHub API was unreachable during review.
  • Complete next step (P2) - No repair lane is needed; source review found no mechanical fixup, pending only normal exact-head landing checks.
Agent review details

Security

None.

PR surface

Tests +23. Total +23 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 63 40 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 63 40 +23

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests +63/-40 (net +23) The growth is confined to explicit asynchronous child completion and phase cleanup in one integration test.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the phase-level all-settled barrier and merge once the outstanding exact-head review and CI gates are 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 phase-level all-settled barrier and merge once the outstanding exact-head review and CI gates are satisfied.

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

Not applicable to a user-facing bug. The supplied Testbox evidence and source identify the test-performance scenario, but this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. The phase-level all-settled join is the narrowest maintainable way to overlap independent processes while retaining the asset and bundle lifetime invariant.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded tooling-test performance improvement with no product behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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-owned, test-only PR is exempt from the external-contributor proof gate; its body nevertheless documents a real Testbox run of the relocated artifact path.

Label justifications:

  • P3: This is a bounded tooling-test performance improvement with no product behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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-owned, test-only PR is exempt from the external-contributor proof gate; its body nevertheless documents a real Testbox run of the relocated artifact path.

Evidence

What I checked:

  • Introduced lifecycle barrier: The introduced async probe and all-settled join wait for every child before inspecting or deleting native assets, and before the enclosing bundle-disposal finally block. (test/scripts/tsdown-config.test.ts:140, ca435e4f76ef)
  • Probe isolation and owner path: Each child receives its own root directory, while the loaded SDK entry delegates root creation to the fs-safe facade. (test/scripts/tsdown-config.test.ts:146, ca435e4f76ef)
  • Native asset layout contract: The build configuration copies fs-safe native assets to the layout resolved by emitted loaders; the test verifies that layout before the missing-asset phase. (tsdown.config.ts:174, ca435e4f76ef)
  • Node completion contract: The locally installed Node 24.19.0 runtime registers execFile completion on the child close event, and its process implementation sets exitCode before emitting exit; reading exitCode in this callback is not a successful-exit race.
  • Current-main and feature provenance: The PR head is not an ancestor of fetched main; current main still has the synchronous probe sequence. The prior native fs-safe repair is on main, while this performance change remains unique to the open PR. (test/scripts/tsdown-config.test.ts:140, 9684f8f51228)

Likely related people:

  • steipete: Peter Steinberger authored this change, the preceding native fs-safe fix, and the majority of recorded tsdown-config test history. (role: feature owner and recent area contributor; confidence: high; commits: ca435e4f76ef, d43520b04c29, c9349d1fb4db; files: test/scripts/tsdown-config.test.ts, tsdown.config.ts)
  • Jason (Json): History includes a prior build-related contribution to the same test surface, though current-line ownership is primarily with steipete. (role: historical build contributor; confidence: low; commits: 3f6f172873d0; files: test/scripts/tsdown-config.test.ts)

Rank-up moves

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

  • Confirm the latest ClawSweeper Rank-up moves and exact-head green CI before merge.

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

Copy link
Copy Markdown
Contributor Author

Checked the complete latest review, including its Before merge and Rank-up moves sections. There are no source or security findings to repair; the outstanding request is current review/CI confirmation.

That request is satisfied for unchanged head ca435e4f76ef042e8d19028a33b6985079eb2c63: CI run 33217103212 completed successfully, including openclaw/ci-gate (112 checks passed, 30 skipped, none failed or pending). The latest ClawSweeper review is for that same head. Native review artifacts validated and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 132168 passed without rebase or push, verifying the same remote head.

The phase-level all-settled barriers remain unchanged. Real owner faults, fourteen distinct child/root observations, zero remaining children/roots, the complete changed gate, and fresh autoreview are recorded in the PR evidence. No repair or re-review is needed for this verification-only follow-through.

@steipete
steipete merged commit 86a0b22 into main Aug 28, 2026
200 checks passed
@steipete
steipete deleted the codex/testperf-tsdown-native-probes branch August 28, 2026 22:46
@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

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: S 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