Skip to content

fix: preserve backup fixture inputs after cleanup fails - #187547

Merged
shakkernerd merged 1 commit into
mainfrom
ci-backup-fixture-retention
Oct 29, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
ci-backup-fixture-retention

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #187525.

What Problem This Solves

Backup test cleanup could remove fixture inputs after a retained shared-state reader failed to close. The generic state fixture correctly refused disposal, but an independent cleanup hook recursively deleted its parent afterward.

User Impact

Backup fixtures now retain their input paths when resource cleanup fails, and ordinary successful disposal removes both the fixture and its scratch directory. This change is confined to test infrastructure; the existing backup, config-capture, and hardlink assertions remain intact.

Why This Change Was Made

Scratch now belongs to the existing state fixture through isolateBackupScratch, so one owner decides when its inputs can be removed. The shared adapters preserve the generic fixture's options, the backup family's defaults, and arguments supplied to parameterized cases. Already-isolated family consumers keep their existing setup.

The regression exercises a real backup discovery snapshot and registered read transport. It keeps close failing through the actual teardown hooks, checks retained input bytes, then restores close and verifies supported snapshot retirement before removing its test-owned cache. The oversized backup-create caller shrinks; the regression lives with the existing hardlink fixture tests.

Evidence

  • On e3eae277, the relocated regression fails because the retained marker is missing after teardown; all original 15 hardlink cases pass. The same regression passes with this change, including recovery and ordinary scratch cleanup.
  • All 17 selected helper-consumer and retained-owner test files pass: 240 cases in a 166.1s batch. Formatting/parity, lint, selected type groups, line caps, and canonical test-line accounting pass.
  • The single allocation covers 122 net test lines for the missing teardown-boundary regression and fixture composition. Existing assertions, skips, timeouts, and runtime settings are preserved.

The completed owning Bun job passes the new regression and all 15 prior hardlink cases. The regression takes 5.3s; the hardlink file takes 20.85s and config capture takes 13.12s. The backup-create job passes all 58 cases in 69.50s, mostly transformation time. These are measurements of the CI merge composition, not a performance comparison.

The full hosted result is tracked in CI run 40848905693. The evidence establishes the conditional fixture-cleanup defect; it does not identify an earlier deleting actor or establish a production race.

@shakkernerd shakkernerd self-assigned this Oct 29, 2026
@clawsweeper

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

@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. P2 Normal backlog priority with limited blast radius. 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 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes backup scratch directories belong to the state fixture so failed resource cleanup preserves fixture inputs.

Example: A backup reader repeatedly refuses to close while retained-input.txt contains "retained fixture input\n".

  • Before: The enclosing cleanup hook deletes the file despite the state fixture refusing disposal.
  • After: The file remains readable until the retained reader settles; successful fixture disposal removes its scratch directory.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused fixture-boundary regression and passing changed-test CI support a coherent repair; proof is confined to the in-process test infrastructure.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-infrastructure PR exercises real backup discovery and reader ownership through an in-process regression, with reported base failure and fixed-head success.
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 test teardown can delete inputs that a failed reader cleanup deliberately retained.
Reason: The maintainer-authored repair restores one cleanup owner and adds a distinct failure-boundary regression without expanding product scope.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a concrete fixture cleanup defect, and no actionable introduced bug was found.

Priority: P2
Reviewed head: 75216451ea42e8c867a3076e7e4eff05e0f1640b

Before merge

None.

Findings

None.

Agent review details

How this fits together

Backup tests create isolated state and scratch directories, run archive discovery and SQLite readers, then dispose resources before deleting their input files.

flowchart TD
  A[Backup test case] --> B[State fixture]
  B --> C[Fixture owned scratch]
  B --> D[Backup discovery reader]
  D --> E[Resource cleanup]
  E --> F[Retain inputs on failure]
  E --> G[Remove fixture on success]
Loading

Technical review

Best possible solution:

Keep scratch under the existing state fixture’s disposal barrier and retain the teardown regression and successful-cleanup control.

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

The source exposes the independent parent-deletion path described in the linked report, and the supplied regression exercises that teardown boundary; no code was executed during this review.

Is this the best way to solve the issue?

The change uses the existing scratch and state owners, preserves fixture defaults and parameterized arguments, and removes the competing deletion path without changing production behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4e846533cd2b.

Provenance checked

  • Backup scratch isolation changes intended behavior with a stated reason (77a403f: Prevent parallel backup test files from reclaiming each other’s scratch directories.)
  • Hardlink fixture isolation keeps the original intent (e3eae27: Apply per-case scratch isolation to the hardlink fixture family while preserving existing backup assertions.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Tests +122, Other +2. Total +124 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 151 29 +122
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 5 153 29 +124

Root-cause cluster

Relationship: same_root_cause
Canonical: #187525
Summary: This PR directly repairs the fixture input-custody defect documented in the linked issue.

Members:

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

Labels

Label changes:

  • add P2: This repairs conditional loss of test fixture inputs after cleanup failure, with impact confined to backup test infrastructure.
  • 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:

  • P2: This repairs conditional loss of test fixture inputs after cleanup failure, with impact confined to backup test infrastructure.
  • 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.

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 29, 2026, 5:35 AM ET / 09:35 UTC.

@shakkernerd
shakkernerd merged commit c4ef533 into main Oct 29, 2026
140 checks passed
@shakkernerd
shakkernerd deleted the ci-backup-fixture-retention branch October 29, 2026 09:50
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: backup fixtures preserve their inputs when reader cleanup fails and remove owned scratch after successful disposal.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
)

Keep backup scratch under the state fixture so failed reader cleanup retains its inputs and successful disposal removes the owned scratch.

Fixes openclaw#187525.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

[Bug]: Backup test cleanup deletes inputs after retained reader close fails

1 participant