beads/internal/routing
Isis Anisoptera f5a70d3eb9 fix: anchor jj-secondary role resolution at repoPath, not cwd
DetectUserRole(repoPath) used repoPath for the git-config and URL lookups,
but the jj-secondary resolution underneath called the cwd-based
git.JJSecondaryWorkspaceRoot / GetJJPrimaryWorkspaceRoot (which bottom out
in GetJujutsuRoot -> os.Getwd). They only agreed because both callers pass
".". A caller passing a non-cwd repoPath would resolve the jj primary from
the wrong directory.

Add path-aware cores in internal/git:
- getJujutsuRootFrom(dir) walks from an explicit start dir, applying Abs first
  so From(".") reproduces the cwd-based walk (and the .git-boundary stop)
  exactly.
- JJSecondaryWorkspaceRootFrom / GetJJPrimaryWorkspaceRootFrom expose the
  path-aware variants; the existing cwd-based functions are thin wrappers.

routing.DetectUserRole now calls the ...From(repoPath) variants so the jj
resolution stays consistent with the git-config lookup. beads.go is left
untouched — FindBeadsDir/findDatabaseInTree are inherently cwd-based, so their
use of the cwd helpers is correct.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 15:00:30 -07:00
..
routing.go fix: anchor jj-secondary role resolution at repoPath, not cwd 2026-06-04 15:00:30 -07:00
routing_test.go fix: anchor jj-secondary role resolution at repoPath, not cwd 2026-06-04 15:00:30 -07:00