Skip to content

test: reuse immutable worktree containment history - #133197

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

steipete merged 1 commit into
mainfrom
codex/test-perf-containment-history

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The 38 native worktree-containment tests repeatedly rebuild the same two Git histories before each scenario. That startup work adds execution time without adding a new state transition to the tests.

Why This Change Was Made

Build each immutable history once, then copy the complete repository into an independently owned case directory. Both templates stop before origin configuration or fetching; each case retains its original origin, real fetch, sibling branch and commit, and all subsequent worktree, failure, recovery and foreign-state operations.

Templates have separate after-all cleanup, while cases retain their existing after-each cleanup. Initialization is registered before it starts, and only successful templates are cached. Full copies retain every Git object and ref without hardlinks, alternates, linked worktrees or relocated fetch metadata. This removes 414 repeated bootstrap Git launches.

User Impact

Internal tests only. Four full-file runs passed all 38 cases: before 32.244s, after 28.093s, after 30.797s, before 31.508s. Mean elapsed execution fell from 31.876s to 29.445s: about 2.43 seconds, or 7.6%. Template creation is included. This is a focused local result, not a claim about total CI duration.

Production delta is zero; test support is +27/-5. All test cases, assertions and bytes from the first scenario helper onward are unchanged. No sharding, concurrency, clocks, mocks, dependency or product changes. No changelog entry is needed for this internal test change.

Evidence

  • All 38 cases passed in every before/after run and in shuffled order with seed 93190.
  • An actual-helper probe compared baseline, cold and warm repositories: configuration, fetch metadata, refs, HEAD, index, trees and status match after normalizing temporary paths and commit identities.
  • File identity checks prove independent copies. Ref/config/hook mutations and real worktree creation/removal in one case leave the other cases and template unchanged. A later copy still matches the baseline.
  • Injected Git bootstrap failures leave both caches unpublished and all partial directories registered for cleanup. Registered cleanup removed every case and template directory.
  • Current-main preflight found the tested native owners, runner, dependency lockfile and containment test unchanged from the measured baseline.
  • Full changed-file gate and required Codex autoreview passed. Independent source review found no actionable ownership, cleanup or relocation issue.

Hosted CI will be checked at the published head before ordinary native landing.

@steipete steipete self-assigned this Aug 30, 2026
@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: XS maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 08:44
@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 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, 4:56 AM ET / 08:56 UTC.

ClawSweeper review

What this changes

The PR creates each immutable Git fixture history once and copies it into independently mutable repositories for every worktree-containment test case.

Merge readiness

✅ Ready for maintainer review

Keep open. This is a coherent maintainer-owned, test-only performance refactor; source review found no introduced correctness or isolation defect, and it remains awaiting normal exact-head CI completion.

Priority: P3
Reviewed head: 317c2e20f4977942a5ae14f1170adefdf38e8c88

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The narrow test-only patch cleanly preserves case-local mutable Git state and has no actionable source-review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned internal test-only PR is exempt from the external-contributor real-behavior gate; its body reports repeated full-file runs, while source review confirms the changed owner is fixture construction.
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 internal test-only PR is exempt from the external-contributor real-behavior gate; its body reports repeated full-file runs, while source review confirms the changed owner is fixture construction.
Evidence reviewed 6 items Introduced surface: The verified merge-base-to-head delta changes only the containment test fixture setup; no production or script runtime code is introduced.
Per-case isolation retained: Both templates stop before remote configuration; each copied repository then configures its own origin, fetches it, and creates its own mutable sibling branch and commit.
Cleanup ownership: Template directories use a separate after-all tracker, while case directories remain registered on the existing after-each tracker; the shared helper removes only registered paths.
Findings None None.
Security None None.

How this fits together

The worktree-containment suite creates disposable Git repositories and invokes the pull-request worktree scripts against them. Each copied case then performs its own remote setup, fetches, branch changes, and worktree operations before assertions inspect containment and recovery behavior.

flowchart LR
A[Immutable Git history template] --> B[Independent case repository]
B --> C[Case-specific origin and fetch]
C --> D[Worktree and review scripts]
D --> E[Containment and recovery assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +22. Total +22 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 27 5 +22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 27 5 +22

Review metrics

Metric Value Why it matters
Production versus test LOC production 0; tests +27/-5 All introduced lines are fixture setup in one test file; production worktree behavior is unchanged.

Technical review

Best possible solution:

Retain the single immutable-template pattern and merge once exact-head CI confirms the unchanged containment scenarios remain green.

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

Not applicable: the PR changes internal test-fixture construction rather than addressing a user-reported runtime failure.

Is this the best way to solve the issue?

Yes. Caching only the immutable pre-remote history and copying it before mutable Git state exists preserves the test's per-case ownership boundary more directly than sharing a repository or reusing worktrees.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is isolated test-suite startup optimization with no product, provider, or user-visible behavior change.
  • 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: This maintainer-owned internal test-only PR is exempt from the external-contributor real-behavior gate; its body reports repeated full-file runs, while source review confirms the changed owner is fixture construction.

Label justifications:

  • P3: This is isolated test-suite startup optimization with no product, provider, or user-visible behavior change.
  • 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: This maintainer-owned internal test-only PR is exempt from the external-contributor real-behavior gate; its body reports repeated full-file runs, while source review confirms the changed owner is fixture construction.

Evidence

What I checked:

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

Copy link
Copy Markdown
Contributor Author

Maintainer review complete for 317c2e20f4977942a5ae14f1170adefdf38e8c88. The latest ClawSweeper review has no actionable findings or remaining before-merge moves. Its outstanding exact-head CI condition is now satisfied by CI 33302326214, and native preparation preserved the reviewed commit.

The repeated full-file measurements show a modest 2.43-second mean execution reduction with all 38 cases retained. Independent copies preserve the real per-case origin, fetch, sibling history, worktree mutations and cleanup. No production, assertion, timeout, worker, concurrency or sharding changes. Proceeding through ordinary native landing under the requested automatic-landing workflow.

@steipete
steipete merged commit 3306b62 into main Aug 30, 2026
197 checks passed
@steipete
steipete deleted the codex/test-perf-containment-history branch August 30, 2026 08:58
@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: 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