* fix(comments): reject swapped-order `comments <id> add` instead of no-op
`bd comments <issue-id> add <text>` (issue id before the `add` subcommand)
fell through to the parent `comments` command, which reads only args[0] as
the issue id and silently drops the rest — listing existing comments and
exiting 0 without ever writing the intended comment (GH#4642). In scripted
or agent pipelines this reads as a successful add and is only caught by
re-listing.
The parent command only lists comments for a single issue, so any trailing
positional arg is a mistake. Reject it with a clear error; the common
swapped-`add` case gets a targeted hint pointing at `bd comments add <id>
<text>`.
Adds embedded regression tests covering the swapped-order add (must exit
non-zero and store nothing) and a generic stray trailing arg.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(comments): move swapped-order rejection into a pre-open Args validator (PR #4787 review follow-up)
The 2026-07-24 maintainer review found two blockers with the RunE-only
check: (1) it runs after PersistentPreRunE, so the malformed invocation
this PR exists to catch could still trigger migration work, hit the
remote-migrate gate, or die with "no database found" before the helpful
hint ever printed — the embedded tests use an already-initialized store,
so they couldn't see this; and (2) merge-base drift means current main
dispatches proxied mode to a real runCommentsProxiedServer (added after
this PR branched) that reads only args[0] and ignores trailing `add
<text>`, so the RunE-only check never runs for that path.
One fix for both, per the review: moved the swapped-order/stray-trailing-arg
rejection into validateCommentsArgs, wired as commentsCmd.Args. Cobra runs
Args validation before PersistentPreRunE and before RunE's
usesProxiedServer() branch, so the rejection now fires identically for
every backend, before any store open, migration, or proxied dispatch.
Added two regression tests: TestCLI_CommentsSwappedAddRejectedBeforeStoreOpen
runs in a directory with no .beads/ at all to prove the store is never
touched, and TestCLI_CommentsSwappedAddRejectedInProxiedServerMode forces
proxiedServerMode to cover the proxied path without needing a real proxied
server. The existing embedded regression tests (comments_swapped_add_rejected,
comments_extra_arg_rejected) still pass unchanged.
Agent-Signature: claude-fable-5-medium on behalf of maphew
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
Add a shared runCommandBuffers helper for embedded subprocess tests so the PR keeps stdout/stderr separation without repeating buffer setup in every JSON-output test.
_codex-gpt-5- on behalf of matt wilkie_
PR #3909 introduced an auto-export warning written to stderr. Tests that
called CombinedOutput() and then parsed the result as JSON would choke
on the warning text mixed into stdout.
Apply the pattern already established in list_embedded_test.go: for every
helper or inline call site that parses JSON or an ID from stdout, capture
stdout and stderr in separate bytes.Buffers and parse only stdout.
Covers 66 test files including duplicates, update, lint, todo, label,
count, swarm, close, list, status, types, find-duplicates, and more.
Closes TestEmbeddedDuplicates/dry_run and TestEmbeddedUpdate/update_json_output
failures from CI run 25967558419 and 25962887732.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: resolve CI failures from flock, version bump, and lint
Three categories of CI failure on main after the v1.0.0 release:
1. rules.go lint/format: Fix gofmt alignment, errcheck on tw.Flush(),
gosec G304 (add nosec comment), gosec G306 (use 0o600 perms).
2. doctor_test.go version tracking: The 'slightly outdated version'
test used 0.55.0 which now has a major version diff from 1.0.0,
correctly triggering a warning. Update expected status to match.
3. Embedded Dolt concurrent tests: The exclusive flock from #2571
causes concurrent bd processes to fail with 'one writer at a time'.
Update 58 concurrent test files to tolerate this expected error
while still failing on unexpected errors and panics.
Amp-Thread-ID: https://ampcode.com/threads/T-019d5386-b41e-7138-bc81-6ea331b80760
Co-authored-by: Amp <amp@ampcode.com>
* fix: concurrent test post-conditions tolerate flock contention
With exclusive flock (commit 543e1943), only some workers can acquire
the lock in concurrent tests. Update post-conditions in 5 tests to:
- Only verify side effects from workers that succeeded (r.err == nil)
- Require at least 1 worker succeeds (fail if all hit flock)
- Log success/failure counts for visibility
- Still verify correct behavior for successful operations
Tests fixed:
- TestEmbeddedCloseConcurrent: remove Fatalf on failures, skip total count check
- TestEmbeddedDeferConcurrent: only check deferred status for successful workers
- TestEmbeddedUndeferConcurrent: only check open status for successful workers
- TestEmbeddedReopenConcurrent: only check open status for successful workers
- TestEmbeddedPromoteCLIConcurrent: only check permanent for successful workers
Amp-Thread-ID: https://ampcode.com/threads/T-019d5386-b41e-7138-bc81-6ea331b80760
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d5386-b41e-7138-bc81-6ea331b80760
Co-authored-by: Amp <amp@ampcode.com>
---------
Co-authored-by: Amp <amp@ampcode.com>