Skip to content

chore: harden local Git and validation test fixtures - #1270

Merged
steipete merged 2 commits into
mainfrom
steipete/local-test-hermeticity-20260827
Aug 28, 2026
Merged

chore: harden local Git and validation test fixtures#1270
steipete merged 2 commits into
mainfrom
steipete/local-test-hermeticity-20260827

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where local Git and validation tests depend on host pruning settings, package-manager availability, or incidental setup scheduling instead of reliably exercising their intended behavior.

This is a test/docs-only follow-up to #1265. That PR already landed the three fully qualified production refspecs, basic retry-fixture isolation and exactly-two-attempt assertion, command-test pruning setup, and shallow helper coverage. This PR does not claim those production fixes again.

Why This Change Was Made

The remaining fixtures prove stale tracking-ref updates and branchHasBaseDiff shallow-history recovery under both pruning settings, exercise real target-validation commands, and explicitly set fetch.prune=false for remote-only cases. Deadline fixtures account for completed setup/command phases while retaining actual subprocess execution, a real timeout, tracked-file mutation detection, and clean-checkout assertions. The test-owned package-script runner is generalized without changing the six existing pinned-base scenarios.

Only README and three test files change: +252/-102 lines. The src/** diff is empty. Upstream production behavior, absent-lockfile coverage, timeout/retry/security/offline gates, dependencies, suite concurrency, and coverage thresholds remain unchanged.

User Impact

No production behavior change. Developers get fixtures that test the intended pruning, retry, and identity boundaries with less dependence on local setup timing. No global Git or package-manager configuration changes are required.

OpenClaw Bay Impact

None: no queue, lifecycle, review-publication, status, dashboard, or UI contract changes.

Documentation Impact

Reviewed README, CONTRIBUTING.md, AGENTS.md, and the documentation index. README's active Safety Model now explains the already-landed qualified-refspec behavior. ClawSweeper maintainers own that explanation; its source of truth is the review runtime and shared repair fetch helper, verified at the head below. Revisit it when those fetch contracts change. No duplicate changelog entry is needed for this test hardening.

Evidence

Validated head: a6089c4eff7d29b53fdbd2e9470c4710050728de.
Base: d103c0cf5c98b0f3d4242bb4202c032856c36a49 (main).

Native macOS, Node 24.20.0, Git 2.55.0, repository-pinned pnpm 11.10.0. No install or global configuration changes were made for these runs. Independent committed-branch inspection and isolated Codex review reported no P0 findings.

Validation on this head Result
Three complete touched test files 235 total: 232 passed, 0 failed, 3 skipped
Original 53-case regression selection 53 passed, 0 failed/skipped
Dedicated general/remote-only pruning replay, host Git config disabled 6 passed, 0 failed/skipped
Six pinned-base fixtures plus retry with failing host pnpm/Corepack sentinels 7 passed; neither sentinel invoked
Shared-runtime-budget and real-timeout mutation cases, 12 repetitions each across four processes 24/24 passed
Setup-deadline case, 12 repetitions across four processes 12/12 passed
Four retry/identity mutations All five expected negative assertions failed for their intended reasons
First normal full check 3,857 total: 3,845 passed, 2 failed, 10 skipped
Two focused covered reruns of those unchanged terminal cases 2/2 then 2/2 passed (4/4 total)
One explicitly authorized normal full-check retry 3,857 total: 3,847 passed, 0 failed, 10 skipped; exit 0

The first full check failed in unchanged test/live-proof-review-environment.test.ts: the original-pane and consecutive-command cases exceeded the terminal cleanup polling allowance. The failing test and driver/helper bytes match the captured base. Both focused reruns and both cases in the final full retry passed without code changes. Host timing is plausible, but the terminal cause remains unknown and is not fixed by this PR. The original failure remains part of the evidence, not a discarded attempt.

Both full checks used normal inherited fetch.prune=true, unchanged concurrency16, coverage thresholds, and budgets. The successful retry also passed static checks, builds, lint, formatting, docs checks, and the separate 12-test coverage stage. Overall retry coverage: 82.22% lines, 74.64% branches, 87.67% functions.

An additional optional setup-budget mutant was rejected with an identity-deadline error instead of the fixture's required setup-deadline error. A scratch driver's prediction of Missing expected exception was over-specific and failed; that driver was not changed or rerun. This is recorded only as an observed mutant rejection, not as a green harness or proof of a complete fresh-global-deadline mutation. It is excluded from the five core negative assertions above.

Real Behavior Proof

Claim and surface: actual local Git repositories and validator/package-script subprocesses preserve requested refs and exercise retries, shared deadlines, real command timeout, and post-command identity checks under explicit pruning, missing host package managers, and setup contention. The changed surface is the fixture behavior, not a production contract.

Scenarios and observations: a stale origin/main updates to the new remote commit; a shallow feature checkout initially lacks a merge base, then recovers it through branchHasBaseDiff without losing the base ref. Target validation reaches its real Node script and retains the base ref and a clean checkout. The retry script runs exactly twice. Setup phases consume the shared budget before install. The runtime-budget case runs once and preserves the actual transient error as its cause. The mutation script changes a tracked file, writes mutated, stays alive until the real supervisor timeout, then records terminated on macOS; the validator reports the required checkout-identity mutation error.

Reproduce the complete touched-file surface after building, using Node24 and the repository's pinned pnpm:

pnpm run build:node
node --test --test-reporter=tap \
  test/command.test.ts \
  test/repair/git-repo-utils.test.ts \
  test/repair/target-validation.test.ts

GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_COUNT=0 \
node --test --test-reporter=tap \
  --test-name-pattern='base fetch updates its requested ref|target validation preserves its base ref|local exact review explains when GitHub item is not open|local exact review selects PATH Codex' \
  test/command.test.ts \
  test/repair/git-repo-utils.test.ts \
  test/repair/target-validation.test.ts

pnpm run check

For the contention replay, the two selected cases are changed validation shares one timeout with checkout identity proof and validation reserves deadline to prove checkout mutation after command timeout; each was repeated 12 times in four concurrent test processes with process-local fetch.prune=false and remote.origin.prune=true. This diagnostic replay did not alter suite concurrency. The no-host replay selected the six pinned-base cases and the transient retry case with failing sentinel executables prepended to PATH. Child-local loader controls disabled retry, renewed the retry deadline, removed the identity proof window, or skipped the post-command identity check; each fixture rejected the corresponding broken behavior without modifying source files.

Compact normalized trace from the executed runs:

three files: tests=235 pass=232 fail=0 skipped=3
isolated pruning: tests=6 pass=6 fail=0 skipped=0
no-host: pass=7 pnpm_invocations=0 corepack_invocations=0
retry: attempts=2 checkout=clean
shared budget: attempts=1 cause=transient changed gate failure
timeout mutation: phases=mutated,terminated; error=mutated checkout identity
contention: timing=24/24 setup=12/12
core negative controls: expected_assertion_failures=5 observed=5
full attempt 1: pass=3845 fail=2 skipped=10
focused covered terminal reruns: pass=2 then pass=2
full attempt 2: pass=3847 fail=0 skipped=10 exit=0

Limits: native macOS proof only; platform skips remain. No Windows or Linux containment claim, live automation/review/apply execution, or real package-manager download/install claim. The focused selections overlap and are not additive unique-test counts. No terminal cleanup fix or proven contention root cause is claimed.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. 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 27, 2026, 7:57 PM ET / 23:57 UTC.

ClawSweeper review

What this changes

The branch adds local Git and validation-fixture coverage for pruning, shallow-history recovery, timeout handling, retry isolation, and checkout identity checks, plus a README safety note.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. This narrow test/docs follow-up adds regression coverage not present on current main for the already-landed qualified-ref fetch behavior; no introduced correctness or security defect was found.

Priority: P3
Reviewed head: a6089c4eff7d29b53fdbd2e9470c4710050728de

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The PR has strong focused runtime-fixture proof and a contained test/docs implementation with no supported blocker.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides exact-head terminal evidence from real disposable Git repositories and validator subprocesses, with observed after-fix pruning, retry, timeout, and identity outcomes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides exact-head terminal evidence from real disposable Git repositories and validator subprocesses, with observed after-fix pruning, retry, timeout, and identity outcomes.
Evidence reviewed 5 items Introduced scope: The verified introduced delta changes one README section and three focused test files only: tests are +248/-102 lines and documentation is +4 lines; no src runtime file is changed.
Current implementation contract: Current code fetches the requested base through a fully qualified refs/heads refspec before computing a merge base; target validation invokes this helper when it has no pinned base.
Focused regression coverage: The new test iterates over both fetch.prune and remote.origin.prune, verifies the updated tracking ref, then verifies shallow-history recovery through branchHasBaseDiff.
Findings None None.
Security None None.

Live Verification

Command: pnpm run build:node

Result: PASS (completed)

# hint: to use in all of your new repositories, which will suppress this warning,
# hint: call:
# hint:
# hint: \\tgit config --global init.defaultBranch ‹name›
# hint:
# hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
# hint: 'development'. The just-created branch can be renamed via this command:
# hint:
# hint: \\tgit branch -m ‹name›
# hint:
# hint: Disable this message with "git config set advice.defaultBranchName false"
# To /tmp/clawsweeper-live-proof-1270-VNyYrT/profile/tmp/clawsweeper-validation-origin-OKJZOS
#  * [new branch]      main -› main
# hint: Using 'master' as the name for the initial branch. This default branch name
# hint: will change to "main" in Git 3.0. To configure the initial branch name
# hint: to use in all of your new repositories, which will suppress this warning,
# hint: call:
# hint:
# hint: \\tgit config --global init.defaultBranch ‹name›
# hint:
# hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
# hint: 'development'. The just-created branch can be renamed via this command:
# hint:
# hint: \\tgit branch -m ‹name›
# hint:
# hint: Disable this message with "git config set advice.defaultBranchName false"
# To /tmp/clawsweeper-live-proof-1270-VNyYrT/profile/tmp/clawsweeper-validation-origin-0sm8PU
#  * [new branch]      main -› main
# Subtest: target validation preserves its base ref with fetch.prune=true
ok 3 - target validation preserves its base ref with fetch.prune=true
  ---
  duration_ms: 524.842947
  type: 'test'
  ...
# Subtest: target validation preserves its base ref with remote.origin.prune=true
ok 4 - target validation preserves its base ref with remote.origin.prune=true
  ---
  duration_ms: 460.429792
  type: 'test'
  ...
1..4
# tests 4
# suites 0
# pass 4
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 1383.830197

Assertions:

  • PASS expect_output: base fetch updates its requested ref with fetch.prune=true
  • PASS expect_output: target validation preserves its base ref with remote.origin.prune=true

How this fits together

ClawSweeper’s review and repair lanes fetch a target branch, run approved validation commands, and verify that validation did not alter the checkout. These fixtures protect the Git-ref and validation boundaries that produce safe repair and review evidence.

flowchart LR
  A[Repair or review target] --> B[Local Git checkout]
  B --> C[Base branch fetch]
  C --> D[Validation command runner]
  D --> E[Checkout identity check]
  E --> F[Review and repair evidence]
Loading

Before merge

  • Complete next step (P2) - No mechanical repair is indicated; this PR needs ordinary exact-head review and required-check completion.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Test and docs delta tests +248/-102; docs +4; production +0 The branch is confined to fixture hardening and documentation rather than changing runtime behavior.

Technical review

Best possible solution:

Keep the production refspec implementation and land these focused regression fixtures after normal exact-head review and required checks complete.

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

Not applicable: this PR adds fixture coverage for an already-landed fetch contract rather than repairing a currently reported user failure.

Is this the best way to solve the issue?

Yes: the coverage is placed in the narrow existing command, Git-helper, and target-validation test files while leaving the established runtime contract unchanged.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is low-risk developer-facing fixture and documentation hardening with no production behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head terminal evidence from real disposable Git repositories and validator subprocesses, with observed after-fix pruning, retry, timeout, and identity outcomes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides exact-head terminal evidence from real disposable Git repositories and validator subprocesses, with observed after-fix pruning, retry, timeout, and identity outcomes.

Label justifications:

  • P3: This is low-risk developer-facing fixture and documentation hardening with no production behavior change.
  • 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 (terminal): The PR body provides exact-head terminal evidence from real disposable Git repositories and validator subprocesses, with observed after-fix pruning, retry, timeout, and identity outcomes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head terminal evidence from real disposable Git repositories and validator subprocesses, with observed after-fix pruning, retry, timeout, and identity outcomes.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the merged qualified-ref implementation and the current follow-up commits. (role: introduced current fetch behavior and recent area contributor; confidence: high; commits: 2129a78a502e, 63873d5b9e99, a6089c4eff7d; files: src/repair/git-repo-utils.ts, src/repair/target-validation.ts, test/repair/git-repo-utils.test.ts)
  • corvid-reads: Milton’s merged target-setup work is recent history for the validation helper exercised by these fixtures. (role: recent adjacent contributor; confidence: medium; commits: 7f9e3f99e312; files: src/repair/git-repo-utils.ts, src/repair/target-validation.ts)

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
steipete merged commit 0b3a125 into main Aug 28, 2026
20 checks passed
@steipete
steipete deleted the steipete/local-test-hermeticity-20260827 branch August 28, 2026 00:22
@steipete
steipete restored the steipete/local-test-hermeticity-20260827 branch August 28, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant