Area 5 (join 11): the gate's take-in writes its entries into the record and each group member names its base
Builds: design 47 G A-188, A-236 (answers G-22) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -129,6 +129,8 @@ type RecordPull struct {
|
||||
State string `json:"state"`
|
||||
Commit string `json:"commit,omitempty"`
|
||||
Words string `json:"words,omitempty"`
|
||||
// Base is the watched branch the pull request merged into (A-236), the branch of the take-in that took it in.
|
||||
Base string `json:"base,omitempty"`
|
||||
}
|
||||
|
||||
// RecordTrace is the trace: the milestone's issues and pull requests, their commits, and the graph revisions.
|
||||
|
||||
@@ -45,6 +45,12 @@ func (h *Holder) TakenIn(body json.RawMessage) error {
|
||||
g := RecordGroup{Group: t.Group}
|
||||
seen := map[string]bool{}
|
||||
for _, e := range t.Entries {
|
||||
// A-188: the take-in's entries, each with its module, are written into the record.
|
||||
if e.Module != "" {
|
||||
if err := h.Records.AddEntry(r, RecordEntry{Module: e.Module, Fingerprint: e.Fingerprint}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if e.Repository == "" || seen[mdc.ApprovedKey(e.Repository, int(e.Pull))] {
|
||||
continue
|
||||
}
|
||||
@@ -54,7 +60,7 @@ func (h *Holder) TakenIn(body json.RawMessage) error {
|
||||
sort.Strings(g.Members)
|
||||
for _, m := range t.Merges {
|
||||
g.Pulls = append(g.Pulls, RecordPull{Repository: m.Repository, Number: int(m.Number), Head: heads[mdc.ApprovedKey(m.Repository, int(m.Number))],
|
||||
State: string(mdc.MergeMerged), Commit: m.Merge})
|
||||
State: string(mdc.MergeMerged), Commit: m.Merge, Base: t.Branch})
|
||||
}
|
||||
if err := h.Records.SetGroup(r, g); err != nil {
|
||||
return err
|
||||
|
||||
@@ -74,6 +74,13 @@ func TestATakeInTakenOpensOneRecordAndMovesItsBranchsSource(t *testing.T) {
|
||||
len(r.Group.Members) != 1 || r.Group.Members[0] != "novox/app@3" || r.Group.Group != "feat" {
|
||||
t.Fatalf("the record %+v group %+v", r, r.Group)
|
||||
}
|
||||
// A-188: the take-in's entries are in the record, each with its module; A-236: each member says its base.
|
||||
if e, ok := r.Entries[EntryKey("app", "f", "")]; !ok || e.Module != "app" {
|
||||
t.Fatalf("the take-in's entries are not in the record: %+v", r.Entries)
|
||||
}
|
||||
if ms := membersOf(r); len(ms) != 1 || ms[0].Base != "main" {
|
||||
t.Fatalf("a group member names the branch it merged into: %+v", ms)
|
||||
}
|
||||
if got := r.Outcomes[OutcomeKey("", "", "", "take-in")]; got.Outcome != OutcomeTakenIn {
|
||||
t.Fatalf("the take-in is not the record's outcome: %+v", r.Outcomes)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func membersOf(r *Record) []seat.Member {
|
||||
if r.Group != nil && len(r.Group.Pulls) > 0 {
|
||||
for _, p := range r.Group.Pulls {
|
||||
out = append(out, seat.Member{ID: IDOf(p.Repository, firstOf(p.Commit, p.Head)), Repository: p.Repository, State: p.State,
|
||||
Number: int64(p.Number), Head: p.Head, Open: open && p.State != "merged"})
|
||||
Number: int64(p.Number), Head: p.Head, Open: open && p.State != "merged", Base: p.Base})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user