Skip to content

Commit 01983a8

Browse files
committed
Merge PR #2552: fix: add StripBeadsDir to convoy dep add/remove for rig-prefixed beads
Ensures convoy dependency operations strip BEADS_DIR to prevent cross-DB routing. PR: #2552 Author: DreadPirateRobertz
2 parents 5d9bf02 + 3bf8a66 commit 01983a8

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

internal/cmd/convoy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ func runConvoyCreate(cmd *cobra.Command, args []string) error {
543543
if err := BdCmd("dep", "add", convoyID, issueID, "--type=tracks").
544544
WithAutoCommit().
545545
Dir(townBeads).
546+
StripBeadsDir().
546547
Stderr(&depStderr).
547548
Run(); err != nil {
548549
errMsg := strings.TrimSpace(depStderr.String())
@@ -651,6 +652,7 @@ func runConvoyAdd(cmd *cobra.Command, args []string) error {
651652
if err := BdCmd("dep", "add", convoyID, issueID, "--type=tracks").
652653
Dir(townBeads).
653654
WithAutoCommit().
655+
StripBeadsDir().
654656
Stderr(&depStderr).
655657
Run(); err != nil {
656658
errMsg := strings.TrimSpace(depStderr.String())

internal/cmd/convoy_stage.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ func createStagedConvoy(dag *ConvoyDAG, waves []Wave, status string, title strin
711711
// Track each slingable bead via bd dep add.
712712
for _, beadID := range slingableIDs {
713713
if out, err := BdCmd("dep", "add", convoyID, beadID, "--type=tracks").
714-
Dir(townBeads).WithAutoCommit().
714+
Dir(townBeads).WithAutoCommit().StripBeadsDir().
715715
CombinedOutput(); err != nil {
716716
return "", fmt.Errorf("bd dep add %s %s: %w\noutput: %s", convoyID, beadID, err, out)
717717
}
@@ -749,7 +749,7 @@ func updateStagedConvoy(existingConvoyID string, dag *ConvoyDAG, waves []Wave, s
749749
for _, id := range desiredIDs {
750750
if !currentIDs[id] {
751751
if out, err := BdCmd("dep", "add", existingConvoyID, id, "--type=tracks").
752-
Dir(townBeads).WithAutoCommit().
752+
Dir(townBeads).WithAutoCommit().StripBeadsDir().
753753
CombinedOutput(); err != nil {
754754
return fmt.Errorf("bd dep add %s %s: %w\noutput: %s", existingConvoyID, id, err, out)
755755
}
@@ -760,7 +760,7 @@ func updateStagedConvoy(existingConvoyID string, dag *ConvoyDAG, waves []Wave, s
760760
for id := range currentIDs {
761761
if !desiredSet[id] {
762762
if out, err := BdCmd("dep", "remove", existingConvoyID, id, "--type=tracks").
763-
Dir(townBeads).WithAutoCommit().
763+
Dir(townBeads).WithAutoCommit().StripBeadsDir().
764764
CombinedOutput(); err != nil {
765765
return fmt.Errorf("bd dep remove %s %s: %w\noutput: %s", existingConvoyID, id, err, out)
766766
}

internal/cmd/sling_convoy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func createBatchConvoy(beadIDs []string, rigName string, owned bool, mergeStrate
365365
var tracked []string
366366
for _, beadID := range beadIDs {
367367
depArgs := []string{"dep", "add", convoyID, beadID, "--type=tracks"}
368-
if out, err := BdCmd(depArgs...).Dir(townRoot).WithAutoCommit().CombinedOutput(); err != nil {
368+
if out, err := BdCmd(depArgs...).Dir(townRoot).WithAutoCommit().StripBeadsDir().CombinedOutput(); err != nil {
369369
// Log but continue — partial tracking is better than no tracking
370370
fmt.Printf(" Warning: could not track %s in convoy: %v\nOutput: %s\n", beadID, err, out)
371371
} else {
@@ -430,9 +430,9 @@ func createAutoConvoy(beadID, beadTitle string, owned bool, mergeStrategy string
430430
// matching what gt convoy create/add already do (convoy.go:368, convoy.go:464).
431431
// Use WithAutoCommit for the same reason as above.
432432
depArgs := []string{"dep", "add", convoyID, beadID, "--type=tracks"}
433-
if out, err := BdCmd(depArgs...).Dir(townRoot).WithAutoCommit().CombinedOutput(); err != nil {
433+
if out, err := BdCmd(depArgs...).Dir(townRoot).WithAutoCommit().StripBeadsDir().CombinedOutput(); err != nil {
434434
// Tracking failed — delete the orphan convoy to prevent accumulation
435-
_ = BdCmd("close", convoyID, "-r", "tracking dep failed").Dir(townRoot).Run()
435+
_ = BdCmd("close", convoyID, "-r", "tracking dep failed").Dir(townRoot).StripBeadsDir().Run()
436436
return "", fmt.Errorf("adding tracking relation for %s: %w\noutput: %s", beadID, err, out)
437437
}
438438

0 commit comments

Comments
 (0)