Skip to content

fix: harden destructive cleanup and run finalization - #2

Merged
Steel-tech merged 9 commits into
mainfrom
wave0/swarm-safety
Jul 28, 2026
Merged

fix: harden destructive cleanup and run finalization#2
Steel-tech merged 9 commits into
mainfrom
wave0/swarm-safety

Conversation

@Steel-tech

Copy link
Copy Markdown
Contributor

Summary

  • add digest-bound recursive ignored-file cleanup preview/apply with one-use approvals
  • key locks, active-run resolution, and live-manifest scans to physical repository identity
  • verify every detached harvest cleanup resource before removal and fail closed on foreign/corrupt state
  • protect all live-run backups and remove destructive current-branch fallback behavior
  • make Abort/full-Harvest archival idempotent, strict, and retryable
  • preserve exact approval retry across workspace aliases and retained ignored harvest generations
  • replace the manifest validator's undeclared Python dependency with zero-dependency Node validation

Verification

  • exact reviewed head: 18fcc7b2958ff6001831d7986ab8f2e3dfe7b7ba
  • 225/225 tests on Node 24 and minimum Node 20.20.2
  • hosted CI: https://github.com/StructuPath/herdr-swarm/actions/runs/30349398711
  • adversarial foreign-resource, cross-repository context, corrupt-state, approval replay, crash/finalization, and legacy quarantine reproductions pass
  • independent final review found no blocker, high, or medium findings

Safety boundary

The controls provide cooperative same-user integrity, not an OS authorization boundary. A filesystem writer can still race after the immediate recheck enters an external Git/Herdr operation.

Run the existing test suite and shell syntax checks on Ubuntu with Node 20 using immutable official action pins and read-only repository permissions.

Add a dependency-free manifest validator and focused coverage for TOML parsing, version parity, local entrypoint containment, existence, and executable bits.
Update the active-run fixture to reference the real temporary repository now that preflight validates physical repository identity. This keeps the legacy fan-out refusal test exercising the repository-scoped live-manifest scan instead of failing during fixture identity resolution.
Route every detached harvest-worktree cleanup through one fail-closed verifier that binds repository, run, slot, canonical generation path, HEAD, registration, journal ownership, and recursive ignored inventory. Resolve the exact live manifest across workspace aliases under the repository lock and quarantine unresolved foreign legacy archives without blocking unrelated repositories.\n\nMake Abort propagate post-removal bookkeeping failures and require the exact completed archive, fsync one-use approval directories, replace the Python TOML validator with zero-dependency Node, document scripted cleanup, and add parity regressions across every removal and failure path.
Make explicit plugin repository context authoritative and require every workspace-named legacy hint to match the exact live generation selected under the repository lock. Conflicting context now fails before Harvest, Status, or Abort can mutate either repository.\n\nDefer terminal slot archival while a detached harvest journal remains, retain exact cleanup approvals across Abort retries, and suppress approval objects for empty inventories. Add cross-repository zero-removal and ignored-harvest retry regressions, plus document the fail-closed and retry contracts.
@Steel-tech
Steel-tech merged commit e4235ec into main Jul 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant