Commit graph

30 commits

Author SHA1 Message Date
lizzy
9dc875a98e feat: add --list and --doc flags to bd help for CLI doc generation (GH#2527)
Cherry-pick Go code from community PR #2527 (maphew): adds --list flag to
enumerate all commands, --doc flag to generate per-command Docusaurus markdown,
and sidebar position mapping. Also includes lazy getGitContext() in hooks dir
resolution and test skip improvements for missing Dolt server.

Co-authored-by: matt wilkie <maphew@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:25:40 -07:00
beads/crew/jane
43bca275bf feat: JSON-aware error output + JSONL schema validation + contract tests (GH#2499)
- FatalError and FatalErrorWithHint now output structured JSON to stderr
  when --json flag is active, preventing mixed text/JSON output
- bd restore validates issues.jsonl schema before importing, catching
  incompatible export formats early (GH#2492)
- Add restoreResult.Errors and ErrorDetails fields for structured error reporting
- Add 6 JSON contract regression tests for list, show, create, close,
  ready, and error output contracts

Co-Authored-By: matt wilkie <maphew@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:33:53 -07:00
beads/crew/emma
84494b7e1a cleanup: remove daemon infrastructure remnants (GH#2431)
Remove all BEADS_NO_DAEMON env var handling from test files (dead code
since daemon removal in v0.50.0), delete stopRepoDaemon() and daemon
file guards from test setup, remove no-daemon config key from tests,
and update daemon→server wording in docs and comments.

37 files changed, -193 lines net.

Co-Authored-By: davetashner <davetashner@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:24:27 -07:00
matt wilkie
cf9f78d964 fix: TestProtocol_FieldsRoundTrip timezone-aware date assertions
Date-only inputs (--due 2099-03-15) are parsed as local midnight and stored
as UTC. In west-of-UTC timezones, the UTC date rolls back one day. The test
now computes the expected UTC prefix from the local date instead of
hardcoding the input date string.

Fixes #2371

Amp-Thread-ID: https://ampcode.com/threads/T-019cc486-ad63-76ea-9f02-2901e2430428
Co-authored-by: Amp <amp@ampcode.com>
2026-03-06 14:48:47 -07:00
beads/refinery
cd033d5cce Merge remote-tracking branch 'origin/polecat/obsidian/bd-m7sy@mmaw77ig' 2026-03-03 11:06:21 -08:00
beads/refinery
c8f61cb208 fix(tests): align tests with cross-type blocking validation
- Protocol tests: use `comments add` instead of nonexistent `comment` command
- critical_paths_test: use epic (not task) for epic-blocks-epic relationship
- template_test: use DepRelated instead of DepBlocks for cross-type "wrong dep"
  scenarios, since cross-type blocking is now rejected by storage validation

Fixes tests broken by the cross-type blocking validation added in GH#1495.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/refinery
Rig: beads
Role: refinery
2026-03-03 11:05:50 -08:00
obsidian
3872308568 refactor(tests): migrate all test files from StartTestDoltServer to container-native API
Migrate 12 TestMain files to use EnsureDoltContainerForTestMain/TerminateDoltContainer
instead of the removed StartTestDoltServer/TestDoltServer API.

Replace testServer.IsCrashed()/CrashError() crash detection with standalone
testutil.DoltContainerCrashed()/DoltContainerCrashError() in 6 test files.

(bd-m7sy)
2026-03-03 10:07:32 -08:00
quartz
801965ae2d feat(test): parallelize protocol tests for 3x speedup (bd-dgp)
Add t.Parallel() to all 45 top-level test functions in cmd/bd/protocol.
Each test already creates a fully isolated workspace (unique Dolt prefix,
temp dir, git repo) so parallelization is safe. Reduces test time from
~135s to ~42s on the same machine.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/quartz
Rig: beads
Role: polecats
2026-02-27 20:04:00 -08:00
darcy
fb8ca5fc90 fix: resolve gofmt and golangci-lint CI failures
- gofmt: 7 files had formatting issues (dolt.go, close_guard_test.go,
  init_hooks_test.go, discovery_test.go, types.go, metadata_schema_test.go,
  testdoltserver.go)
- gosec G304: suppress false positives for os.ReadFile on trusted paths
  (daemon PID files, test cleanup)
- gosec G104: handle Close() return values with _ = pattern
- errcheck: wrap os.RemoveAll in defer closure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 13:31:06 -08:00
onyx
6a21757419 fix(init): use prefix directly as database name instead of beads_ prefix
bd init --prefix was creating databases named beads_<prefix> (e.g.,
beads_sky, beads_gt). Convention should use the rig name directly as
the database name. This aligns with gastown doltserver.go which
already uses just the rig name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/onyx
Rig: beads
Role: polecats
2026-02-24 14:57:01 -08:00
obsidian
765ac3c481 refactor(protocol): split protocol_test.go monolith into thematic files
Remove the 45KB monolithic protocol_test.go and distribute its contents:
- helpers_test.go: TestMain, workspace, build helpers, assertion utilities
- roundtrip_test.go: field/metadata/spec/label create→show round-trips
- preservation_test.go: data survives updates, status transitions, deletes
- blocking_semantics_test.go: ready ordering, diamond deps, transitive chains
- close_guard_test.go: close guard, cycle prevention, supersede, force close

All 45 protocol tests pass. Closes GH#2041.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-24 14:25:54 -08:00
Joseph Turian
5f0b3befa7 feat(protocol): lane 6 — 10 new protocol invariant tests
Pin down stable CLI behavior as permanent guardrails:
- Cycle prevention (blocks chain, self-dependency)
- Close guard (respects dep types, blocks for deps, --force override)
- Deferred excluded from ready, restored by undefer
- dep rm unblocks issue
- Supersede creates dep and closes
- Status transitions preserve labels and comments
- Label add/remove round-trip

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-24 12:27:05 -08:00
mayor
83a02d8c89 fix: protocol tests now use isolated Dolt server instead of prod
Protocol tests were the source of ~35 beads_t* databases on the prod
Dolt server per test run. Each test called bd init with a random prefix
(t + 8 hex chars), creating beads_t<hex> databases on port 3307.

- Add TestMain to protocol tests that starts a dedicated test Dolt server
- Pass BEADS_DOLT_PORT and BEADS_TEST_MODE through workspace env() so
  the compiled bd subprocess connects to the test server
- Add beads_t to staleDatabasePrefixes in both dolt.go and doctor/server.go
  as a safety net for cleaning legacy pollution

Verified: full go test ./... now creates zero test databases on prod.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 23:07:39 -08:00
topaz
2345c82125 fix: rewrite protocol tests to use bd show --json instead of deleted bd export
The bd export command was removed in commit 1e1568fa as part of the
JSONL-to-Dolt-native refactor, breaking 11 protocol tests. Rewrite all
affected tests to verify data persistence via bd show --json instead of
export roundtrip. Remove unused parseJSONLByID helper.

Fixes: beads-iyu

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/topaz
Rig: beads
Role: polecats
2026-02-23 20:34:24 -08:00
jasper
3a0e582735 fix: isolate protocol tests with unique per-test Dolt databases
Each newWorkspace() now generates a random prefix (e.g. "t1a2b3c4d")
instead of the shared "test" prefix, so each test gets its own database
(beads_t<random>) on the shared Dolt server. This prevents cross-test
pollution where tests see issues from other concurrent or prior test runs.

Fixes: beads-sqv

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
2026-02-23 20:29:17 -08:00
beads/crew/wickham
67042744b1 fix: include waits-for deps in bd blocked output (GH#2043)
GetBlockedIssues only checked 'blocks' dependencies, making waits-for
gated issues invisible to bd blocked. Now uses computeBlockedIDs (which
handles both dep types with full gate evaluation) as the canonical
source of truth for blocked status.

Based on PR #2043 by @turian.

Co-Authored-By: Joseph Turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:08:25 -08:00
turian
2276c5fa13 fix: report correct status when reopen/undefer is a no-op (GH#2037)
bd reopen on an already-open issue now prints "already open" to stderr
and skips instead of printing a false "Reopened" message. bd undefer on
a non-deferred issue now prints "not deferred" and skips similarly.

Authored-by: turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:08:12 -08:00
beads/crew/jane
3ef50b867d fix: validate status on update against built-in + custom statuses (#2021)
bd update --status previously accepted any string silently, while
bd create validated against built-in + custom statuses. This adds the
same validation to update, rejecting invalid status values with a
helpful error message.

Co-Authored-By: Joseph Turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:05:17 -08:00
beads/crew/wickham
13190efbcc fix: reject empty title and empty label on update/label add (GH#1994)
- `bd update <id> --title ""` now errors instead of silently blanking
- `bd update <id> --title "   "` (whitespace-only) also rejected
- `bd label add <id> ""` now errors instead of adding empty label
- Values are trimmed before storage, not just for validation
- Includes fix for pre-existing doctor file formatting

Based on PR #1994 by @turian.

Co-Authored-By: Joseph Turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:05:06 -08:00
beads/crew/lydia
d22095501e fix: exit non-zero when all close/update attempts fail (GH#2014)
bd close and bd update now exit 1 when all attempted operations fail
(e.g., closing a blocked issue, updating a nonexistent ID). Partial
success (some closed, some failed) still exits 0.

Adds protocol tests for exit code behavior.

Co-Authored-By: Joseph Turian <turian@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:04:06 -08:00
Steve Yegge
72e6c7468a
docs: clarify --status flag filters stored status, not dependency blocking
docs: clarify --status flag filters stored status, not dependency blocking
2026-02-23 10:02:03 -08:00
Steve Yegge
df47a96d38
fix: warn when bd defer --until date is in the past
fix: warn when bd defer --until date is in the past
2026-02-23 10:01:52 -08:00
Steve Yegge
fae207e117
fix: reject empty and whitespace-only comment text
fix: reject empty and whitespace-only comment text
2026-02-23 10:01:50 -08:00
Joseph Turian
f4a858c3df fix: warn when bd defer --until date is in the past
bd defer --until=<past date> silently stored the past date, while
bd update --defer=<past date> already warns. Add the same past-date
warning to bd defer for consistency.

The warning matches the existing update path: prints to stderr and
suggests future-oriented alternatives (+1h, tomorrow).

Includes protocol test verifying the warning appears.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 04:54:06 -05:00
Joseph Turian
d3e581bc0b fix: reject empty and whitespace-only comment text
bd comments add accepted empty ("") and whitespace-only ("   ") text,
silently creating blank comments. Now validates with strings.TrimSpace
before storing, consistent with the empty-title validation on update.

Includes protocol test verifying both empty and whitespace-only text
are rejected with a non-zero exit code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 04:52:58 -05:00
Joseph Turian
c9fabf2ba9 fix: reject non-positive --days flag on bd stale
bd stale --days 0 and --days -1 silently returned no results instead of
reporting an error. Add early validation (days < 1 → FatalError) to
match the existing status validation pattern in the same command.

Includes a protocol test that verifies both --days 0 and --days -1 are
rejected with a non-zero exit code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 04:44:01 -05:00
beads/crew/emma
68be32ac65 fix: CI formatting, lint, and test failures blocking release
- Fix gofmt alignment in cmd/bd/repo.go
- Replace panic with sentinel port (port 1) in applyConfigDefaults when
  BEADS_TEST_MODE=1 without BEADS_DOLT_PORT, preventing CI crashes while
  still guarding against accidental production connections
- Add dolt availability skip in protocol_test.go newWorkspace
- Remove stale //go:build cgo tag from molecules_test.go
- Change Fatalf to Skipf for Dolt connection failures in molecule loader tests
- Update store_unit_test.go to match sentinel port behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:10:38 -08:00
Joseph Turian
e2ded3a38e test(protocol): split blocked-status test into separate file
Move BUG-4 test from protocol_test.go into
blocked_status_test.go with proper TestProtocol_ naming.

- TestProtocol_BlockedStatusIsStoredNotComputed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 23:47:56 -05:00
Joseph Turian
0af9580a35 docs: clarify --status flag vs bd blocked for dependency blocking (BUG-4)
The --status flag filters by the stored status column, but dependency-
blocked issues keep status "open" — they only appear via 'bd blocked'.
The old help text listed "blocked" without explaining this distinction,
leading users to expect 'bd list --status blocked' to find dependency-
blocked issues.

Updated help text for list, count, search, and query to say "stored
status" and point to 'bd blocked' for dependency-blocked issues.

Adds TestBUG4_BlockedStatusVsBlocked protocol test documenting the
distinction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 22:48:27 -05:00
Joseph Turian
b4d0aa7d1b
test: protocol invariant suite for data integrity and blocking semantics (#1910)
12 protocol invariant tests that guard against re-regression of fixed bugs:
- ImportPreservesRelationalData (labels, deps, comments) — #1844
- ReadyOrderingIsPriorityAsc — #1880
- MetadataRoundTrip, SpecIDRoundTrip — #1912
- FieldsRoundTrip, CloseReasonRoundTrip
- DeleteCleansUpDeps
- Labels/Deps/CommentsPreservedAcrossUpdate
- ParentChildDepExportRoundTrip (SKIP, #1926)
- ClosedBlockerNotShownAsBlocking — #1858

Each test runs in isolated t.TempDir() workspace with its own git repo.
Set-based comparisons with clear missing/unexpected diffs on failure.

Remove //go:build cgo tag (CGO bifurcation removed in c4010c19).
2026-02-22 15:29:27 -08:00