pstradowski 5b4b8a5f16
fix(formula): auto-register custom types used by formula gate steps (#3214)
When a formula step has `gate = { type = "human" }`, the cook pipeline
creates a companion bead with IssueType "gate". But "gate" was
intentionally removed from the built-in type whitelist (see types.go
comment at the IssueType const block) and moved to a custom type that
requires explicit `types.custom` configuration. Without that config,
`bd mol pour` fails with:

  validation failed for issue : invalid issue type: gate

This forces operators to run `bd config set types.custom '["gate"]'`
before pouring any formula with gate steps — a papercut that blocks
first-time formula users.

Fix: add `ensureSubgraphCustomTypes` in `cloneSubgraph` (template.go)
that scans the template issues for non-built-in types and auto-registers
any missing ones via `SetConfig("types.custom", ...)` before the clone
transaction creates the issues. This is the same store path that
`bd config set` uses, which triggers `SyncCustomTypesTable` to populate
the normalized `custom_types` table consumed by `PrepareIssueForInsert →
ValidateWithCustom`.

Also add `EnsureCustomTypeInTx` helper in issueops/config_helpers.go
for callers that already hold a transaction (not used by this fix but
provides a lower-level primitive for future use).

The fix applies to both `bd mol pour` (persistent) and `bd mol wisp`
(ephemeral) since both call `cloneSubgraph`.

Fixes #3213

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 18:19:51 -07:00
..
2026-03-19 12:49:44 -07:00
2026-03-24 12:01:16 -07:00
2026-03-20 13:58:17 -07:00
2026-03-24 17:28:13 -07:00