Skip to content

bd mol pour: formula gate steps fail with 'invalid issue type: gate' — missed IsValidWithCustom call site #3213

@pstradowski

Description

@pstradowski

Bug

bd mol pour fails when a formula step has gate = { type = "human" }:

Error: pouring proto: failed to create issue from meow-openspec.gate-proposal-review: validation failed for issue : invalid issue type: gate

The formula-pour code path creates a companion bead of type gate, but the validation uses IsValid() (built-in types only) instead of IsValidWithCustom().

Workaround: bd config set types.custom '["gate"]' — registers gate as a custom type.

Reproduction

# .beads/formulas/repro.formula.toml
formula = "repro"
phase = "liquid"

[[steps]]
id = "work"
title = "Do work"
type = "task"

[[steps]]
id = "review"
title = "Human review"
type = "task"
depends_on = ["work"]
gate = { type = "human" }
bd init   # if not already initialized
bd formula list   # should show "repro"
bd mol pour repro
# Error: pouring proto: failed to create issue from repro.gate-review: validation failed for issue : invalid issue type: gate

Diagnosis

This is the same class of bug as #3030 (bd update --type rejects custom types). That issue identified IsValid() vs IsValidWithCustom() as the root cause and was fixed in #3159 for three call sites in the update path.

The formula-pour code path is a fourth call site that was missed by the #3030 fix. The pour pipeline creates companion beads of type gate when a formula step has a gate field, but the creation goes through a validation path that still uses IsValid().

Supporting evidence: the types.custom example in #3030 already includes gate in its list, confirming that bd's own ecosystem expects gate-type beads to exist.

Expected behavior

bd mol pour should succeed when a formula has gate steps, without requiring the operator to manually register gate as a custom type. Either:

  1. The formula-pour validation should use IsValidWithCustom() (same fix as bd update --type rejects custom types (agent, convoy, etc.) #3030), or
  2. bd mol pour should auto-register gate as a custom type when it encounters formula gate steps, or
  3. Gate companion beads should use type task instead of gate (with gate semantics carried in metadata/labels).

Environment

  • bd version: 1.0.0 (Homebrew, macOS)
  • Formula schema: TOML with gate = { type = "human" } on steps
  • Storage: embedded Dolt mode

I'm happy to submit a PR if you confirm the diagnosis and preferred fix approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions