fix: rename BondRef.ProtoID to SourceID for clarity (bd-ia3g)
The ProtoID field in BondRef was misleading as it could hold both proto IDs (from proto+proto bonds) and molecule IDs (from mol+mol bonds). Rename to SourceID with updated JSON tag to better reflect its purpose. Changes: - Rename BondRef.ProtoID to SourceID in types.go - Update JSON tag from proto_id to source_id - Update all usages in mol_bond.go and tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -317,8 +317,8 @@ func bondProtoProto(ctx context.Context, s storage.Storage, protoA, protoB *type
|
|||||||
Priority: minPriority(protoA.Priority, protoB.Priority),
|
Priority: minPriority(protoA.Priority, protoB.Priority),
|
||||||
IssueType: types.TypeEpic,
|
IssueType: types.TypeEpic,
|
||||||
BondedFrom: []types.BondRef{
|
BondedFrom: []types.BondRef{
|
||||||
{ProtoID: protoA.ID, BondType: bondType, BondPoint: ""},
|
{SourceID: protoA.ID, BondType: bondType, BondPoint: ""},
|
||||||
{ProtoID: protoB.ID, BondType: bondType, BondPoint: ""},
|
{SourceID: protoB.ID, BondType: bondType, BondPoint: ""},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if err := tx.CreateIssue(ctx, compound, actorName); err != nil {
|
if err := tx.CreateIssue(ctx, compound, actorName); err != nil {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ func (i *Issue) ComputeContentHash() string {
|
|||||||
|
|
||||||
// Bonded molecules
|
// Bonded molecules
|
||||||
for _, br := range i.BondedFrom {
|
for _, br := range i.BondedFrom {
|
||||||
w.str(br.ProtoID)
|
w.str(br.SourceID)
|
||||||
w.str(br.BondType)
|
w.str(br.BondType)
|
||||||
w.str(br.BondPoint)
|
w.str(br.BondPoint)
|
||||||
}
|
}
|
||||||
@@ -795,7 +795,7 @@ type EpicStatus struct {
|
|||||||
// When protos or molecules are bonded together, BondRefs record
|
// When protos or molecules are bonded together, BondRefs record
|
||||||
// which sources were combined and how they were attached.
|
// which sources were combined and how they were attached.
|
||||||
type BondRef struct {
|
type BondRef struct {
|
||||||
ProtoID string `json:"proto_id"` // Source proto/molecule ID
|
SourceID string `json:"source_id"` // Source proto or molecule ID
|
||||||
BondType string `json:"bond_type"` // sequential, parallel, conditional
|
BondType string `json:"bond_type"` // sequential, parallel, conditional
|
||||||
BondPoint string `json:"bond_point,omitempty"` // Attachment site (issue ID or empty for root)
|
BondPoint string `json:"bond_point,omitempty"` // Attachment site (issue ID or empty for root)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -464,12 +464,12 @@ func TestIssueCompoundHelpers(t *testing.T) {
|
|||||||
t.Fatalf("expected nil constituents for non-compound issue")
|
t.Fatalf("expected nil constituents for non-compound issue")
|
||||||
}
|
}
|
||||||
|
|
||||||
bonded := &Issue{BondedFrom: []BondRef{{ProtoID: "proto-1", BondType: BondTypeSequential}}}
|
bonded := &Issue{BondedFrom: []BondRef{{SourceID: "proto-1", BondType: BondTypeSequential}}}
|
||||||
if !bonded.IsCompound() {
|
if !bonded.IsCompound() {
|
||||||
t.Fatalf("issue with bonded refs should be compound")
|
t.Fatalf("issue with bonded refs should be compound")
|
||||||
}
|
}
|
||||||
refs := bonded.GetConstituents()
|
refs := bonded.GetConstituents()
|
||||||
if len(refs) != 1 || refs[0].ProtoID != "proto-1" {
|
if len(refs) != 1 || refs[0].SourceID != "proto-1" {
|
||||||
t.Fatalf("unexpected constituents: %#v", refs)
|
t.Fatalf("unexpected constituents: %#v", refs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user