Skip to content

test: reuse immutable native PR bootstrap fixtures - #133169

Merged
steipete merged 1 commit into
mainfrom
codex/test-perf-native-bootstrap
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-perf-native-bootstrap

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Native PR tests repeatedly rebuild the same initial Git history and tool setup. Across 134 merge-outcome fixtures and 18 fresh-main lock cases, this adds execution time before the behavior under test begins.

Why This Change Was Made

Reuse only immutable setup, with an independent repository copy for every case. Merge-outcome fixtures cache the base commit and empty bare remote; every source commit, attribution variant, push and linked worktree remains fresh. Fresh-main lock cases cache the committed wrapper/tool prefix before any origin, fetch, worktree or failure proxy exists.

The templates use the existing lifecycle-owned temporary-directory helper. Case copies retain separate files, refs, indexes, objects, configuration and cleanup. Partial initialization remains registered for cleanup. No shared mutable fixture, object alternates or hardlinks are introduced.

Production delta: 0. Tests: +110/-59. All test cases, assertions, mocks, clocks, deadlines, process supervision, real Git transport, sharding and worker settings remain unchanged. Reusing live worktrees or parameterized source histories was rejected because it would weaken corruption, recovery and attribution coverage.

User Impact

No product behavior changes. Repeated local measurements save about nine seconds across the affected test groups. This is a focused execution-time result, not a claim about total CI duration.

Evidence

macOS, Node 26.5.0, Vitest 4.1.11; same one-worker runner settings for all measurements:

Existing group Before (seconds) After (seconds) Mean saving
Merge-outcome, all 140 cases 195.48 / 197.38 190.96 / 187.38 7.26 s
Fresh-main lock matrix, 18 cases 19.47 / 19.82 18.14 / 17.82 1.66 s

Times are elapsed file spans or the serial matrix durations, not sums across concurrent cases. The full candidate pair passed 250 tests, with the existing Linux-only zombie-process case skipped on macOS. The 18 fresh-main cases also passed shuffled with seed 93147.

Supplemental probes compare baseline/candidate trees, refs, indexes, configuration, working state, executable targets and path-bound environments. Deleting a copied source object or mutating one case's refs, config, index and proxy leaves siblings and templates unchanged. Successful and failed-bootstrap cleanup passed. Node's default copy resolves some host executable symlink aliases; the resolved executables remain identical.

node scripts/check-changed.mjs -- test/scripts/pr-merge-outcome.test.ts test/scripts/pr-operation-lock.test.ts passed locally, including test-root types and script lint. Required Codex autoreview completed with no accepted blocking findings. Hosted CI remains required before landing.

The first changed-file gate on an older main failed on an unrelated stale code-mode import. Refreshing to current main picked up the canonical repair in #133155; neither that fix nor its production lines are part of this diff. The affected test files, native PR owners, test runner and dependency lockfile were unchanged across the refresh.

@clawsweeper

clawsweeper Bot commented Aug 30, 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 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 07:41
@steipete steipete self-assigned this Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:48 AM ET / 07:48 UTC.

ClawSweeper review

What this changes

The PR caches immutable Git and native PR-wrapper setup templates, then copies them per test case to reduce test bootstrap time while preserving isolated mutable state.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for the maintainer-owned merge decision: the introduced test-only refactor preserves fresh mutable Git state per case and no correctness defect was found.

Priority: P3
Reviewed head: 55d28b9ffa44d04b799140d5f70980470c190c1f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, well-isolated test refactor with clear source-level preservation of the tested native boundaries.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR changes only native test infrastructure and has no user-visible behavior requiring the external contributor proof gate.
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 PR changes only native test infrastructure and has no user-visible behavior requiring the external contributor proof gate.
Evidence reviewed 6 items Immutable merge-outcome setup: The new template contains only the base repository, bare remote, and base ref; every fixture copies both and creates its source commits, remote mapping, and worktree afterward.
Fresh-main fixture isolation: The cached prefix is committed once, while each matrix case receives a private copy before it creates origin, fetch state, PR refs, worktrees, and failure proxies.
Lifecycle-owned cleanup: Both cached templates use the existing temporary-directory tracker registered with afterAll; it removes every tracked directory and retains failed removals for retry.
Findings None None.
Security None None.

How this fits together

Native PR scripts create disposable Git repositories, remotes, worktrees, and command stubs to exercise review and merge-operation behavior. These tests validate the script layer before it performs GitHub-side PR operations.

flowchart LR
  A[Test case] --> B[Immutable fixture template]
  B --> C[Private copied repository]
  C --> D[Fresh refs remotes and worktrees]
  D --> E[Native PR script]
  E --> F[Merge outcome or lock assertion]
Loading

Decision needed

Question Recommendation
After exact-head CI completes, should this maintainer-owned test-fixture performance refactor land? Land after CI: Accept the test-only optimization once required checks pass for the exact reviewed head.

Why: The protected maintainer label and member authorship require explicit maintainer handling, although the source audit found no discrete patch defect.

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +51. Total +51 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 110 59 +51
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 110 59 +51

Review metrics

Metric Value Why it matters
Production versus test LOC production 0; tests +110/-59 The entire introduced delta is test infrastructure and does not alter the PR wrapper's production behavior.

Technical review

Best possible solution:

Land the isolated-template refactor after exact-head required checks complete, retaining the per-case creation of mutable Git and PR-operation state.

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

Not applicable: this PR changes internal test bootstrap performance rather than reporting a product defect.

Is this the best way to solve the issue?

Yes: reusing only immutable setup while copying each case's repository keeps the existing corruption, attribution, recovery, and worktree scenarios isolated.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is an internal test-bootstrap performance cleanup with no product behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is an internal test-bootstrap performance cleanup with no product behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

  • Immutable merge-outcome setup: The new template contains only the base repository, bare remote, and base ref; every fixture copies both and creates its source commits, remote mapping, and worktree afterward. (test/scripts/pr-merge-outcome.test.ts:45, 55d28b9ffa44)
  • Fresh-main fixture isolation: The cached prefix is committed once, while each matrix case receives a private copy before it creates origin, fetch state, PR refs, worktrees, and failure proxies. (test/scripts/pr-operation-lock.test.ts:283, 55d28b9ffa44)
  • Lifecycle-owned cleanup: Both cached templates use the existing temporary-directory tracker registered with afterAll; it removes every tracked directory and retains failed removals for retry. (test/helpers/temp-dir.ts:85, 55d28b9ffa44)
  • Production owner and entry point: The fixture invokes the real scripts/pr wrapper, whose locked commands are supervised before dispatch to the review, prepare, and merge owners. (scripts/pr:172, c04bee452e70)
  • Current-main necessity: Current main has no change to either touched test file since the pinned base, and its merge-outcome fixture still reconstructs Git setup per invocation; this PR is not implemented or superseded on main. (test/scripts/pr-merge-outcome.test.ts:18, c04bee452e70)
  • Area history: Recent history shows Peter Steinberger maintaining both affected native PR test surfaces before this branch. (test/scripts/pr-operation-lock.test.ts:58, 8e4eb78fa20b)

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Reviewed for the maintainer-directed test-performance campaign. The latest ClawSweeper review has no actionable findings or additional pre-merge moves; its remaining maintainer decision is satisfied by this reviewed, authorized landing.

Exact source 55d28b9ffa44 passed CI 33299801259, and native preparation preserved that head. No changes to the affected tests, native script closure, runner or lockfile have appeared on main since the tested base.

Repeated measurements save about 7.3 seconds in all 140 merge-outcome cases and 1.7 seconds in the 18 fresh-main lock cases. The full pair passed 250 tests with the existing Linux-only skip locally; both affected groups also passed shuffled. Real repository mutation and failed-bootstrap cleanup probes, the full changed gate and required Codex autoreview passed. Production delta is zero; test cases, assertions, clocks, transport and sharding are unchanged.

Proceeding through the ordinary native merge flow with GitHub enforcement intact.

@steipete
steipete merged commit f120ed7 into main Aug 30, 2026
190 checks passed
@steipete
steipete deleted the codex/test-perf-native-bootstrap branch August 30, 2026 07:55
@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 size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant