fix(slots): slot-model consistency — switch reclaim/brick fixes, doctor slot repair, slots.json as source of truth (3.1.2)#32
Merged
Conversation
… on pre-mutation failures When promoting a feature that holds a slot whose per-repo worktree dir is missing, switch fell through to cold-Y allocation and counted the feature's own about-to-be-freed slot against the cap — raising a bogus no_free_slot. It now reclaims the vacated slot for the outgoing canonical. Separately, a pre-mutation precondition failure (no_free_slot, dirty warm worktree, bad --evict-to) on the first repo stamped an in_flight marker even though nothing was flipped, permanently locking out switching via slot_state_inconsistent. Pre-mutation failures with no completed repos no longer persist in_flight.
…x deleting warm slots Add a slot_repo_worktree_missing check + repair. A slot can hold a feature whose worktree dir is gone for one repo while sibling repos survive — invisible to slot_entry_orphan (inspects only the worktree-N/ top dir) and slot_branch_mismatch (skips non-existent per-repo paths). The repair recreates the worktree from the feature's branch (advice-only if the branch itself is gone). Adds git.worktree_prune to clear stale registrations first. Also fix check_worktree_orphan, which treated Wave-3.0 slot dirs (worktree-N/<repo>) as pre-3.0 feature-named orphans — so `doctor --fix` would git-worktree-remove every warm slot. It now skips worktree-N dirs, which are owned by the slot_* checks.
…of truth The Wave-3.0 slot migration left code assuming dir-name == feature and branch == feature-name: - init/reinit reported slot ids (worktree-N) as if they were feature names. Add summarize_worktree_dirs to resolve slot->feature via slots.json, and use it in `canopy init` and workspace_reinit. - bootstrap read the legacy features.json worktree_paths (empty in 3.0), so worktree_bootstrap raised no_worktrees for every warm feature. Resolve via slots.json, with a pre-3.0 features.json fallback. - coordinator.status() dropped the per-repo branches map when building the lane, and _enrich_lane/feature_changes/_find_stale_worktrees used the feature name as the branch. Carry the branches map and honor branch_for(repo) throughout.
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.
What
Four commits of slot-model (Wave 3.0) consistency fixes found dogfooding in canopy-test, shipped as 3.1.2.
switch (5aa6fcc)
no_free_slot(the canopy-test billing-export lock-out).no_free_slot,unknown_slot,evict_to_occupied,warm_worktree_dirty_on_promote) no longer stampin_flightwhen nothing was touched — a clean no-op failure used to make every later switch fail withslot_state_inconsistent.doctor (6653d33)
slot_repo_worktree_missingcheck + auto-repair (git worktree prune+worktree add) for half-materialized slots — a slot holding feature F where one repo's worktree is gone. Advice-only when the branch itself is missing (branches_missingowns that).worktree_orphancheck skipsworktree-Nslot dirs —doctor --fixno longer deletes warm slots.slots.json as source of truth (42b932c)
worktree_bootstrapresolves paths via slots.json (legacyfeatures.jsoncache is empty in 3.0 — bootstrap raisedno_worktreesfor every warm feature). Pre-3.0 fallback kept.canopy init/workspace_reinitreport worktrees by occupant feature via newsummarize_worktree_dirs, not slot ids as feature names.coordinator.status()/feature_changeshonor the per-repobranchesmap (lane.branch_for) instead of assuming branch == feature name.release (67bb724)
__version__→ 3.1.2, CHANGELOG entry.Tests
868 passed (284 lines of new tests across switch/doctor/bootstrap/coordinator/discovery).