Skip to content

refactor(tests): share nested Git environment setup - #145259

Merged
steipete merged 2 commits into
mainfrom
codex/perf19-nested-git-env
Sep 11, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/perf19-nested-git-env

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #145258

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Four script-test suites maintain identical environment builders for temporary Git repositories. Those copies can drift and handle inherited Git variables inconsistently.

Why This Change Was Made

The existing temporary-repository helper now owns the shared builder. Each call still creates a fresh environment copy, clears the same six Git variables, disables system Git configuration and terminal prompts, and preserves each caller's overrides. All four suites use that owner; broader environment scrubs elsewhere remain unchanged.

User Impact

Production behavior is unchanged. The refactor removes 58 net test/support lines while retaining the existing test assertions and environment behavior. No performance improvement is claimed.

Evidence

All 370 tests across the four affected suites passed. The 17 selected checks passed, including formatting, typechecking, and linting. The P2 review completed with no actionable findings, and the recorded diff check passed.

The selected gate ran with its default origin/main base. A supplemental warning-only temp-creation report explicitly compared committed ad439abc01eb575399fa2c9d0d892668ddb99403 to itself and reported no warnings. That report covered committed-branch semantics only; it did not inspect the then-uncommitted candidate edits. The remaining 16 selected checks, focused tests, and review were reused unchanged. No assertion-safety or max-lines ratchet applies to these five test/** paths, and neither appeared in the saved check plan.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 size: S maintainer Maintainer-authored PR labels Sep 11, 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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 5:55 PM ET / 21:55 UTC (Revision 3).

ClawSweeper review

What this changes

The PR shares temporary Git repository environment setup across four script-test suites while preserving their existing behavior.

Merge readiness

✅ Ready for maintainer review

The cleanup remains useful because current main still contains the duplicate builders. No actionable correctness or security findings remain, and the maintainer-authored PR should proceed through normal review.

Priority: P3
Reviewed head: b3eb09dbd5e8a3d3bec0a0238651ee93a0d62109

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving extraction with reported targeted validation and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from external-contributor runtime proof; this test-only extraction changes no production owner or authority boundary. Reported focused tests are supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from external-contributor runtime proof; this test-only extraction changes no production owner or authority boundary. Reported focused tests are supplemental validation.
Evidence reviewed 7 items Behavior-preserving extraction: The complete pinned introduction diff moves the identical builder into the existing helper and replaces all four local definitions with imports. Environment copying remains inside the function, caller overrides remain unchanged, and no assertions or production files change.
Still useful on current main: Fetched main retains all four local createNestedGitEnv definitions. The other similarly named scrubs cover additional Git variables and are intentionally outside this extraction.
Latest-release comparison: The helper at v2026.9.4 contains only the JSON-writing utility; the proposed shared environment builder is absent.
Findings None None.
Security None None.

How this fits together

OpenClaw’s script tests create temporary Git repositories to validate development checks. The shared helper prepares child-process environments so inherited Git paths do not redirect those tests into another repository.

flowchart LR
  A[Process environment] --> B[Shared test environment helper]
  B --> C[Copy environment and clear six Git variables]
  C --> D[Apply caller overrides]
  D --> E[Git and script subprocesses]
  E --> F[Existing test assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -58. Total -58 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 25 83 -58
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 25 83 -58

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #145258
Summary: This PR implements the exact consolidation requested by the linked open issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep one shared owner for the identical six-variable environment contract while preserving the broader scrubs used by other tests.

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

Not applicable: this is a refactor, and current-main source directly confirms the duplicated setup it addresses.

Is this the best way to solve the issue?

Yes. Moving the identical builders into the existing helper removes duplication without changing environment timing, overrides, or assertions.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a low-risk test-support cleanup with no production 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: The verified repository-admin author is exempt from external-contributor runtime proof; this test-only extraction changes no production owner or authority boundary. Reported focused tests are supplemental validation.

Evidence

What I checked:

  • Behavior-preserving extraction: The complete pinned introduction diff moves the identical builder into the existing helper and replaces all four local definitions with imports. Environment copying remains inside the function, caller overrides remain unchanged, and no assertions or production files change. (test/helpers/temp-repo.ts:14, b3eb09dbd5e8)
  • Still useful on current main: Fetched main retains all four local createNestedGitEnv definitions. The other similarly named scrubs cover additional Git variables and are intentionally outside this extraction. (test/scripts/check-dependency-pins.test.ts:22, 63de507edf6f)
  • Latest-release comparison: The helper at v2026.9.4 contains only the JSON-writing utility; the proposed shared environment builder is absent. (test/helpers/temp-repo.ts:5, 3a9d69db306c)
  • Prior review continuity: The supplied completed review has no findings or published rank-up moves. Local comparison with the earlier reviewed head failed because a required Git object was unavailable; the GitHub comparison returned no changes to the five reviewed paths. (b3eb09dbd5e8)
  • Maintainer status verified: Although the pull endpoint reports CONTRIBUTOR, the repository permission endpoint confirms steipete has admin permission. The PR also carries the protected maintainer label.
  • Relevant merged history: Current-main history shows prior helper maintenance by Peter Steinberger and dependency-test maintenance by Vincent Koc. GitHub commit metadata maps those contributors to steipete and vincentkoc. Deeper follow and blame inspection encountered unavailable historical blobs, so no source-line introduction attribution is asserted. (test/helpers/temp-repo.ts, f72782d87b0c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: 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-11T20:50:14.232Z sha 52be4ec :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-11T21:01:13.292Z sha 52be4ec :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 11, 2026 20:57
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@steipete
steipete merged commit 6fade53 into main Sep 11, 2026
118 checks passed
@steipete
steipete deleted the codex/perf19-nested-git-env branch September 11, 2026 22:17
@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.

Script tests duplicate temporary Git environment setup

1 participant