Skip to content

Fix routed town-root drift in nested worktrees#2816

Merged
maphew merged 2 commits intosteveyegge:mainfrom
Bella-Giraffety:polecat/obsidian/bd-e3q@mn520lc9
Mar 27, 2026
Merged

Fix routed town-root drift in nested worktrees#2816
maphew merged 2 commits intosteveyegge:mainfrom
Bella-Giraffety:polecat/obsidian/bd-e3q@mn520lc9

Conversation

@Bella-Giraffety
Copy link
Copy Markdown
Contributor

Summary

  • anchor routed town-root discovery to the active Beads context instead of the nearest nested town from $PWD
  • fail closed when an authoritative .beads context has no valid route source, instead of silently borrowing routes from a nearby nested town
  • add regression coverage for nested-town routing, explicit active DB context, and authoritative-context fail-closed behavior

Bug

In nested GT / worktree layouts, routed Beads commands could mix the active .beads database context from one town with the nearest mayor/town.json discovered 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.go
  • cmd/bd/create.go
  • targeted routing regression tests

It does not add new features or change unrelated workflow semantics.

Validation

  • final multi-review pass: passed across correctness, safety, tests, scope, and operator semantics
  • targeted nested-town / authoritative-context routing tests added for the previous failure mode

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.

@maphew maphew merged commit 199c55c into steveyegge:main Mar 27, 2026
@maphew
Copy link
Copy Markdown
Collaborator

maphew commented Mar 27, 2026

Fix town-root drift in nested worktrees. Good tests, fail-closed is correct. thanks @Thalia-geraghty!

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.

3 participants