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:
Steve Yegge
2025-12-30 00:38:32 -08:00
parent b273465966
commit ebd5c1b72a
3 changed files with 6 additions and 6 deletions

View File

@@ -317,8 +317,8 @@ func bondProtoProto(ctx context.Context, s storage.Storage, protoA, protoB *type
Priority: minPriority(protoA.Priority, protoB.Priority),
IssueType: types.TypeEpic,
BondedFrom: []types.BondRef{
{ProtoID: protoA.ID, BondType: bondType, BondPoint: ""},
{ProtoID: protoB.ID, BondType: bondType, BondPoint: ""},
{SourceID: protoA.ID, BondType: bondType, BondPoint: ""},
{SourceID: protoB.ID, BondType: bondType, BondPoint: ""},
},
}
if err := tx.CreateIssue(ctx, compound, actorName); err != nil {

View File

@@ -128,7 +128,7 @@ func (i *Issue) ComputeContentHash() string {
// Bonded molecules
for _, br := range i.BondedFrom {
w.str(br.ProtoID)
w.str(br.SourceID)
w.str(br.BondType)
w.str(br.BondPoint)
}
@@ -795,7 +795,7 @@ type EpicStatus struct {
// When protos or molecules are bonded together, BondRefs record
// which sources were combined and how they were attached.
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
BondPoint string `json:"bond_point,omitempty"` // Attachment site (issue ID or empty for root)
}

View File

@@ -464,12 +464,12 @@ func TestIssueCompoundHelpers(t *testing.T) {
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() {
t.Fatalf("issue with bonded refs should be compound")
}
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)
}
}