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.
This commit is contained in:
@@ -227,9 +227,9 @@ func runMolBond(cmd *cobra.Command, args []string) {
|
|||||||
// Compound protos are templates - always use permanent storage
|
// Compound protos are templates - always use permanent storage
|
||||||
result, err = bondProtoProto(ctx, store, issueA, issueB, bondType, customTitle, actor)
|
result, err = bondProtoProto(ctx, store, issueA, issueB, bondType, customTitle, actor)
|
||||||
case aIsProto && !bIsProto:
|
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:
|
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:
|
default:
|
||||||
result, err = bondMolMol(ctx, targetStore, issueA, issueB, bondType, actor)
|
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.
|
// bondProtoMol bonds a proto to an existing molecule by spawning the proto.
|
||||||
// If childRef is provided, generates custom IDs like "parent.childref" (dynamic bonding).
|
// 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
|
// Load proto subgraph
|
||||||
subgraph, err := loadTemplateSubgraph(ctx, s, proto.ID)
|
subgraph, err := loadTemplateSubgraph(ctx, s, proto.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -389,7 +389,7 @@ func bondProtoMol(ctx context.Context, s storage.Storage, proto, mol *types.Issu
|
|||||||
opts := CloneOptions{
|
opts := CloneOptions{
|
||||||
Vars: vars,
|
Vars: vars,
|
||||||
Actor: actorName,
|
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
|
// 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)
|
// 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
|
// 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
|
// bondMolMol bonds two molecules together
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ func runMolSpawn(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, attach := range attachments {
|
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 {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error attaching %s: %v\n", attach.id, err)
|
fmt.Fprintf(os.Stderr, "Error attaching %s: %v\n", attach.id, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ func TestBondProtoMol(t *testing.T) {
|
|||||||
|
|
||||||
// Bond proto to molecule
|
// Bond proto to molecule
|
||||||
vars := map[string]string{"name": "auth-feature"}
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("bondProtoMol failed: %v", err)
|
t.Fatalf("bondProtoMol failed: %v", err)
|
||||||
}
|
}
|
||||||
@@ -840,7 +840,7 @@ func TestSpawnWithBasicAttach(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attach the second proto (simulating --attach flag behavior)
|
// 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 {
|
if err != nil {
|
||||||
t.Fatalf("Failed to bond attachment: %v", err)
|
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)
|
// 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 {
|
if err != nil {
|
||||||
t.Fatalf("Failed to bond attachA: %v", err)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("Failed to bond attachB: %v", err)
|
t.Fatalf("Failed to bond attachB: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1063,7 +1063,7 @@ func TestSpawnAttachTypes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bond with specified type
|
// 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 {
|
if err != nil {
|
||||||
t.Fatalf("Failed to bond: %v", err)
|
t.Fatalf("Failed to bond: %v", err)
|
||||||
}
|
}
|
||||||
@@ -1228,7 +1228,7 @@ func TestSpawnVariableAggregation(t *testing.T) {
|
|||||||
|
|
||||||
// Bond attachment with same variables
|
// Bond attachment with same variables
|
||||||
spawnedMol, _ := s.GetIssue(ctx, spawnResult.NewEpicID)
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("Failed to bond: %v", err)
|
t.Fatalf("Failed to bond: %v", err)
|
||||||
}
|
}
|
||||||
@@ -2238,7 +2238,7 @@ func TestBondProtoMolWithRef(t *testing.T) {
|
|||||||
// Bond proto to patrol with custom child ref
|
// Bond proto to patrol with custom child ref
|
||||||
vars := map[string]string{"polecat_name": "ace"}
|
vars := map[string]string{"polecat_name": "ace"}
|
||||||
childRef := "arm-{{polecat_name}}"
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("bondProtoMol failed: %v", err)
|
t.Fatalf("bondProtoMol failed: %v", err)
|
||||||
}
|
}
|
||||||
@@ -2309,14 +2309,14 @@ func TestBondProtoMolMultipleArms(t *testing.T) {
|
|||||||
|
|
||||||
// Bond arm-ace
|
// Bond arm-ace
|
||||||
varsAce := map[string]string{"name": "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 {
|
if err != nil {
|
||||||
t.Fatalf("bondProtoMol (ace) failed: %v", err)
|
t.Fatalf("bondProtoMol (ace) failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bond arm-nux
|
// Bond arm-nux
|
||||||
varsNux := map[string]string{"name": "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 {
|
if err != nil {
|
||||||
t.Fatalf("bondProtoMol (nux) failed: %v", err)
|
t.Fatalf("bondProtoMol (nux) failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ func runPour(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, attach := range attachments {
|
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 {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error attaching %s: %v\n", attach.id, err)
|
fmt.Fprintf(os.Stderr, "Error attaching %s: %v\n", attach.id, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user