Skip to content

perf(test): speed up declaration boundary checks - #157669

Merged
steipete merged 1 commit into
mainfrom
ci-burden/spdc-ext-scripts-ui
Sep 25, 2026
Merged

steipete merged 1 commit into
mainfrom
ci-burden/spdc-ext-scripts-ui

Conversation

@steipete

@steipete steipete commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Declaration boundary tests repeatedly block the tooling worker while independent real compiler commands run, making packaging and build changes expensive to validate.

User Impact

No product behavior changes. The three declaration files run 36.39% faster in paired Linux measurements while retaining every case, all 144 assertions, and their existing deadlines.

Why This Change Was Made

Use the existing command-fixture owner for asynchronous child execution and case-local directory ownership, then allow at most two independent cases concurrently. Entire test bodies remain lifetime-owned so cancellation joins children and unwinding before deleting inputs. Cases that spy on global filesystem methods stay sequential. Native Node executes erasable tooling directly; the explicit loader-boundary case remains. Compiler inputs remain physical private copies, with copy-on-write where supported.

This is the declaration part of the area-C speed pass. The raw diff exceeds 1,500 lines because lifetime ownership indents the case bodies, so archive-fixture work is published in #157689. No test tier, worker-count configuration, timeout, assertion, or retry policy changes.

Evidence

Paired three-run medians on one Linux Blacksmith Testbox, Node 24.19.0, canonical tooling config and the historical CI count of one worker. Wall includes the wrapper; native is the reporter's file duration. Historical PR run 36047699189 and hourly main run 36048371548 selected the cohort across platforms; their Windows times are not used as Linux baselines.

File under test/scripts/ Fate Wall before → after Native before → after Coverage retained / reason
tsdown-declaration-resolution.test.ts FAST 35.473 → 19.681 s 33.498 → 18.184 s All 47 assertions; checkout containment, aliases, inherited types, compiler receipts and native path behavior
write-plugin-sdk-entry-dts.test.ts FAST 33.472 → 21.051 s 32.031 → 19.440 s All 43 assertions; canonical declarations, public identity, cache invalidation, rollback and private QA partition
write-unified-entry-dts.test.ts FAST 27.068 → 20.338 s 25.708 → 18.495 s All 54 assertions; unified publication, receipt integrity, failure cleanup and ownership
Sum 96.013 → 61.070 s 91.238 → 56.118 s 34.943 s wall saved; 36.39%

All three files passed ten further runs each (30/30). The additional shared-helper consumer dist-artifact-ownership.test.ts passed. Peak whole-process-tree RSS was 2,479 MiB. Linux preserves four platform-specific skips in declaration resolution; native Windows coverage is supplied by PR CI, not claimed from Linux.

Complete historical tooling subgroups were replayed on Linux at one worker:

Historical subgroup Before → after wall Result
Windows job 3 / tooling, 6 files 29.033 → 19.594 s Pass
Windows job 4 / tooling, 5 files 89.085 → 69.833 s Pass
Windows job 5 / tooling, 4 files 80.345 → 57.284 s Pass; combined declaration + archive candidate, not attributable solely to this PR

These are the complete owning tooling subgroups, not all unrelated projects from the Windows jobs. Linux Testbox proof: https://github.com/openclaw/openclaw/actions/runs/36065184936 (the lease was stopped after successful proof).

An early pilot used a non-destructured extended-fixture callback and failed two alias cases; destructuring the command/skip fixtures fixed that test-harness integration. All figures and endurance results above are from the corrected candidate. No retries or timeout increases were added.

A disposable single-file probe through the actual shared fixture confirmed two simultaneous whole bodies (control: five); all 20 probe cases passed. The pinned Vitest 5 runner creates the group limiter after the setup hook. This resolves an initial review finding based on an older Vitest implementation.

Targeted type-aware lint, formatting, and git diff --check passed. Independent local and post-rebase branch reviews are P2-clean. Exact-head CI results will be recorded below. The changed-lane plan was inspected; the authorized targeted type-aware lint substitute was used, with the existing negative canary confirming typed diagnostics. No auto-merge is requested.

Full 20-file cohort disposition and remaining costs

The complete corrected cohort has 60 successful Linux baseline runs: 1,031.156 s summed file-wall medians. The five measured candidate changes save 46.661 s (4.525%) when all five files are selected; artifact-helper endurance and all shared consumers passed, as reported in the separate PR. This is credited file-level saving, not a measured post-change run of all twenty files or a claim about CI critical-path time. The requested 30% aggregate target is not met. No tests were removed from PR/main routing, and no tier change is claimed.

The two separately published artifact candidates are test/scripts/vitest-worker-artifacts.test.ts (69.574 → 62.513 s) and test/scripts/check-openclaw-package-tarball.bundled-mcp.test.ts (27.823 → 23.166 s). The following fifteen files are unchanged, with zero savings credited; these values are before medians, not invented after measurements.

Unchanged file Linux wall baseline Reason / retained coverage
test/scripts/mac-elevation-host.test.ts 1.936 s Linux only: 55 passed, 97 native-macOS cases skipped. Portable work is already subsecond; no native speedup claimed.
ui/src/e2e/chat-composer-websearch-kill-switch.real-gateway.e2e.test.ts 129.720 s Two persisted policy configurations each already share one built Gateway; startup ownership belongs to the dedicated Gateway lane.
ui/src/e2e/chat-async-questions.e2e.test.ts 51.450 s Shared bootstrap experiment gave 51.450 → 51.533 s wall and was reverted; keep all 19 distinct queue/reconnect/recovery cases.
ui/src/e2e/new-session-page.transition.e2e.test.ts 69.153 s Suite already shared; apparent sleeps are capture-only. Keep submitted-preview/readiness transition observations.
test/scripts/worker-deploy-build-plugin.test.ts 78.574 s Already shares one real build. Complete Acorn import-closure scanning belongs to production scripts outside this area; keep its independent proof.
ui/src/e2e/chat-position-rail-layout.e2e.test.ts 77.161 s Real 30-frame samples detect transient rail geometry; shorter windows or disabled animation would weaken the contract.
test/scripts/check-openclaw-package-tarball.test.ts 24.292 s Checker/npm metadata and dry-run work is outside this area; every package contract remains.
ui/src/e2e/chat-model-controls.e2e.test.ts 51.392 s Distinct catalog, pointer, keyboard and responsive contracts; no measured safe speedup from bootstrap reuse.
ui/src/e2e/agent-file-lifecycle.real-gateway.e2e.test.ts 51.738 s Already shares the catalog Gateway; file persistence and publication are distinct state contracts. Preserve recent startup improvements.
ui/src/e2e/lazy-custom-element-recovery.e2e.test.ts 49.047 s Cold hashed-chunk failure/recovery and the negative retry-wakeup window are intentional; keep cold stylesheet isolation.
ui/src/e2e/chat-user-bubble-disclosure.e2e.test.ts 45.236 s Actual clipping, reflow, rich-text and responsive geometry remain independently meaningful.
extensions/codex/src/app-server/run-attempt.test.ts 83.115 s Already shares database workers and drains attempts. Supported SDK/lifecycle ownership and dedicated serialization lane limit this pass.
ui/src/components/session-owner-chip.browser.test.ts 35.304 s Recent fix already narrows readiness/font waits; preserve theme paint, glyph-ink and contrast checks.
ui/src/e2e/chat-loading-performance.real-gateway.e2e.test.ts 45.179 s Large persisted transcripts and cold startup prove performance behavior; shrinking or warming them changes the contract.
ui/src/e2e/question-flow.e2e.test.ts 44.448 s Distinct touch, navigation, reconciliation, masking and edited-host rejection cases; no covering duplicate established.

No named stronger sibling justified deleting these contracts. Ordinary UI/provider behavior was not reclassified as niche release coverage merely to reduce the total. Release candidates and dedicated Gateway/configuration owners were left to their coordinated lanes. Both release exclusion inventories were checked before committing.

Hosted CI

Current head f3728e727ee2aa10da12c0f83ae4d18bf411513b: https://github.com/openclaw/openclaw/actions/runs/36073756132. This base refresh includes the landed owning fix #157659 (b5cfc8dd9221). Every measured declaration source hash and its critical fixture/command dependencies remain unchanged; the existing P2 review and Linux proof apply to the identical patch. The refreshed run is deferred for release priority: security-fast passed, ordinary preflight/tests were skipped, and the aggregate gate failed with CI deferred while Full Release Validation 36073359097 holds hosted-runner priority. The active release run owns the hold. Its owner must restore deferred CI after sealing; deferred PR work is not automatically re-dispatched. This final-head ordinary CI remains outstanding, so this PR is not claimed fully green. No capacity variables or rulesets were changed.

Initial exact-head CI: https://github.com/openclaw/openclaw/actions/runs/36071021696, head bebdc282a1a849754b2d1d99b0b123f81ea7c13a, attempt 1. The run completed failure: 28 jobs passed, 20 skipped, and 16 failed. The fifteen failed implementation checks (production/root/core types, core lint, extension lint preparation, and package boundary) all trace to the same base-branch error; the sixteenth failure is the aggregate gate: src/infra/package-update-npm-pack.ts:7 imports UpdateStepResult from ./update-runner-types.js, which does not export it (TS2459). The changed diff contains no src/** edits, and the inspected main base also retains the bad import. The owning lane fixed this outside-area blocker in main; this PR then incorporated that real source fix by rebasing. No unchanged-head retry or timeout change was used. All three changed declaration files passed native Windows CI: resolution 24 passed / 1 existing platform skip; SDK writer 12 passed; unified writer 11 passed. Windows long-path, 8.3 and case-alias cases passed. The skipped cold workspace-output alias case passed on Linux.

Windows CI job Reference hourly job / test-step wall This PR job / test-step wall Changed file native time before → after
checks-windows-node-test-3 463 / 362 s 258 / 158 s unified writer: 108.133 → 46.978 s
checks-windows-node-test-4 866 / 772 s 366 / 252 s declaration resolution: 250.521 → 72.805 s
checks-windows-node-test-5 984 / 848 s 370 / 267 s SDK writer: 245.670 → 63.017 s

Reference: hourly run 36048371548; after: this exact-head PR run. The three changed Windows file durations sum 604.324 → 182.800 s. This is a cross-run observation, not a controlled Windows median: intervening main changes and different overall job work prevent attributing the whole job/step reduction to this patch. The controlled Linux medians remain the speed comparison above. No Windows rerun was used to get these results.

@clawsweeper

clawsweeper Bot commented Sep 24, 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.

@steipete
steipete marked this pull request as ready for review September 24, 2026 23:06
@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 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 7:56 PM ET / 23:56 UTC (Revision 3).

ClawSweeper review

What this changes

The branch runs up to two isolated declaration test cases concurrently through managed compiler processes and uses copy-on-write fixture copies.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still runs the declaration checks serially, and the supplied measurements show a meaningful speedup without an identified loss of coverage. No patch defect was established.

Priority: P3
Reviewed head: f3728e727ee2aa10da12c0f83ae4d18bf411513b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Measured real tooling runs support a focused implementation, with final-head ordinary CI still deferred by release scheduling.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The changed declaration test owner was exercised through the actual tooling suites on a Linux Testbox: the PR records paired before-and-after wall times, retained assertions, and 30 successful follow-up file runs. Earlier-head Windows CI also passed the changed suites; final-head ordinary CI was deferred, and the Testbox logs were unavailable through the review proxy. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed declaration test owner was exercised through the actual tooling suites on a Linux Testbox: the PR records paired before-and-after wall times, retained assertions, and 30 successful follow-up file runs. Earlier-head Windows CI also passed the changed suites; final-head ordinary CI was deferred, and the Testbox logs were unavailable through the review proxy. No stored-data contract changes.
Evidence reviewed 7 items Introduced fixture change: The pinned PR patch replaces synchronous fixture commands with the existing managed command fixture and limits concurrent cases to two.
Existing process owner: The shared command fixture tracks child completion, aborts on test finish, and joins commands; its test wrapper drains lifetime work before removing temporary inputs.
Current main still needs the change: The fetched main revision retains synchronous declaration fixture execution; its five affected files match the PR merge base.
Findings None None.
Security None None.

How this fits together

OpenClaw’s tooling tests build private checkout copies and run declaration compilers to check generated types, cache receipts, and package boundaries. Their results feed CI validation for build and plugin SDK changes.

flowchart LR
  A[Tooling CI] --> B[Declaration cases]
  B --> C[Two-case limit]
  C --> D[Private checkout copies]
  D --> E[Managed compiler processes]
  E --> F[Type and cache assertions]
  F --> G[CI result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +132. Total +132 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 1121 989 +132
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 1121 989 +132

Review metrics

Metric Value Why it matters
Paired Linux suite wall time 96.013 s → 61.070 s; 36.39% lower The three declaration suites have a controlled before-and-after measurement without reducing their reported assertions.

Technical review

Best possible solution:

Keep the bounded concurrency and case-owned cleanup, then land through the normal exact-head CI gate once deferred validation runs.

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

Not applicable: this is a tooling performance change rather than a bug report. The PR supplies paired real-run timings and suite outcomes.

Is this the best way to solve the issue?

Yes: it reuses the existing managed command owner, keeps private compiler inputs, and bounds concurrency while retaining the declaration assertions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a measured internal CI speed improvement with no product behavior change or urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed declaration test owner was exercised through the actual tooling suites on a Linux Testbox: the PR records paired before-and-after wall times, retained assertions, and 30 successful follow-up file runs. Earlier-head Windows CI also passed the changed suites; final-head ordinary CI was deferred, and the Testbox logs were unavailable through the review proxy. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed declaration test owner was exercised through the actual tooling suites on a Linux Testbox: the PR records paired before-and-after wall times, retained assertions, and 30 successful follow-up file runs. Earlier-head Windows CI also passed the changed suites; final-head ordinary CI was deferred, and the Testbox logs were unavailable through the review proxy. No stored-data contract changes.

Evidence

What I checked:

  • Introduced fixture change: The pinned PR patch replaces synchronous fixture commands with the existing managed command fixture and limits concurrent cases to two. (test/scripts/tsdown-declaration-fixture.ts:31, f3728e727ee2)
  • Existing process owner: The shared command fixture tracks child completion, aborts on test finish, and joins commands; its test wrapper drains lifetime work before removing temporary inputs. (test/helpers/command-fixture.ts:142, f3728e727ee2)
  • Current main still needs the change: The fetched main revision retains synchronous declaration fixture execution; its five affected files match the PR merge base. (test/scripts/tsdown-declaration-fixture.ts:31, eca1706a533e)
  • Real tooling measurements: The PR body reports paired Linux Testbox medians of 96.013 to 61.070 seconds across the three suites, all 144 assertions retained, and 30 successful follow-up file runs. The linked Testbox workflow was canceled after the reported lease shutdown; its detailed logs could not be fetched through the review proxy. (f3728e727ee2)
  • Final-head CI state: Security-fast passed on the reviewed head, while ordinary jobs were deferred for release-run priority and the aggregate CI gate failed on that deferral. This does not identify a patch defect. (f3728e727ee2)
  • Prior area history: A merged tooling refactor, refactor: run plugins and tooling without TypeScript 6 #156829, previously changed the declaration fixture and provides a current-main routing connection for steipete. The available partial history did not support a verified source-line introduction claim. (test/scripts/tsdown-declaration-fixture.ts:16, c8eab360206b)

Likely related people:

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-24T23:11:10.524Z sha bebdc28 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T23:22:22.276Z sha bebdc28 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 24, 2026
Use the existing command lifetime for independent real compiler cases, cap active cases at two, and retain physical compiler inputs and every assertion. Paired Linux medians reduce the three-file wall sum from 96.013s to 61.070s; thirty endurance runs and helper consumers pass.
@steipete
steipete force-pushed the ci-burden/spdc-ext-scripts-ui branch from bebdc28 to f3728e7 Compare September 24, 2026 23:38
@steipete
steipete enabled auto-merge (squash) September 24, 2026 23:52
@steipete
steipete merged commit 53cc262 into main Sep 25, 2026
198 of 201 checks passed
@steipete
steipete deleted the ci-burden/spdc-ext-scripts-ui branch September 25, 2026 02:34
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
Use the existing command lifetime for independent real compiler cases, cap active cases at two, and retain physical compiler inputs and every assertion. Paired Linux medians reduce the three-file wall sum from 96.013s to 61.070s; thirty endurance runs and helper consumers pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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