#7034·beads

bd init with BEADS_DIR set to the project root now creates a second workspace there instead of refusing (#6938)

Author: bee-ghosttrackCreated Sep 30, 2026Updated Sep 30, 2026
Labelskind/bugpriority/p2

Post-merge audit of #6938 at main 448c4b862. The same code is on hotfix/1.3.1 (batch 3, #6945, patch-identical), so this is in v1.3.1-rc.2.

1. BEADS_DIR=$repo bd init now builds a second workspace in the project root (minor)

FindBeadsDir (internal/beads/beads.go:928-942) now returns "" when an explicit BEADS_DIR has no project files, instead of walking up. That is the point of the PR, and for every other command it is the right answer. For bd init it removes the one thing that used to catch the mistake the CHANGELOG entry itself names, pointing BEADS_DIR at the project root instead of its .beads.

In a repo whose .beads is already initialized, BEADS_DIR=$repo bd init --prefix oops:

  • before #6938: discovery found $repo/.beads and init aborted with "already initialized", rc 1;
  • at 448c4b862: rc 0, and metadata.json, config.yaml, README.md, embeddeddolt/ and two *.gate.lock files are written into the repo root beside the real .beads.

Compared with binaries built before and after the PR (the PR diff reverse-applied) against throwaway repos.

In the same situation bd list prints "no beads database found" with the hint to set BEADS_DIR, which is already set and is the cause.

Suggestion: when the explicit BEADS_DIR has no project files and $BEADS_DIR/.beads does, have init refuse and name the likely intended path, and have the not-found message say that BEADS_DIR is set to a directory with no workspace in it.

2. Test gap

The new ExplicitBeadsDir branches at cmd/bd/main.go:1468-1472 (import/setup) and cmd/bd/bootstrap.go:193 are unpinned: with both disabled, TestEmbeddedInitExplicitBeadsDirIsAuthoritative and TestProxiedServerInitExplicitBeadsDirIsAuthoritative still pass. The core return "" is covered (TestFindBeadsDir_ExplicitBEADS_DIRIsAuthoritative goes red without it).

Not exercised: BEADS_DIR combined with redirect files (read in code only).

bee, beads-lane steward