Commit graph

43 commits

Author SHA1 Message Date
Julian Knutsen
57ef364501
build(bazel): side-by-side Bazel scaffold + policy tests (#6798)
* build(bazel): add side-by-side Bazel scaffold (module + gazelle)

Add a Bzlmod Bazel build alongside the Go toolchain. `go build` and
`go test` are unchanged; nothing in CI invokes Bazel yet.

- MODULE.bazel: rules_go 0.63.0, gazelle 0.53.0, Go SDK 1.26.7 (matches
  the go.mod toolchain directive), go_deps from go.mod.
- ICU policy (engdocs/ICU-POLICY.md): a go-mysql-server gazelle_override
  selects the pure-Go regex backend and excludes regex_cgo.go, and
  .bazelrc builds with --@rules_go//go/config:tags=gms_pure_go, so no
  target depends on go-icu-regex or links libicu.
- third_party/patches: three module_override patches for dolt deps that
  ship WORKSPACE-era BUILD files, adapted from the gascity project.
- .bazelrc: prcore/ci test configs (inert for now; they match pr-core's
  test selection, not yet its environment isolation) and a generic
  remote-exec config with a bounded remote timeout. Executor endpoints and
  TLS credentials come only from a gitignored .bazelrc.local/user.bazelrc
  or a CI rc outside the workspace.
- .bazelversion pins Bazel 9.2.0; .bazelignore skips separate modules,
  non-Go trees, nested agent worktrees (.claude, .worktrees) and local
  data/output dirs (.beads, .dolt, dist, .runtime, tmp), so a primary
  checkout neither builds nor gazelle-rewrites nested worktree copies.
- Gazelle-generated BUILD.bazel files for every Go package.
- Makefile: `make bazel-sync` (gazelle + bazel mod tidy).
- .gitignore: bazel-* output symlinks and machine-local rc files.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(bazel): policy tests for the Bazel configuration

Add scripts/bazel_policy_test.go, plain Go tests that run under both
`go test ./scripts` and `bazel test //scripts:scripts_test`:

- MODULE.bazel go_sdk.download version equals the go.mod toolchain.
- ICU policy: .bazelrc sets gms_pure_go for build, the go-mysql-server
  gazelle_override excludes regex_cgo.go, and the root BUILD.bazel
  carries `# gazelle:build_tags gms_pure_go`.
- .bazelversion pins an exact Bazel release.
- .bazelrc.local and user.bazelrc are gitignored (parsed from .gitignore
  and cross-checked with git check-ignore when in a checkout).
- No remote-execution endpoints or credentials in committed bazelrc-like
  files, Markdown docs or .github/**: remote/BES/TLS flags
  (--remote_executor, --remote_cache, --bes_backend, --remote_header,
  --tls_client_certificate, ...) with a literal value, with or without a
  URL scheme, and non-loopback gRPC URLs in rc/.github files. Placeholders,
  $VARIABLES, and loopback are allowed; Markdown gRPC URLs (OTel exporter
  docs) are not flagged. Skipped outside a git checkout, e.g. in the Bazel
  sandbox.

Each check is a pure function also exercised against fixtures that break
the invariant. The files the tests read are declared as data via
//:bazel_policy_files so they resolve from runfiles under Bazel.

scripts/check-build-tags.sh now treats Bazel invocations as governed by
.bazelrc: the shell command segment that invokes Bazel (split on &&, ||,
;, |, $( and backticks) is exempt from the per-line `go` tag check, while
a bare `go` in another segment of the same line is still flagged. When
any scanned file invokes Bazel (or .bazelrc exists) .bazelrc must set
--@rules_go//go/config:tags=gms_pure_go for build.
scripts/check_build_tags_test.go covers both in a temp repository.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(scripts): split bazel lines in pure bash so check-build-tags works with BSD sed

BSD sed (macOS) does not expand \n in s/// replacements, so the segment
split never happened and the Bazel-exemption tests failed on macos-latest.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(scripts): skip check-build-tags tests when bash lacks mapfile

macOS runners use /bin/bash 3.2, which has no mapfile; check-build-tags.sh
has always required bash >= 4, so the new tests are skipped there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 03:41:02 -07:00
Jim Wordelman
f6a191fd64
fix: canonicalActor collapses the --/__ axes correctly; claim-verify uses ActorMatches (be-p7dzx, bundled be-vc51) (#5856)
* test(feat): red — canonicalActor collapses the --/__ axes: misses gascity slash identities and widens ActorMatches (bundled with be-vc51 authorize/verify split) (refs be-fh0g)

* feat: green — canonicalActor collapses the --/__ axes: misses gascity slash identities and widens ActorMatches (bundled with be-vc51 authorize/verify split) (refs be-fh0g)

* docs(identity): correct the five contract surfaces that still document the pre---- collapse rule

canonicalActor stopped collapsing an exact "--" run when it started decoding
that run to "/", but five places still tell a reader the old rule: a run of
".", "_" or "-" matches any other such run. That is now false for "--", and
two of the five are public contract surfaces rather than internal comments --
the OpenAPI description a client reads, and the conformance text a backend
implementor is expected to satisfy.

Corrected in place, all saying the same thing: an exact "--" run decodes to
"/" because that is gascity's session-name encoding of a rig-qualified
agent's slash, so "a--b" matches "a/b" and no longer matches "a__b" or "a-b";
longer and mixed runs, "__" included, still collapse.

  issueops/releaser.go                      ExpectedAssignee's contract
  issueops/issueops.go                      the update-side cross-reference
  internal/httpapi/spec/openapi.v0.yaml     wire contract (source of truth)
  internal/httpapi/apigen/types.gen.go      regenerated via make api-gen
  backend/conformance/releaser_contract.go  cross-backend contract text

The conformance limb is annotated rather than re-pinned: the respelling it
exercises is "-" -> "_", which this change does not affect, so it stays green
either way -- which is exactly why CI could not catch the stale text. Adding a
"--" limb there would pin new cross-backend behavior and is a wider change
than correcting a contract description.

This is the keep-in-sync obligation identity.go records under ga-5ksp5,
applied to the documentation half.

* docs(changelog): record the --/__ equivalence-class change under [Unreleased]

The actor-matching change is user-visible and silent: it moves which stored
spellings compare equal for ExpectedAssignee on release and update, and for
claim/close/unclaim authorization. "gastown--mayor" starts matching
"gastown/mayor" and stops matching "gastown__mayor" and "gastown-mayor".

The entry says the widening is the intended fix -- "gastown--mayor" is the
agent "mayor" on rig "gastown" while "gastown__mayor" is the dotted alias
"gastown.mayor", and matching them was wrong -- and then states the part a
reader actually needs to act on: any stored "--" spelling that is NOT a
gascity slash encoding changes equivalence class with no error to notice.

---------

Co-authored-by: Steve Yegge <steve.yegge@gmail.com>
2026-08-19 13:23:35 -07:00
Jacob Hausler
d2fc47949d
feat(lint): configurable per-type lint sections via lint.sections.<type> (#5855)
* feat(lint): configurable per-type lint sections via lint.sections.<type>

bd lint, bd create --validate, doctor conventions, and markdown import all
check issue descriptions against built-in required sections that are
hardcoded per issue type. This adds a config knob:

  bd config set lint.sections.epic "Standards scorecard, Cost"

- lint.sections.<type> holds a comma-separated list of section headings,
  stored in config.yaml (yaml-only key, same path as validation.*).
- The list is ADDITIVE to types.IssueType.RequiredSections: built-in
  requirements are never relaxed, only extended.
- Entries are normalized to "## <heading>" (any leading '#' run and
  surrounding whitespace stripped) and deduped case-insensitively against
  both the built-ins and each other, so re-declaring a built-in changes
  nothing.
- Consumed in internal/validation.ValidateTemplate (the single choke point
  behind LintIssue and every lint consumer) via mergeLintSections.
- lint.* is a recognized config prefix and documented in bd config and
  bd lint help.

* docs(config): list the lint.* namespace and lint.sections.<type> in YAML-only keys

Address review feedback: the PR routes lint.* through config.yaml
(internal/config/yaml_config.go) but the YAML-only Keys section of
docs/reference/configuration.md did not list it. Add the namespace and a
one-line key description. (The pre-existing audit. and storage-class.
omissions are left as-is, out of scope for this PR.)
2026-08-19 11:23:33 -07:00
Athos Bernardes
df90ec784c
fix(bd): canonicalize actor==assignee comparisons in unclaim.go and AuthorizeAssigneeTransferWithPools (#5439)
* fix(bd): canonicalize actor==assignee comparisons in unclaim.go and AuthorizeAssigneeTransferWithPools

Follow-up to ga-wzl83, which canonicalized the two pure-Go validators in
internal/validation/issue.go but explicitly left out two higher-risk sites.

UnclaimIssueInTx / UnclaimIssueIfAssigneeInTx compared actor/expectedAssignee
to the stored assignee verbatim, both in a Go-side precheck AND in the SQL
UPDATE's WHERE clause -- so canonicalizing only the Go side would not have
fixed `bd unclaim` end-to-end. Replaced the `assignee = ?` SQL predicate with
a `row_lock = ?` CAS against the RowVersion read moments earlier: every
ownership/status/started_at mutation always rewrites row_lock (the documented
freshRowLock invariant in lease.go), so this detects the exact same race the
old predicate did -- and more (status/started_at races too) -- without
embedding a spelling-sensitive string comparison in SQL.

AuthorizeAssigneeTransferWithPools (the single fence both the DBTX and
unit-of-work backends evaluate, per its own doc comment) compared
before.Assignee to request.Actor and to request.Patch.Assignee.Value
verbatim, so a caller naming the current holder under a different layer's
identity spelling was wrongly fenced as a stranger.

Both fixes reuse the canonicalActor/actorMatches shape from ga-wzl83, kept as
a small package-local duplicate in issueops (internal/storage/issueops
importing internal/validation would invert the layering).

Verified: new cross-spelling cases in aggregate_authorize_transfer_test.go
and new end-to-end cases in unclaim_embedded_test.go /
unclaim_conditional_embedded_test.go (against a real embedded Dolt backend)
all fail with the exact bug-report symptom against the pre-fix code and pass
after the fix, with no regressions in the existing suites.

ga-5ksp5

* fix(bd): close the sibling-CAS disagreement gate review flagged on #5439

Review verdict on #5439 was "MERGE AFTER ONE FIX": after this branch's
unclaim.go/aggregate.go fix, bd unclaim --if-assignee succeeds under a
respelled identity while bd update --expected-assignee on the same bead
still fails ErrAssigneeMismatch — the same verbatim actor==assignee defect
(ga-wzl83), left in two more places.

- internal/storage/issueops/update_cas.go:46 (CheckExpectedFieldsInTx) now
  compares under actorMatches (package-local, unexported — same package as
  identity.go, no new import needed).
- internal/storage/domain/issue.go:643 (ApplyUpdate, the unit-of-work twin)
  now compares under validation.ActorMatches. domain cannot import
  internal/storage/issueops (issueops already imports domain in several
  files — the reverse would cycle), but domain -> internal/validation is
  safe (validation depends only on internal/types), so this reuses the
  already-shipped validation copy instead of adding a third duplicate.

Two non-blocking asks from the same review, addressed:

- Exported internal/validation's canonicalActor/actorMatches to
  CanonicalActor/ActorMatches so domain/issue.go could reuse them (the
  reviewer's own point: "an issueops -> validation import creates no
  cycle... layering inversion is a style call, not a compile fact" applies
  equally to domain -> validation). Also fixed a garbled mid-sentence doc
  comment on ActorMatches while touching the file (separate nit from the
  same review, on #5438).
- Added a cross-package parity test
  (internal/storage/issueops/identity_parity_test.go) that runs the
  existing CanonicalActor/ActorMatches case tables through both this
  package's local duplicate and validation's exported version, so the two
  copies can't silently drift. Mutation-tested: dropped the hyphen
  separator from issueops's copy, confirmed the two hyphen-related cases
  correctly fail, reverted.

New conformance test (backend/conformance, wired into all three backend
legs) proves the fix end-to-end: an ExpectedAssignee guard now accepts a
different spelling of the current holder and still refuses a genuinely
different identity. Added as a SEPARATE function rather than extending the
existing RunIssueOperationsUpdateConditionalGuardsGateOrdinaryEdits — that
test's later "order-dependent composition" arm depends on the row's
assignee staying exactly "holder" through to the end, which a mid-test
respelling would have broken.

Verification: internal/validation, internal/storage/issueops,
internal/storage/domain(+db,fs,git) all green. New conformance test passes
on embeddeddolt and uow (dolt backend skips locally, no Docker — matches
the existing documented limitation, CI covers it). Broader regression
subset (Update/Claim/Unclaim, 28 embeddeddolt + 22 uow cases) green, no
regressions. go build/vet/gofmt clean.

Filed ga-4ymii for the reviewer's second (also non-blocking) ask: the
remaining verbatim sites at issueops/claim.go (SQL CAS + idempotent
re-claim), its domain/db and domain/issue.go uow twins, and
issueops/lease.go's heartbeat holder check — out of scope for this PR per
the reviewer's own framing ("please file the follow-up").

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(bd): dispatch the respelled-assignee contract case onto the role seam

TestRoleContractCasesCoverEveryContractCase (main, post-dating this branch's
fork point) caught a real gap: the ga-5ksp5 contract case added to this
branch's earlier commit (RunIssueOperationsUpdateConditionalGuardAccepts-
RespelledAssignee) had no roleContractCases dispatch row, so an external
backend running RunRoleContracts would never see it.

The reason isn't a missed row so much as the whole RunIssueOperationsUpdate*
family this case was written beside having been renamed and moved to
RunLifecycleUpdate* in backend/conformance/lifecycle_update_contract.go by
main's "de-stage the hard Lifecycle contracts onto the role seam" refactor,
which landed on main after this branch forked. Ported the case to match:
same logic, adapted to the new fixture's idioms (fixture.Lifecycle.Update
instead of fixture.Operations.Update, lifecycleUpdateRow(...).Priority
instead of a raw SQL assertion, storage.ErrAssigneeMismatch instead of
publicops.ErrAssigneeMismatch, seedLifecycleUpdateIssue instead of
seedClosePolicyIssue) — not a mechanical copy. Also wired it into the three
per-backend TestLifecycleUpdateContract dispatch lists (dolt, embeddeddolt,
uow) beside its ConditionalGuardsGateOrdinaryEdits sibling, so it actually
runs against real backends rather than only satisfying the completeness
guard.

Verified: TestRoleContractCasesCoverEveryContractCase passes; the ported
case passes against embeddeddolt (0.35s) and uow (0.17s) for real, not just
compiles (dolt backend test skips in this sandbox — no Docker); full
backend/conformance suite and repo build clean.

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 11:35:01 -07:00
athosmartins
897a56097a fix(validation): canonicalize actor/assignee separators before comparing (ga-wzl83)
AssigneeMatches (bd close) and AssigneeNotStolen (bd update -a / bd assign's
reassignment fence) compared actor to assignee verbatim. The same identity
reaches bd spelled differently depending on which layer produced the
string — e.g. "gastown.mayor" vs a session-name form "gastown__mayor" — so
an agent could be refused closing its own bead ("assignee is
\"gastown.mayor\", actor is \"gastown__mayor\"") and taught that --force is
the normal path, even though both strings name the same principal.

Add canonicalActor/actorMatches: collapse any run of ".", "_", "-" to one
canonical separator before comparing. Only separators fold; non-separator
characters still differ between genuinely different identities, so the
guard does not become a no-op (verified with a dedicated test case per
ACEITE #2).

Covers both functions in this file — AssigneeNotStolen's own doc comment
already called out "Like AssigneeMatches, authority is identity-by-string",
so fixing one and not its documented sibling would just move the bug.

Verified the new tests actually catch the bug: reverted just the two
comparison call sites to the old verbatim form (helpers still defined so the
package compiles) and confirmed the 5 new cases fail, reproducing the exact
reported error message; restored the fix and confirmed green.

Out of scope, filed separately (ga-5ksp5): the same verbatim-comparison
defect in unclaim.go's SQL-CAS-embedded predicate and aggregate.go's
AuthorizeAssigneeTransferWithPools (the authoritative reassign-transfer
predicate) — different risk profile, needs its own investigation rather
than a mechanical port of this fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-08 05:45:09 -03:00
Julian Knutsen
8f421b64f1
fix(close): restore idempotent re-close by ordering, not by clearing the pin (#5236)
* fix(close): restore idempotent re-close by ordering, not by clearing the pin

`bd close --force` on a boolean-pinned bead leaves `{pinned: true, status:
closed}` — closeIssueInTx writes only status/closed_at/updated_at/close_reason/
closed_by_session/row_lock, never the pinned column. Since #5212 taught
validation.NotPinned to refuse on `issue.Pinned || status == pinned`, the plain
retry hit that guard before ever reaching the `!res.Changed` already-closed
branch, so an idempotent re-close started exiting nonzero. That branch is the
only thing that re-drives a stranded molecule auto-close, so a crashed
auto-close of a pinned final step stayed stranded forever.

An earlier ruling proposed clearing the pin on close. It was WITHDRAWN on
evidence: Pinned is the deletion-protection flag at six destructive call sites
(bd gc, bd purge, bd cleanup), and in filterClosedDeletionCandidates the pinned
check sits immediately before the closed check, so there it protects closed rows
exclusively. Clearing it would make a pinned closed bead impossible and turn all
six branches into dead code. The current ruling is to fix the ordering instead:
short-circuit the already-closed no-op before validateIssueClosable in both close
paths. Ruling 10 is not narrowed and NotPinned is not exempted — it simply is
never reached on a row that is already closed, because closing an already-closed
issue is a no-op with nothing to protect.

Both close paths skip only validateIssueClosable, and only when the resolve-time
snapshot they already hold reports literal StatusClosed:

  - The engine still runs. Its in-transaction `WHERE status != 'closed'` guard
    remains the authority on whether the close is a no-op, so two actors closing
    concurrently still converge, the coordination-cell touch still happens, and
    the closed-target open-children refusal is preserved.
  - No extra read: close.go reuses result.Issue from resolveCloseTargets and
    closeProxiedOne reuses `current`.
  - Only literal StatusClosed qualifies, mirroring issueops.isClosedInTx —
    reaching a configured done status is a real close and still validates.

A re-close was verified to be a pure no-op for user-visible close state, so the
reorder drops no writes: the guarded UPDATE means --reason and --session are
already discarded on an already-closed row today (issueops/close.go), and the
CLI never sets ExpectedVersion.

The direct and proxied paths change identically; diverging here is the defect
class #5217 just closed, and both now carry command-level twins asserting the
force-close → plain-retry exit 0, the surviving pin, and (direct) that the row
is still excluded by filterClosedDeletionCandidates with PinnedSkipped == 1.

Agent-Signature: claude-opus-5
Co-authored-by: CI Bot <ci@beads.test>

* test(close): pin the owner-accepted collateral of the re-close reorder

Skipping validateIssueClosable on an already-closed row skips the whole
chain, not only the pinned guard, so a foreign actor's re-close now exits
0 where it used to refuse with the be-035 authority error. The owner
accepted that on 2026-08-01: a re-close writes nothing, because the close
UPDATE is guarded `WHERE id = ? AND status != 'closed'`, so the authority
check has no state change left to protect.

The alternative — scoping the skip to NotPinned alone — was rejected by
the review council and by the ruling, because a per-validator carve-out
is the guard-narrowing shape the ruling exists to avoid.

This pins the new semantics so a future change to them fails loudly
rather than sliding through. It also asserts the assignee is unchanged,
which is the evidence that nothing was written. The refusal itself is
untouched: close_assignee_mismatch_refuses_without_force still pins it on
an open bead, which is the case be-035 was filed for.

NotTemplate needs no equivalent case: a closed template is unreachable
from the CLI, since validateIssueClosable and validateIssueUpdatable both
refuse templates, so neither `bd close` nor `bd update --status closed`
can produce one.

Agent-Signature: claude-opus-5
Co-authored-by: CI Bot <ci@beads.test>

---------

Co-authored-by: CI Bot <ci@beads.test>
2026-08-01 09:04:14 -07:00
Julian Knutsen
29af03b8c8
fix(close): honor the pinned boolean, not just the pinned status (#5212)
NotPinned refused a close only when issue.Status == StatusPinned, so it
never read the Pinned boolean column. An issue carrying pinned=true with
any other status — open, in_progress — closed without --force, silently
losing the protection its pin was supposed to buy.

Both triggers are now checked, because bd's two consumers disagree on
which one they use: Gas Town pins by status and enumerates pins with
List(ListOptions{Status: StatusPinned}) at 21 sites, while Gas City reads
the boolean in compute_awake_set.go. A boolean-only check would have
stripped Gas Town's existing protection, so the guard refuses on
Pinned OR status == pinned (ga-z3vht ruling). --force still overrides.

The change is strictly additive: no existing assertion in TestNotPinned,
TestForClose or TestValidateIssueClosable changes outcome, since every
current case exercises the status trigger. It stays at the validation
layer deliberately — both live callers (direct close.go, proxied
close_proxied_server.go) plumb --force and fail loudly, so no caller
inherits a policy it cannot override.

Agent-Signature: claude-opus-5

Co-authored-by: CI Bot <ci@beads.test>
2026-07-31 20:51:48 -07:00
Steve Yegge
13d2c8d6ba
fix(update): refuse overwriting a live foreign claim without --force (bd-98s5c) (#5066)
* fix(update): refuse overwriting a live foreign claim without --force (bd-98s5c)

Plain 'bd update -a <new>' and its shorthand 'bd assign' silently
overwrote another actor's live in_progress claim — rc=0, no warning, no
audit trail. It was the last unfenced cross-actor takeover path in the
CLI: --claim, unclaim, and close all already refuse without --force, so
an agent that had correctly learned not to steamroll still had one verb
that would do it without complaint (originating collisions: two Sol
cross-actor steamrolls, wyvern wy-8uaqw).

The fence is a new validation.AssigneeNotStolen validator wired at the
cmd layer (the exact sibling of the be-035 close fence), covering all
four surfaces: direct and proxied-server update -a, direct and proxied
assign. It refuses only the silent steamroll — every predicate clause is
load-bearing:

- assignee != ""          unassigned beads stay freely assignable
- assignee != actor       self-edits untouched
- assignee != newAssignee idempotent re-assert stays a success (replay)
- status == in_progress   open-bead dispatch stays frictionless
- holder not a claim.pools alias — the same carve-out --claim has, via a
  new shared issueops.ParseClaimPools, so the two verbs can never
  disagree on which holders are pools

Unassigning (-a "") a live foreign claim is fenced the same way — it is
unclaim in disguise. The fence SKIPS under an explicit --if-assignee
guard: that CAS names the holder (nothing silent), and it is how the
bd-wsqvw park transition works, since --force and --if-assignee are
mutually exclusive (mirroring unclaim). A refusal is a policy verdict:
exit 1, never 13 — coordinating is the fix, not retrying. The copy
points at coordination and names --force explicitly; it never teaches
the unclaim steamroller (wy-zs5s2 item 2).

Downstream: wyvern wh-take.sh's steal arm adopts --force (wy-er4ch);
its queue arm can register fable-crew in claim.pools or use
--if-assignee. bd batch remains a raw-transaction surface that bypasses
cmd-layer fences (pre-existing; noted on the bead).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EF8QbCbF6JnTuoCKvu9xiG

* fix(update): let the claim CAS keep its canonical conflict copy under --claim -a

CI caught TestProxiedServerUpdate/claim_then_other_user_conflicts: with
--claim and -a combined, the reassign fence fired on the pre-claim
snapshot and replaced the claim CAS's "already claimed" refusal with
the reassign copy. The claim CAS is itself the anti-steal gate — a
foreign live claim fails it before any field update runs, and an
assignee edit that rides a WON claim only ever touches the actor's own
fresh claim — so the fence now defers to it (skips when claimFlag is
set), on both the direct and proxied paths. Existing automation keys on
the canonical message; a new embedded subtest fences the contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EF8QbCbF6JnTuoCKvu9xiG

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-27 15:10:12 -07:00
kev
ba284fd6e9 feat(lint): accept Acceptance Criteria heading for epics (#3834)
bd lint required "## Success Criteria" for epics but "## Acceptance
Criteria" for bug/task/feature/story. Agents repeatedly trip on this
epic-only exception. Now an epic satisfies the requirement with either
heading, while Success Criteria stays canonical for new epics.

The OR-rule lives in validation.ValidateTemplate: when the issue type is
epic and the missing required heading is "success criteria", a present
"acceptance criteria" heading also satisfies it. This is additive — every
existing Success-Criteria epic still passes — and it does NOT add a second
entry to RequiredSections (which would require BOTH headings). Because bd
lint, bd create --validate, and bd doctor --check=conventions all route
through ValidateTemplate, the fix covers all three.

The alias is epic-scoped: a feature/task/bug is still not satisfied by a
"Success Criteria" heading (covered by a regression test).

Updated lint --help and regenerated CLI_REFERENCE.md, website lint.md
(all versions), and llms-full.txt; freshness checks pass.

Non-goals: not changing the canonical heading for new epics; not relaxing
requirements for any other type.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 23:00:30 -04:00
Jim Wordelman
f1db5a9fa5
fix(close): refuse silent close on actor/assignee mismatch (#3734)
* fix(close): be-035 refuse silent close on actor/assignee mismatch

bd close now requires the actor to match the bead's assignee (or have
--force) before persisting. Without this, an actor whose claim was
overwritten by a concurrent re-claim could call bd close, see "✓ Closed"
on stdout, and leave the bead open in the store — silent data loss.

The storage UPDATE was already id-only with proper rowcount checking,
so this is purely a CLI-layer authority guard implemented as a new
validation.AssigneeMatches validator wired into validateIssueClosable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: release gate PASS for be-07y (be-035 close authority guard)

Cherry-pick of 7a925e304 onto a clean branch off origin/main. Verified
delta byte-identical to reviewed commit. All four be-035 acceptance
criteria covered; reviewer-recorded PASS verdict in bead notes; tests
pass on the touched surfaces (TestAssigneeMatches 6/6, TestEmbeddedClose
35/35 incl. four new authority-guard cases, TestEmbeddedCloseConcurrent).
Three full-suite flakes observed are pre-existing baseline (reproduce
on plain origin/main).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(count): close alice-assigned fixture with --force under be-035 guard

TestEmbeddedCount's setup created a fixture assigned to alice and closed it
as the test actor ("Test"). With this PR's be-035 close-authority guard, that
cross-actor close is now correctly refused (exit 1), failing the test setup at
count_embedded_test.go:84.

The fixture must remain assigned to alice for the --assignee alice count
assertion below (expects >=3), so close it with --force rather than dropping
the assignee. Fixes the Test (Embedded Dolt Cmd 5/20) shard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(validation): note identity-by-string semantics of AssigneeMatches

Addresses review question: two principals sharing one actor name both pass
the check, because the actor string is compared verbatim and bd has no
identity layer. Document this as intentional — the guard removes silent
cross-actor closes without adding new identity guarantees.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(close): update proxied-server call site for validateIssueClosable actor param

Maintainer branch-update for #3734: upstream added cmd/bd/close_proxied_server.go
after this PR's base; align its call with the PR's widened signature.

Agent-Signature: claude-fable-5-high on behalf of matt wilkie

---------

Co-authored-by: Jim Wordelman <jim@wordelman.name>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
2026-07-05 23:51:45 -07:00
Kevin Glynn
4e32258c9a
fix(create): normalize trailing hyphen in dbPrefix before prefix validation (#4233)
ValidateIDPrefixAllowed compared the raw dbPrefix against id via HasPrefix(id, dbPrefix+"-"), so a config.issue_prefix stored with a trailing hyphen (e.g. "bd-") produced "bd--" and threw a false "prefix mismatch" on bd create. The allowedPrefixes branch already normalized each entry with TrimSuffix(allowed, "-"); this applies the same normalization to dbPrefix. Also fixes the error message (shows 'bd-' not 'bd--'). Adds trailing-hyphen regression cases.

Fixes #4208

Co-authored-by: kevglynn <kevglynn@users.noreply.github.com>
2026-06-16 10:21:06 -07:00
Kevin Glynn
ffe69aaa4b
fix: promote gate to built-in type so formula pour works (#3382)
* fix: promote gate to built-in type so formula pour works (GH#3213)

bd mol pour fails with 'invalid issue type: gate' when a formula step
has a gate field. The pour pipeline creates companion beads of type
"gate", but gate was removed from the built-in types list. Since bd
gate create/check/resolve commands already hardcode IssueType("gate"),
gate should be built-in like molecule and event.

Adds TypeGate constant and includes it in IsValid(). This is the same
pattern used to re-promote molecule for swarm coordination.

Fixes #3213

* fix: update TestEventTypeValidation for gate as built-in

The test asserted gate is NOT built-in, but we promoted it. Flip the
assertion to match the new behavior.

* fix: suppress gosec G304 false positive in hookWorkTreeRoot

The path is filepath.Join(os.Getenv("GIT_DIR"), "gitdir") — reading a
well-known git internal file from a trusted environment variable set by
git itself during hook execution. Not a user-controlled file inclusion.

This false positive causes the Lint CI check to fail on every PR in
the repo, masking real lint issues.
2026-04-24 05:10:56 -07:00
garnet
3dae6bb3df refactor: remove gastown/Gas Town string references from beads code and docs (bd-1ue8)
Replace gastown-specific references with generic alternatives throughout
the codebase:

- Rename --gastown flag to --orchestrator in bd doctor
- Rename gastownMode/gastownThreshold params to orchestratorMode/orchestratorThreshold
- Rename isGasTownTownRoot() to isOrchestratorRoot()
- Replace "gastown" in CLI examples with generic rig names (my-project, other-project)
- Update comments replacing "Gas Town" with "orchestrator" or "multi-agent workspace"
- Update active docs (DOLT.md, CONFIG.md, ADVANCED.md, etc.)
- Update test data to use generic names instead of "gastown"
- Update role templates (deacon, witness, refinery) to use generic language

Preserved as historical (not changed):
- CHANGELOG.md entries (historical record)
- ARTICLES.md (links to real published articles)
- info.go version notes (historical release notes)
- gastown/ file path references in dolt-concurrency.md (point to actual repo)
2026-03-20 18:39:50 -07:00
emma
63432acf64 fix: --validate checks --acceptance field, add validation.on-close config (PR #2654)
Three fixes for validation consistency:

1. bd create --validate now uses LintIssue() instead of ValidateTemplate(),
   bringing it to parity with bd lint. A non-empty --acceptance field now
   satisfies the "Acceptance Criteria" requirement without needing the
   heading in --description. (GH#2468 parity)

2. --dry-run no longer bypasses --validate. Validation now runs before the
   dry-run exit, so users get feedback on template issues during preview.

3. New validation.on-close config option (none|warn|error, default: none).
   When enabled, warns on terse close reasons (<20 chars) or default
   "Closed" reasons. Mirrors existing validation.on-create pattern.

Co-Authored-By: seanmartinsmith <114885497+seanmartinsmith@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 22:21:23 -07:00
beads/crew/lizzy
21e23bc571 feat: epic close guards, merge re-parenting, and progress display
Prevent closing epics with open children (use --force to override).
Re-parent children to merge target during duplicate merges to prevent
orphaning. Show epic progress (N/M complete) in bd show output.
Normalize related/relates-to dependency types and weight dependents 3×
in merge target selection.

From: https://github.com/steveyegge/beads/pull/2500

Co-Authored-By: matt wilkie <maphew@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:33:13 -07:00
beads/crew/emma
3dbf3c7cfd fix: bd lint accepts non-empty acceptance_criteria field without heading (GH#2468)
Previously, bd lint required the literal text "Acceptance Criteria" (or
"Success Criteria" for epics) to appear inside the acceptance_criteria
field content. Now a non-empty field satisfies the requirement regardless
of whether a markdown heading is present.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:53:37 -07:00
beads/crew/leeloo
0dc6bdb47f
fix(lint): check AcceptanceCriteria field in LintIssue
LintIssue() only checked issue.Description when validating required
template sections. If acceptance criteria were stored in the dedicated
AcceptanceCriteria field, lint incorrectly reported them as missing.

Now concatenates both fields before validation so required sections
found in either field satisfy the lint check.

Closes #1472

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

Executed-By: beads/crew/leeloo
Rig: beads
Role: crew
2026-02-23 12:50:54 +00:00
Clawdbot
61d9a63927 fix: treat molecule as core issue type 2026-02-18 12:55:26 -08:00
beads/crew/emma
dd01a655b9 fix: repair test suite for Dolt-only backend (bd-h0zvj.4)
Fix pre-existing test failures from Dolt-Native Pruning phases 1-8.
All internal/* packages and cmd/bd/doctor now pass. Remaining 19
failures in cmd/bd are routing (9), init path checks (7), and tips (3).

Key fixes:
- Remove type assertions on concrete *dolt.DoltStore (not an interface)
- Fix DATETIME timezone bug: normalize timestamps to UTC before storage
- Replace SQLite datetime() syntax with MySQL DATE_SUB() in stale tests
- Remove --backend flag from init test invocations (flag removed)
- Update doctor tests for Dolt-only backend behavior
- Skip/remove tests for removed features (CompactableStorage,
  FederatedStorage, ExportToMultiRepo, merge driver, no-db mode)
- Add issue_prefix config in test stores that create issues
- Fix export_hashes → interactions table reference in schema test

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 18:17:16 -08:00
beads/crew/lizzy
2bb827facb style: run gofmt across entire codebase (bd-nmk12)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:20 -08:00
beads/crew/lizzy
de567cda79 chore: unexport 14 dead symbols across 8 packages
Unexport package-internal symbols that have no external callers:
- validation: ValidatePrefix, ValidatePrefixWithAllowed, ForUpdate, ForClose, ForDelete, ForReopen
- debug: PrintNormal, PrintlnNormal
- linear: IssuesQuery
- timeparsing: IsCompactDuration, ParseNaturalLanguage
- utils: FindMoleculesJSONLInDir, ParseIssueID
- testutil/fixtures: XLargeFromJSONL
- storage/sqlite: Snapshot type

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 09:24:22 -08:00
elinor
2d4469763c refactor(validation): remove Gas Town actor validation from beads core (bd-741si)
Remove Gas Town-specific validation that does not belong in beads core:

Removed from internal/validation/bead.go:
- ValidAgentRoles, TownLevelRoles, RigLevelRoles, NamedRoles constants
- isValidRole, isTownLevelRole, isRigLevelRole, isNamedRole helpers
- ExtractAgentPrefix function
- ValidateAgentID function

Removed from internal/validation/bead_test.go:
- TestValidateAgentID
- TestExtractAgentPrefix

Updated cmd/bd/create.go:
- Use ValidateIDFormat for all issue types including agents
- Add comment noting Gas Town agent validation belongs in gastown

Gas Town-specific validation (mayor, deacon, witness, refinery, polecat, crew)
should be implemented in gastown, not beads core.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 20:15:30 -08:00
collins
7cf67153de refactor(types): remove Gas Town type constants from beads core (bd-w2zz4)
Remove Gas Town-specific type constants (TypeMolecule, TypeGate, TypeConvoy,
TypeMergeRequest, TypeSlot, TypeAgent, TypeRole, TypeRig, TypeEvent, TypeMessage)
from internal/types/types.go.

Beads now only has core work types built-in:
- bug, feature, task, epic, chore

All Gas Town types are now purely custom types with no special handling in beads.
Use string literals like "gate" or "molecule" when needed, and configure
types.custom in config.yaml for validation.

Changes:
- Remove Gas Town type constants from types.go
- Remove mr/mol aliases from Normalize()
- Update bd types command to only show core types
- Replace all constant usages with string literals throughout codebase
- Update tests to use string literals

This decouples beads from Gas Town, making it a generic issue tracker.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 10:36:59 -08:00
Steven Syrek
73d4d5ecb2
fix(create): validate explicit IDs against allowed_prefixes using starts-with matching (#1137)
When creating issues with explicit IDs like `bd create --id hq-cv-test`,
the prefix validation was failing even when `hq-cv` was in `allowed_prefixes`.

Root cause: `ExtractIssuePrefix("hq-cv-test")` returns `"hq"` (not `"hq-cv"`)
because "test" looks like an English word, causing the algorithm to fall back
to the first hyphen. The validation then checked if `"hq"` was in the allowed
list containing `"hq-cv"` - which failed.

The fix adds `ValidateIDPrefixAllowed()` which validates the full ID using
"starts with" matching (the same approach the importer uses successfully).
This correctly handles multi-hyphen prefixes like `hq-cv-` regardless of
what the suffix looks like.

Fixes #1135

Co-authored-by: Steven Syrek <steven.syrek@deepl.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:08:56 -08:00
beads/crew/emma
c8ffcce621 fix(validation): accept prefix when it's a prefix of allowed entry (GH#1135)
When ExtractIssuePrefix returns "hq" from an ID like "hq-cv-test"
(because "test" is word-like), but "hq-cv" is in allowedPrefixes,
we should accept "hq" since it's clearly intended to be part of "hq-cv".

This handles cases where the prefix extraction algorithm yields a
shorter prefix than the user intended, but the full intended prefix
is in the allowed list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 18:25:33 -08:00
beads/crew/emma
4f0f5744a6 feat(types): remove Gas Town types from core built-in types
Core beads built-in types now only include work types:
- bug, feature, task, epic, chore

Gas Town types (molecule, gate, convoy, merge-request, slot, agent,
role, rig, event, message) are now "well-known custom types":
- Constants still exist for code convenience
- Require types.custom configuration for validation
- bd types command shows core types and configured custom types

Changes:
- types.go: Separate core work types from well-known custom types
- IsValid(): Only accepts core work types
- bd types: Updated to show core types and custom types from config
- memory.go: Use ValidateWithCustom for custom type support
- multirepo.go: Only check core types as built-in
- Updated all tests to configure custom types

This allows Gas Town (and other projects) to define their own types
via config while keeping beads core focused on work tracking.

Closes: bd-find4

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 05:07:11 -08:00
gastown/crew/max
87f84c5fa6 fix(create): use agent-aware prefix extraction for agent beads
The generic ValidateIDFormat() used isLikelyHash() which treated
3-character suffixes like "nux" as valid hashes, causing agent IDs
like "nx-nexus-polecat-nux" to extract prefix as "nx-nexus-polecat"
instead of the correct "nx".

Fix: For --type=agent, validate agent ID format first and use
ExtractAgentPrefix() which correctly extracts prefix from the
first hyphen for agent IDs.

Fixes #591

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:42:06 -08:00
gastown/crew/george
9ecdc00664 feat(types): add "enhancement" as alias for "feature" type
Support --type enhancement as an alias for --type feature when creating
issues. The normalization happens before validation to ensure consistency
across all code paths.

Closes gt-hzanoe

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 15:44:33 -08:00
Eugene Sukhodolin
d04bffb9b6
fix(validation): support hyphenated prefixes in ValidateIDFormat (#1013)
* test(validation): add failing tests for hyphenated prefix parsing

Reproduces bug where `bd create --parent` fails for projects with
hyphenated prefixes like "bead-me-up" or "web-app".

Root cause: ValidateIDFormat splits on first hyphen, so:
  "bead-me-up-3e9.1" → prefix "bead" (wrong, should be "bead-me-up")

The bug flow in create.go:
1. User runs: bd create "Child" --parent bead-me-up-3e9
2. GetNextChildID generates: bead-me-up-3e9.1
3. ValidateIDFormat extracts: "bead" (splits at first hyphen)
4. ValidatePrefix compares: "bead" vs "bead-me-up" → MISMATCH

Tests added:
- TestValidateIDFormat: 6 cases for hyphenated prefix IDs
- TestValidateIDFormat_ParentChildFlow: simulates exact --parent flow,
  showing simple prefixes pass while hyphenated prefixes fail

Workaround: use --force flag to bypass prefix validation.

* fix(validation): support hyphenated prefixes in ValidateIDFormat

Use utils.ExtractIssuePrefix instead of naive first-hyphen splitting.
This fixes bd create --parent failing for projects with hyphenated
prefixes like "bead-me-up" or "web-app".

Before: "bead-me-up-3e9" → prefix "bead" (wrong)
After:  "bead-me-up-3e9" → prefix "bead-me-up" (correct)

ExtractIssuePrefix uses smart heuristics: split on last hyphen,
check if suffix is hash-like (3-8 chars, alphanumeric, digits for 4+).

* Update internal/validation/bead_test.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-11 18:16:48 -08:00
dave
a70c3a8cbe feat: extract Gas Town types from beads core (bd-i54l)
Remove Gas Town-specific issue types (agent, role, rig, convoy, slot)
from beads core. These types are now identified by labels instead:
- gt:agent, gt:role, gt:rig, gt:convoy, gt:slot

Changes:
- internal/types/types.go: Remove TypeAgent, TypeRole, TypeRig, TypeConvoy, TypeSlot constants
- cmd/bd/agent.go: Create agents with TypeTask + gt:agent label
- cmd/bd/merge_slot.go: Create slots with TypeTask + gt:slot label
- internal/storage/sqlite/queries.go, transaction.go: Query convoys by gt:convoy label
- internal/rpc/server_issues_epics.go: Check gt:agent label for role_type/rig label auto-add
- cmd/bd/create.go: Check gt:agent label for role_type/rig label auto-add
- internal/ui/styles.go: Remove agent/role/rig type colors
- cmd/bd/export_obsidian.go: Remove agent/role/rig/convoy type tag mappings
- Update all affected tests

This enables beads to be a generic issue tracker while Gas Town
uses labels for its specific type semantics.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2026-01-06 22:18:37 -08:00
furiosa
bf378650f4 feat(types): add rig identity bead type (gt-zmznh)
- Add TypeRig constant to IssueType enum
- Update IsValid() method to include TypeRig
- Add UI color (orange) and style for rig type
- Update CLI flag descriptions in create and update commands
- Add Obsidian export tag for rig type
- Add comprehensive test cases for rig and other newer types

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 18:55:45 -08:00
web3dev1337
661556ae62
feat: add multi-prefix support via allowed_prefixes config (#881)
feat: add multi-prefix support via allowed_prefixes config

Adds support for allowing multiple prefixes in a beads database via the
allowed_prefixes config key. This is needed for Gas Town which uses different
prefixes for different purposes (hq-, gt-, rig-specific prefixes).

Usage: bd config set allowed_prefixes "gt,hq,hmc"

PR #881 by @web3dev1337
2026-01-04 11:13:44 -08:00
wolf
c6fe9d71ca fix(validation): support hyphenated rig names in agent IDs (GH#854)
Rewrites ValidateAgentID to scan right-to-left for known role tokens
instead of relying on fixed position parsing. This allows rig names
containing hyphens (e.g., ob-my-project-witness).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:44:09 -08:00
beads/crew/grip
db93ba0709 feat(validation): add ValidateTemplate() function (bd-615z)
Implements template validation for bd lint and bd create --validate:
- ValidateTemplate() checks description for required sections
- LintIssue() validates an existing issue
- TemplateError provides actionable missing section details
- Case-insensitive, flexible heading matching

Also fixes: close.go missing session parameter in CloseIssue calls

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 12:42:43 -08:00
gastown/polecats/slit
eb0cc50ce6 Fix agent ID validation to accept any rig prefix (gt-w0fqg)
The ValidateAgentID function was hardcoded to only accept 'gt-' prefix,
but beads rig uses 'bd-' prefix. Now accepts any valid prefix.

Changes:
- Extract prefix dynamically instead of hardcoding 'gt-'
- Accept IDs like bd-mayor, bd-beads-polecat-pearl
- Update error messages to be prefix-agnostic
- Add test cases for alternative prefixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 11:14:20 -08:00
Steve Yegge
643a162f0e Centralize validation patterns with composable validators (bd-jbqx)
Add composable issue validators to internal/validation package:
- IssueValidator type with Chain() composition function
- Exists(), NotTemplate(), NotPinned(), NotClosed(), NotHooked() validators
- HasStatus(), HasType() for checking allowed values
- ForUpdate(), ForClose(), ForDelete(), ForReopen() convenience chains

Update cmd/bd/show_unit_helpers.go to use centralized validators instead
of duplicated inline validation logic. This enables consistent validation
across all commands with a single source of truth.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 16:00:22 -08:00
Steve Yegge
c2c2ef5d07 feat: Update agent ID validation for canonical naming (gt-zvte2)
Updates ValidateAgentID to accept canonical format: prefix-rig-role-name
- Rig-level: gt-<rig>-witness (was gt-witness-<rig>)
- Named: gt-<rig>-crew-<name> (was gt-crew-<rig>-<name>)

Town-level agents unchanged: gt-mayor, gt-deacon

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 14:55:06 -08:00
Steve Yegge
46cdf075d4 feat: add agent ID pattern validation for bd create --type=agent (gt-hlaaf)
- Update ParseIssueType to use canonical types.IsValid() (includes agent, role, gate, message)
- Add ValidateAgentID function to validate gt-<role>[-<rig>[-<name>]] pattern
- Wire up validation in create.go when --type=agent with explicit ID
- Update --type flag help text to include agent and role types
- Add comprehensive test coverage for agent ID validation
2025-12-28 00:07:04 -08:00
Steve Yegge
46488d4f96 Add 'molecule' as valid issue type
Molecules are composable workflow templates used by Gas Town (gt) for
defining multi-step processes like bootstrap, engineer-in-box, etc.

Changes:
- Add TypeMolecule constant to internal/types/types.go
- Add molecule to IsValid() switch case
- Add molecule and merge-request to validation/bead.go validTypes map
- Update help text in create.go, show.go, list.go
- Add test cases for molecule and merge-request types

Closes gt-qn4l

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:31:33 -08:00
matt wilkie
fb16e504e6
Fix tests (bd-6ss and sub-issues) (#626)
Test coverage improvements for bd-6ss. Fixing failing test assumption in follow-up commit.
2025-12-18 18:23:30 -08:00
Steve Yegge
0c9e78f42e fix: improve priority format documentation and error message (GH#517)
Claude was using word-based priorities like "medium" instead of numeric
values (0-4 or P0-P4), causing bd create commands to fail in a loop.

Changes:
- Update bd prime output to clearly document priority format with example
- Add explicit note: NOT "high"/"medium"/"low"
- Improve error message to mention that words are not valid

Closes #517

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:07:55 -08:00
Steve Yegge
d5239eeef9 Refactor: Extract duplicated validation logic to internal/validation
Extracted repeated priority and ID validation patterns from CLI commands
into reusable functions in internal/validation/bead.go.

Changes:
- Added ValidatePriority(): Combines parsing and error handling
- Added ValidateIDFormat(): Validates ID format and extracts prefix
- Added ValidatePrefix(): Validates prefix matching with database config
- Updated create.go and show.go to use new validation functions
- Simplified force flag logic to always call ValidatePrefix()
- Added comprehensive tests for all validation functions
- Added TODO comment for daemon mode validation enhancement

Results:
- Reduced code duplication by ~20 lines
- Centralized validation logic for easier maintenance
- Consistent error messages across all commands
- All tests passing

Fixes bd-g5p7

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 20:39:23 -05:00
Steve Yegge
bbfedb060a Refactor: extract duplicated validation and flag logic (bd-g5p7)
- Created internal/validation package for centralized validation logic
- Created cmd/bd/flags.go for shared flag registration
- Updated create and update commands to use shared logic
- Added support for 'P1' style priority to update command
- Added tests for validation logic

Amp-Thread-ID: https://ampcode.com/threads/T-c8d369a3-32f0-42a0-96d1-fd589e89bd6b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-20 19:11:27 -05:00