Skip to content

Make generation cleanup handle-relative#1119

Merged
TheGreenCedar merged 1 commit into
dev/codestory-nextfrom
codex/1100-owned-deletion
Jul 14, 2026
Merged

Make generation cleanup handle-relative#1119
TheGreenCedar merged 1 commit into
dev/codestory-nextfrom
codex/1100-owned-deletion

Conversation

@TheGreenCedar

@TheGreenCedar TheGreenCedar commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Closes #1100
Refs #899
Refs #1046

Context

Generation retention and packaged-proof cleanup validated ambient paths and then recursively deleted through them. An ancestor symlink, junction, or reparse swap could redirect that cleanup after validation.

What changed

  • Added one OwnedDeletionRoot boundary in codestory-workspace: callers open a trusted root once and pass only plain relative names.
  • Unix traversal uses openat with no-follow handles and unlinkat; Windows rejects reparse traversal and deletes the exact opened handle.
  • Routed retrieval generation retention, Qdrant disk pruning, runtime search-generation pruning/recreation, and packaged proof-root/cache cleanup through that boundary.
  • Added one deterministic ancestor-swap sentinel test per platform. The packaged proof extracts its marker-bound CLI outside the removable root and uses the same internal deletion path.
  • Updated cleanup proof documentation and CHANGELOG.md.

Review

Start with crates/codestory-workspace/src/owned_deletion.rs, then verify that each consumer supplies a trusted root plus a derived relative path. The Python proof cleanup deliberately keeps marker/archive validation ahead of CLI extraction and deletion.

A code-simplifier pass found no justified broad refactor in the touched large files. I kept the OS branches explicit, removed redundant error plumbing, and applied the one clippy simplification in Qdrant cleanup.

Verification

Exact head: c7519139de78dcc4dd6630c486a408afef97c701

  • cargo test -p codestory-workspace owned_deletion
  • cargo check -p codestory-workspace --target x86_64-pc-windows-msvc --locked
  • cargo test -p codestory-retrieval active_and_rollback_are_retained_while_stale_bundle_is_removed --locked
  • cargo test -p codestory-runtime search_generation_retention_keeps_active_and_one_verified_rollback --locked
  • cargo check -p codestory-cli --locked after rebasing onto origin/dev/codestory-next@6bd8eb5
  • cargo clippy -p codestory-cli --locked -- -D warnings
  • python3 .github/scripts/check-packaged-agent-proof.py --self-test
  • node .github/scripts/check-doc-links.mjs
  • python3 -m py_compile .github/scripts/check-packaged-agent-proof.py
  • git diff --check

Risk and remaining proof

This is a deletion boundary, so the PR stays draft until the Windows-hosted test executes the junction swap and the normal draft CI is green. The Windows implementation and test compile locally, but this Mac cannot execute the Windows test binary. No full workspace or packaged matrix was run for this draft head.

@TheGreenCedar TheGreenCedar force-pushed the codex/1100-owned-deletion branch from eed02fe to bd50b35 Compare July 14, 2026 15:14
@TheGreenCedar TheGreenCedar merged commit 5968b1d into dev/codestory-next Jul 14, 2026
17 checks passed
@TheGreenCedar TheGreenCedar deleted the codex/1100-owned-deletion branch July 14, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant