J3 (lead's b): two leaves of one module are both kept, the empty accepted event named by its revision
Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -235,10 +236,10 @@ func AcceptedOf(digest string, v ManifestVerdict, m catalogue.Manifest) Manifest
|
||||
|
||||
// EventID is the event's id, one per manifest digest and judge, so the bus takes it once:
|
||||
// `manifest-accepted-<digest>-<judge>`. The empty one of a module leaving the trunk carries no digest, so it is named by
|
||||
// its module: `manifest-accepted-left-<module>-<judge>`.
|
||||
// its module and the indexer's revision: `manifest-accepted-left-<module>-<revision>`, so two leaves are both kept.
|
||||
func (a ManifestAccepted) EventID() string {
|
||||
if a.Digest == "" {
|
||||
return ManifestAcceptedEvent + "-left-" + a.Module + "-" + a.Judge
|
||||
return ManifestAcceptedEvent + "-left-" + a.Module + "-" + strconv.FormatUint(a.Revision, 10)
|
||||
}
|
||||
return ManifestAcceptedEvent + "-" + a.Digest + "-" + a.Judge
|
||||
}
|
||||
|
||||
@@ -103,10 +103,11 @@ func TestAManifestVerdictIsTheContractReadersTake(t *testing.T) {
|
||||
if id := heard.EventID(); id != "manifest-accepted-"+digest+"-src2:j" {
|
||||
t.Fatalf("the accepted event's id is %q", id)
|
||||
}
|
||||
// The empty one of a module leaving the trunk has no digest: its id names the module, so two modules' differ.
|
||||
if a, b := (ManifestAccepted{Module: "a", Judge: "j"}).EventID(), (ManifestAccepted{Module: "b", Judge: "j"}).EventID(); a == b ||
|
||||
a != "manifest-accepted-left-a-j" {
|
||||
t.Fatalf("the ids of two modules leaving are %q and %q", a, b)
|
||||
// The empty one of a module leaving the trunk has no digest: its id names the module and the revision, so two
|
||||
// modules' differ, and so do two leaves of one module.
|
||||
if a, b, again := (ManifestAccepted{Module: "a", Judge: "j", Revision: 7}).EventID(), (ManifestAccepted{Module: "b", Judge: "j", Revision: 7}).EventID(),
|
||||
(ManifestAccepted{Module: "a", Judge: "j", Revision: 9}).EventID(); a == b || a == again || a != "manifest-accepted-left-a-7" {
|
||||
t.Fatalf("the ids of modules leaving are %q, %q and %q", a, b, again)
|
||||
}
|
||||
// Both verdict events carry the indexer's revision (ADR 0622 §2), and one without it reads as revision 0.
|
||||
for _, ev := range []any{ManifestAccepted{Module: "m", Revision: 41}, ManifestRefused{Module: "m", Revision: 41}} {
|
||||
|
||||
Reference in New Issue
Block a user