Skip to content

Comments

fix(update): use IsValidWithCustom for --type validation#1356

Merged
steveyegge merged 1 commit intosteveyegge:mainfrom
aleiby:fix/bd-o581-update-custom-types
Jan 27, 2026
Merged

fix(update): use IsValidWithCustom for --type validation#1356
steveyegge merged 1 commit intosteveyegge:mainfrom
aleiby:fix/bd-o581-update-custom-types

Conversation

@aleiby
Copy link
Contributor

@aleiby aleiby commented Jan 27, 2026

Summary

bd update --type=agent (and other custom types) fails with:

Error: invalid issue type "agent". Valid types: bug, feature, task, epic, chore, merge-request, molecule, gate, agent, role, rig, convoy, event, slot

The error message lists custom types as valid, but the validator rejects them anyway.

Root Cause

When Gas Town types were moved from core to types.custom config, cmd/bd/update.go was not updated. It still calls IsValid() (line 116), which only checks the 5 built-in types (bug, feature, task, epic, chore). The storage layer was fixed in PR #1322, but the CLI-level validation was missed.

The error message at line 117 was also left hardcoded with the old list, creating the confusing situation where the error tells you a type is valid while simultaneously rejecting it.

Fix

  • Load custom types from store config via GetCustomTypes()
  • Replace IsValid() with IsValidWithCustom(customTypes)
  • Build the error message dynamically from actual configured types

This follows the same pattern used in the storage layer fix (PR #1322).

Scope Check

Audited all .IsValid() calls in cmd/bd/ to confirm this is the only affected site:

Call site Type Needs custom?
update.go:116 IssueType Yes — this PR
list.go:600 MolType No — fixed enum
create.go:130 MolType No
ready.go:60 MolType No
ready.go:104 SortPolicy No
create_form.go:183 DependencyType No
create.go:680 DependencyType No
markdown.go:393 DependencyType No
doctor/deep.go:339 AgentState No

Only IssueType has the custom types extension mechanism (IsValidWithCustom). The other types are fixed enums. Issue #1002 covers a similar problem in bd create but that's a separate code path.

Impact

Without this fix, bd update --type=<custom> is broken for all custom types. This blocks workflows that need to change issue types to agent, role, rig, convoy, etc. — for example, fixing beads that were created as task but should be agent.

Testing

  • Build passes
  • Existing tests pass (1 pre-existing failure in TestExportToJSONLWithStore_IncludesTombstones, unrelated)
  • Single file change

🤖 Tackled with Claude Code

bd update --type rejected custom types (agent, role, etc.) because it
called IsValid() which only checks built-in types. Now loads custom
types from config and calls IsValidWithCustom(), matching the pattern
used in the storage layer (PR steveyegge#1322).

Also fixes the error message to dynamically list valid types from
config instead of hardcoding them.
@aleiby aleiby marked this pull request as ready for review January 27, 2026 08:00
Copy link
Owner

@steveyegge steveyegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - good fix using existing IsValidWithCustom() pattern. Clean change, well-documented audit of other call sites. Lint failure is pre-existing on main.

@steveyegge steveyegge merged commit c156580 into steveyegge:main Jan 27, 2026
4 of 7 checks passed
@aleiby aleiby deleted the fix/bd-o581-update-custom-types branch January 27, 2026 20:47
groblegark pushed a commit to groblegark/beads that referenced this pull request Jan 31, 2026
…1356)

bd update --type rejected custom types (agent, role, etc.) because it
called IsValid() which only checks built-in types. Now loads custom
types from config and calls IsValidWithCustom(), matching the pattern
used in the storage layer (PR steveyegge#1322).

Also fixes the error message to dynamically list valid types from
config instead of hardcoding them.
groblegark pushed a commit to groblegark/beads that referenced this pull request Jan 31, 2026
…1356)

bd update --type rejected custom types (agent, role, etc.) because it
called IsValid() which only checks built-in types. Now loads custom
types from config and calls IsValidWithCustom(), matching the pattern
used in the storage layer (PR steveyegge#1322).

Also fixes the error message to dynamically list valid types from
config instead of hardcoding them.
PabloLION added a commit to PabloLION/beads that referenced this pull request Feb 4, 2026
When daemon is running, `store` is nil (by design - daemon owns the
database). PR steveyegge#1356 added custom type validation using `store.GetCustomTypes()`
but this returns empty in daemon mode, causing validation to reject all
custom types.

Add fallback to `config.GetCustomTypesFromYAML()` when store is nil,
following the same pattern already used in the storage layer.

Fixes: steveyegge#1499

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants