Skip to content

test: isolate backup scratch roots between test files - #176624

Merged
steipete merged 1 commit into
mainfrom
dbasync/txnelide-backup
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
dbasync/txnelide-backup

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes intermittent backup test failures when parallel test files reclaim each other's temporary scratch directories.

Related: #176500

User Impact

No user-visible behavior changes. Backup creation and config-capture tests can run together without sharing their maintenance root.

Why This Change Was Made

Both files previously used the system temporary directory. maintainBackupScratch in one file could retire a directory created by the other between directory creation and staging-token acquisition, causing SQLite snapshot parent retired; aborting snapshot allocation.

Give each test a tracked temporary root through the existing TMPDIR/TMP/TEMP selection, using the existing backup test-support module. Remove the redundant single-case scratch override. Production code, staging refusal, cleanup semantics, and all archive/restore assertions remain unchanged; the existing retired-scratch refusal regression stays intact.

Production LOC: 0 changed. Test LOC: +18/-6 (net +12). No SQL, worker-request, MAIN, or latency change claimed.

Evidence

The original failure is CI job 117803063851: config capture failed while backup creation was running in the same shard. The original Node comparison passed on exact main and the lease-release merge, supporting the cross-file fixture diagnosis rather than a lease-release regression.

Focused type-aware lint, formatting, and diff checks pass. Two independent Codex review rounds are scoped-clean with no actionable findings; the second covers the shared-helper adjustment required by the line-cap hook.

Ordinary exact-head CI passes all 34 selected checks, including type checking, lint, source contracts, architecture, ratchets, all three PostgreSQL conformance shards, and the changed tests. The two fixture files pass 75/75 tests on Bun in that run.

The local paired Node run passes 75/75 tests with backup-create first, both files in one invocation with two workers and an internal-disk TMPDIR. The previously failing external-config case passes while backup-create is active. Worker preparation dominated the 1,093-second run; this is correctness evidence, not a performance measurement. The parent wrapper was interrupted, so its exit code is unavailable; the surviving native child emitted the complete passing summary and completed its cleanup. The paired Bun run also passes 75/75 tests in 458.74 seconds with the same file order and two workers. The existing scratch suite passes 14/14 on Node, including retired-scratch refusal. Bun and scratch wrappers both exit 0; all task-owned test processes have settled.

Supplemental dependency scan: all 87 diagnostic lines are present on scheduled main, with zero new findings. Unused exports: production 61 versus main 62, full-tree 36 versus main 39, scripts 0 versus 0. The remaining supplemental work was cancelled after collecting that missing gate. An earlier supplemental dispatch rejected incompatible main-validation and PR-release-gate options in preflight; the corrected dispatch above supplied the evidence without a code change.

@clawsweeper

clawsweeper Bot commented Oct 18, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T23:37:54.347470Z 28bd644 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR gives backup creation and config-capture tests separate temporary roots and removes a redundant case-specific override.

Example: Backup creation and config-capture test files run in parallel.

  • Before: Both inspect the system temporary directory, allowing one file to retire the other's newly allocated scratch directory.
  • After: Each test uses its own tracked temporary root, keeping scratch maintenance separate.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The fixture change is focused and source-consistent, but successful execution of the changed setup has not yet been established.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored, test-only patch is outside the contributor runtime-proof gate; its body records pending paired-file verification rather than a successful after-fix run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Backup CI can fail intermittently when parallel test files inspect each other's temporary scratch directories.
Reason: The maintainer-directed repair addresses a recorded failure without weakening assertions or changing production cleanup behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed fixture repair addresses a recorded CI failure, and inspection found no introduced correctness defect.

Priority: P3
Reviewed head: 28bd644b2a15f9e4156a3f88597b9cf2fce6dbad

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Paired-file Node/Bun verification of this head is still pending; no shipped-product E2E is needed for this fixture-only change.
Agent review details

How this fits together

Backup integration tests construct isolated state, invoke archive creation and restore, and inspect the resulting files; archive creation selects its scratch-maintenance root through os.tmpdir().

flowchart TD
  A[Backup creation tests] --> C[Shared test fixture helper]
  B[Config capture tests] --> C
  C --> D[Per test temporary root]
  D --> E[Archive creation and scratch maintenance]
  E --> F[Archive and restore assertions]
Loading

Technical review

Best possible solution:

Keep fixture isolation in the existing shared test-support module while preserving production staging refusal and all archive assertions.

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

The original CI trace confirms retired scratch during config capture, and source exposes the shared-root allocation window; the cross-file timing diagnosis was not independently reproduced during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete fixture repair: use the existing tracked-directory owner for both affected files, retain their restoration hooks, and remove the superseded override.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7342277809d0.

Provenance checked

  • Shared backup test support keeps the original intent (01457af: Existing support consolidates synthetic backup fixtures while retaining real archive behavior; the new helper uses that same test-only boundary.)
  • Case-specific scratch isolation keeps the original intent (6871f81: The prior fixture override kept concurrent scratch warnings out of the foreign-SQLite case; suite-wide per-case isolation now preserves that purpose.)
  • Config include capture coverage keeps the original intent (01cf08f: The suite protects complete authored config-include capture and restore; its assertions remain intact.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 01457af adds src/infra/backup-create.test-support.ts:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 01457af6876f; files: src/infra/backup-create.test-support.ts)
  • Jason (Json): Raw commit 01cf08f adds src/infra/backup-config-capture.test.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 01cf08fd4522; files: src/infra/backup-config-capture.test.ts)

PR surface

Tests +12. Total +12 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 18 6 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 18 6 +12

Review metrics

Metric Value Why it matters
Production versus test LOC Production +0/-0; tests and test support +18/-6 The small fixture increase reuses existing cleanup ownership and replaces the isolated single-case override.

Labels

Label changes:

  • add P3: This is a bounded test-fixture reliability repair with no production behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a bounded test-fixture reliability repair with no production behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete paired-file Node/Bun verification on the reviewed head.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 18, 2026, 7:49 PM ET / 23:49 UTC.

@steipete
steipete merged commit 77a403f into main Oct 19, 2026
240 of 257 checks passed
@steipete
steipete deleted the dbasync/txnelide-backup branch October 19, 2026 00:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
Give backup creation and config capture tests separate tracked temporary roots so scratch maintenance cannot retire another test file's active staging directory. Remove the redundant per-case root override.

Production behavior, scratch-refusal protection, and archive/restore assertions are unchanged. Ordinary CI and focused static checks pass; dependency scan findings match scheduled main. Two Codex review rounds found no actionable issues.
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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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