Add isolated SwiftPM scratch placement and guarded cache cleanup#524
Open
morluto wants to merge 7 commits into
Open
Add isolated SwiftPM scratch placement and guarded cache cleanup#524morluto wants to merge 7 commits into
morluto wants to merge 7 commits into
Conversation
- Add Scripts/cache_inventory.py to resolve SwiftPM scratch paths by repo/worktree + toolchain + target triple + configuration. - Wire scratch identity into conductor build/package/test/run/relaunch and install-debug-cli operations, and into package_app.sh and xcode_developer_workflow.sh. - Expand/resolve exact paths and developer-root paths, include SWIFT_TARGET_TRIPLE in cache key, and resolve/exclude symlinked managed worktree roots. - Drop the cache-identity sentinel; keyed directories are identified by repo-hash prefix. - Fix local production install path to use the package_app .build/release compatibility path and resolve it through symlinks. - Update test harnesses to match the new symlinked layout.
- Add plan_build_cache_cleanup and execute_build_cache_cleanup to cache_inventory.py with dry-run/apply/confirm and --limit support. - Re-validate each directory before rmtree: must still exist, not be a symlink, not have an active SwiftPM .lock, not be live-bound to the worktree, remain within the resolved scope (repo root, developer root, or exact path), and the worktree must not have become dirty. - Wire the "cache cleanup" subcommand into conductor (parser, OperationRegistry, internal runner, help) with default limit=None. - Add Scripts/test_cache_inventory.py and include it in conductor-selftest.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Worktrees accumulate independent multi-gigabyte
.builddirectories. Developers cannot place those caches under one controlled root or safely identify abandoned caches.Sharing one mutable scratch directory across divergent branches would trade disk pressure for correctness risk. This PR uses conservative worktree isolation, then builds cleanup on the same cache identity model.
Closes #421 and #422.
What changes
Placement
Adds
REPOPROMPT_DEVELOPER_SWIFTPM_SCRATCH_ROOT. Conductor derives an isolated path using repository, worktree, toolchain, destination, target triple, and configuration identity.The existing exact-path
REPOPROMPT_SWIFTPM_SCRATCH_PATHremains supported. Unset behavior stays checkout-local.Inventory and cleanup
One model owns effective path, identity, size, age, eligibility, and skip reasons. Cleanup defaults to dry-run. Mutation requires
--apply --confirmand immediately revalidates current/dirty/active/live-bound state, confinement, symlinks, and identity.Symlinked cache paths are skipped without resolving and deleting their targets. Cleanup never deletes worktree sources or Git metadata.
Compatibility
Packaging, local installation, and Xcode MCP workflows use the same scratch authority. The Xcode MCP compatibility link is refreshed after successful builds so it cannot retain an older executable.
Deliberate scope
This does not share one exact build directory across divergent worktrees. Isolation comes first; broader artifact sharing needs separate evidence.
Review order
Scripts/cache_inventory.pyidentity modelVerification