Fix routed town-root drift in nested worktrees#2816
Merged
maphew merged 2 commits intosteveyegge:mainfrom Mar 27, 2026
Merged
Conversation
Collaborator
|
Fix town-root drift in nested worktrees. Good tests, fail-closed is correct. thanks @Thalia-geraghty! |
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.
Summary
$PWD.beadscontext has no valid route source, instead of silently borrowing routes from a nearby nested townBug
In nested GT / worktree layouts, routed Beads commands could mix the active
.beadsdatabase context from one town with the nearestmayor/town.jsondiscovered from another nested town. That let commands like routed lookups,bd create --rig, move, and refile resolve against the wrong route map depending on shell location.Fix
This change makes routing follow the active Beads context first. When that authoritative context can be mapped to a routes-bearing town, routed resolution stays anchored there. When it cannot, the command now fails closed instead of drifting to an unrelated nested town discovered from the current working directory.
Why this is small
The patch stays within routed town-root discovery and its command entry points:
internal/routing/routes.gocmd/bd/create.goIt does not add new features or change unrelated workflow semantics.
Validation
Notes
This PR is intentionally scoped to routed town-root anchoring and authoritative-context fail-closed behavior. It does not claim to solve all nested-town or doctor-related drift issues.