From ee3d070d08a73af01d1596dca7fd3f40da6b1044 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Tue, 23 Dec 2025 15:25:13 -0800 Subject: [PATCH] fix(mol): respect --pour flag in bond operations (bd-l7y3) bondProtoMol was hardcoding Wisp=true, ignoring --pour flag. Now passes pour parameter through the call chain so --pour correctly creates persistent (non-wisp) issues. --- cmd/bd/mol_bond.go | 12 ++++++------ cmd/bd/mol_spawn.go | 2 +- cmd/bd/mol_test.go | 18 +++++++++--------- cmd/bd/pour.go | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/bd/mol_bond.go b/cmd/bd/mol_bond.go index 44417ba2..070e3c7a 100644 --- a/cmd/bd/mol_bond.go +++ b/cmd/bd/mol_bond.go @@ -227,9 +227,9 @@ func runMolBond(cmd *cobra.Command, args []string) { // Compound protos are templates - always use permanent storage result, err = bondProtoProto(ctx, store, issueA, issueB, bondType, customTitle, actor) case aIsProto && !bIsProto: - result, err = bondProtoMol(ctx, targetStore, issueA, issueB, bondType, vars, childRef, actor) + result, err = bondProtoMol(ctx, targetStore, issueA, issueB, bondType, vars, childRef, actor, pour) case !aIsProto && bIsProto: - result, err = bondMolProto(ctx, targetStore, issueA, issueB, bondType, vars, childRef, actor) + result, err = bondMolProto(ctx, targetStore, issueA, issueB, bondType, vars, childRef, actor, pour) default: result, err = bondMolMol(ctx, targetStore, issueA, issueB, bondType, actor) } @@ -366,7 +366,7 @@ func bondProtoProto(ctx context.Context, s storage.Storage, protoA, protoB *type // bondProtoMol bonds a proto to an existing molecule by spawning the proto. // If childRef is provided, generates custom IDs like "parent.childref" (dynamic bonding). -func bondProtoMol(ctx context.Context, s storage.Storage, proto, mol *types.Issue, bondType string, vars map[string]string, childRef string, actorName string) (*BondResult, error) { +func bondProtoMol(ctx context.Context, s storage.Storage, proto, mol *types.Issue, bondType string, vars map[string]string, childRef string, actorName string, pour bool) (*BondResult, error) { // Load proto subgraph subgraph, err := loadTemplateSubgraph(ctx, s, proto.ID) if err != nil { @@ -389,7 +389,7 @@ func bondProtoMol(ctx context.Context, s storage.Storage, proto, mol *types.Issu opts := CloneOptions{ Vars: vars, Actor: actorName, - Wisp: true, // wisp by default for molecule execution - bd-2vh3 + Wisp: !pour, // wisp by default, but --pour makes persistent (bd-l7y3) } // Dynamic bonding: use custom IDs if childRef is provided @@ -444,9 +444,9 @@ func bondProtoMol(ctx context.Context, s storage.Storage, proto, mol *types.Issu } // bondMolProto bonds a molecule to a proto (symmetric with bondProtoMol) -func bondMolProto(ctx context.Context, s storage.Storage, mol, proto *types.Issue, bondType string, vars map[string]string, childRef string, actorName string) (*BondResult, error) { +func bondMolProto(ctx context.Context, s storage.Storage, mol, proto *types.Issue, bondType string, vars map[string]string, childRef string, actorName string, pour bool) (*BondResult, error) { // Same as bondProtoMol but with arguments swapped - return bondProtoMol(ctx, s, proto, mol, bondType, vars, childRef, actorName) + return bondProtoMol(ctx, s, proto, mol, bondType, vars, childRef, actorName, pour) } // bondMolMol bonds two molecules together diff --git a/cmd/bd/mol_spawn.go b/cmd/bd/mol_spawn.go index ef997f86..ae5a53e5 100644 --- a/cmd/bd/mol_spawn.go +++ b/cmd/bd/mol_spawn.go @@ -219,7 +219,7 @@ func runMolSpawn(cmd *cobra.Command, args []string) { } for _, attach := range attachments { - bondResult, err := bondProtoMol(ctx, store, attach.issue, spawnedMol, attachType, vars, "", actor) + bondResult, err := bondProtoMol(ctx, store, attach.issue, spawnedMol, attachType, vars, "", actor, pour) if err != nil { fmt.Fprintf(os.Stderr, "Error attaching %s: %v\n", attach.id, err) os.Exit(1) diff --git a/cmd/bd/mol_test.go b/cmd/bd/mol_test.go index 2c962d19..8c1e021b 100644 --- a/cmd/bd/mol_test.go +++ b/cmd/bd/mol_test.go @@ -343,7 +343,7 @@ func TestBondProtoMol(t *testing.T) { // Bond proto to molecule vars := map[string]string{"name": "auth-feature"} - result, err := bondProtoMol(ctx, store, proto, mol, types.BondTypeSequential, vars, "", "test") + result, err := bondProtoMol(ctx, store, proto, mol, types.BondTypeSequential, vars, "", "test", false) if err != nil { t.Fatalf("bondProtoMol failed: %v", err) } @@ -840,7 +840,7 @@ func TestSpawnWithBasicAttach(t *testing.T) { } // Attach the second proto (simulating --attach flag behavior) - bondResult, err := bondProtoMol(ctx, s, attachProto, spawnedMol, types.BondTypeSequential, vars, "", "test") + bondResult, err := bondProtoMol(ctx, s, attachProto, spawnedMol, types.BondTypeSequential, vars, "", "test", false) if err != nil { t.Fatalf("Failed to bond attachment: %v", err) } @@ -945,12 +945,12 @@ func TestSpawnWithMultipleAttachments(t *testing.T) { } // Attach both protos (simulating --attach A --attach B) - bondResultA, err := bondProtoMol(ctx, s, attachA, spawnedMol, types.BondTypeSequential, nil, "", "test") + bondResultA, err := bondProtoMol(ctx, s, attachA, spawnedMol, types.BondTypeSequential, nil, "", "test", false) if err != nil { t.Fatalf("Failed to bond attachA: %v", err) } - bondResultB, err := bondProtoMol(ctx, s, attachB, spawnedMol, types.BondTypeSequential, nil, "", "test") + bondResultB, err := bondProtoMol(ctx, s, attachB, spawnedMol, types.BondTypeSequential, nil, "", "test", false) if err != nil { t.Fatalf("Failed to bond attachB: %v", err) } @@ -1063,7 +1063,7 @@ func TestSpawnAttachTypes(t *testing.T) { } // Bond with specified type - bondResult, err := bondProtoMol(ctx, s, attachProto, spawnedMol, tt.bondType, nil, "", "test") + bondResult, err := bondProtoMol(ctx, s, attachProto, spawnedMol, tt.bondType, nil, "", "test", false) if err != nil { t.Fatalf("Failed to bond: %v", err) } @@ -1228,7 +1228,7 @@ func TestSpawnVariableAggregation(t *testing.T) { // Bond attachment with same variables spawnedMol, _ := s.GetIssue(ctx, spawnResult.NewEpicID) - bondResult, err := bondProtoMol(ctx, s, attachProto, spawnedMol, types.BondTypeSequential, vars, "", "test") + bondResult, err := bondProtoMol(ctx, s, attachProto, spawnedMol, types.BondTypeSequential, vars, "", "test", false) if err != nil { t.Fatalf("Failed to bond: %v", err) } @@ -2238,7 +2238,7 @@ func TestBondProtoMolWithRef(t *testing.T) { // Bond proto to patrol with custom child ref vars := map[string]string{"polecat_name": "ace"} childRef := "arm-{{polecat_name}}" - result, err := bondProtoMol(ctx, s, protoRoot, patrol, types.BondTypeSequential, vars, childRef, "test") + result, err := bondProtoMol(ctx, s, protoRoot, patrol, types.BondTypeSequential, vars, childRef, "test", false) if err != nil { t.Fatalf("bondProtoMol failed: %v", err) } @@ -2309,14 +2309,14 @@ func TestBondProtoMolMultipleArms(t *testing.T) { // Bond arm-ace varsAce := map[string]string{"name": "ace"} - resultAce, err := bondProtoMol(ctx, s, proto, patrol, types.BondTypeParallel, varsAce, "arm-{{name}}", "test") + resultAce, err := bondProtoMol(ctx, s, proto, patrol, types.BondTypeParallel, varsAce, "arm-{{name}}", "test", false) if err != nil { t.Fatalf("bondProtoMol (ace) failed: %v", err) } // Bond arm-nux varsNux := map[string]string{"name": "nux"} - resultNux, err := bondProtoMol(ctx, s, proto, patrol, types.BondTypeParallel, varsNux, "arm-{{name}}", "test") + resultNux, err := bondProtoMol(ctx, s, proto, patrol, types.BondTypeParallel, varsNux, "arm-{{name}}", "test", false) if err != nil { t.Fatalf("bondProtoMol (nux) failed: %v", err) } diff --git a/cmd/bd/pour.go b/cmd/bd/pour.go index 2665a47a..d4684eb3 100644 --- a/cmd/bd/pour.go +++ b/cmd/bd/pour.go @@ -200,7 +200,7 @@ func runPour(cmd *cobra.Command, args []string) { } for _, attach := range attachments { - bondResult, err := bondProtoMol(ctx, store, attach.issue, spawnedMol, attachType, vars, "", actor) + bondResult, err := bondProtoMol(ctx, store, attach.issue, spawnedMol, attachType, vars, "", actor, true) if err != nil { fmt.Fprintf(os.Stderr, "Error attaching %s: %v\n", attach.id, err) os.Exit(1)