fix(update): accept custom types from types.custom config (GH#hq-8hif1z)
Some checks failed
CI / Check version consistency (push) Successful in 4s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 6m29s
CI / Lint (push) Failing after 2m25s
CI / Test Nix Flake (push) Failing after 51s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
Some checks failed
CI / Check version consistency (push) Successful in 4s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 6m29s
CI / Lint (push) Failing after 2m25s
CI / Test Nix Flake (push) Failing after 51s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
The `bd update --type` command was rejecting custom types (like role, agent, rig) even when configured via types.custom. The issue was that type validation used IsValid() which only checks the 5 core types, ignoring custom types. Changes: - CLI (update.go): Use IsValidWithCustom() with types from config - Storage (validators.go): Add validateIssueTypeWithCustom() function - Storage (queries.go, transaction.go): Fetch and pass custom types The error message now dynamically shows all valid types including custom ones. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -886,11 +886,15 @@ func (s *SQLiteStorage) UpdateIssue(ctx context.Context, id string, updates map[
|
||||
return fmt.Errorf("issue %s not found", id)
|
||||
}
|
||||
|
||||
// Fetch custom statuses for validation
|
||||
// Fetch custom statuses and types for validation (GH#hq-8hif1z)
|
||||
customStatuses, err := s.GetCustomStatuses(ctx)
|
||||
if err != nil {
|
||||
return wrapDBError("get custom statuses", err)
|
||||
}
|
||||
customTypes, err := s.GetCustomTypes(ctx)
|
||||
if err != nil {
|
||||
return wrapDBError("get custom types", err)
|
||||
}
|
||||
|
||||
// Build update query with validated field names
|
||||
setClauses := []string{"updated_at = ?"}
|
||||
@@ -902,8 +906,8 @@ func (s *SQLiteStorage) UpdateIssue(ctx context.Context, id string, updates map[
|
||||
return fmt.Errorf("invalid field for update: %s", key)
|
||||
}
|
||||
|
||||
// Validate field values (with custom status support)
|
||||
if err := validateFieldUpdateWithCustomStatuses(key, value, customStatuses); err != nil {
|
||||
// Validate field values (with custom status and type support)
|
||||
if err := validateFieldUpdateWithCustom(key, value, customStatuses, customTypes); err != nil {
|
||||
return wrapDBError("validate field update", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user