Rebase onto C1d: the assigner reads no source stamp of a catalog entry
The seat mesh-catalog's module value and entry inputs lose src and fp-src (C1d), so a trunk entry's release is the version-released whose parts are what its build.ended made, the one way left of the two the assigner had. Builds: design 47 H §764; lead answer H-A-48 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -56,10 +56,10 @@ func TestAVersionReleasedHeardNamesItsVersionAndPartsBySource(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Design 47 G §379, A-96, A-419: the trunk's entry takes its version and parts from the version-released of the source its
|
||||
// fingerprint was built at (its fp-src), whatever source the kept assignment graph revision is at; a kept build from its end; no
|
||||
// revision kept, another fingerprint, an fp-src with no release or none names none, and an unheard release is said once.
|
||||
func TestATrunkEntryTakesItsVersionFromTheReleaseOfItsFingerprintsSource(t *testing.T) {
|
||||
// Design 47 G §379, A-96, A-421; H §764, H-A-48: the trunk's entry, which the catalog stamps with no source, takes its version and
|
||||
// parts from the version-released whose parts are what its build.ended made; a kept build from its end; no revision kept, another
|
||||
// fingerprint and a build whose parts no release names name none, and an unheard release is said once.
|
||||
func TestATrunkEntryTakesItsVersionFromTheReleaseOfItsBuildsParts(t *testing.T) {
|
||||
w := newWorld()
|
||||
raw, _ := json.Marshal(meshcatalog.VersionReleasedEvent{Module: "mail", Source: 7, Version: "1.2.3", Artifacts: []meshcatalog.VersionArtifact{{Artifact: "mail:image", Digest: "sha256:9"}}})
|
||||
if err := w.released.put(raw); err != nil {
|
||||
@@ -71,10 +71,11 @@ func TestATrunkEntryTakesItsVersionFromTheReleaseOfItsFingerprintsSource(t *test
|
||||
}
|
||||
var logs []string
|
||||
p := &passer{w: w, graph: &graphKeeper{ok: true, source: 7}, logf: func(f string, a ...any) { logs = append(logs, fmt.Sprintf(f, a...)) }}
|
||||
named := p.namedBuild("mail", "t", 7)
|
||||
if k, ok := named("t"); !ok || k.Version != "1.2.3" || k.Parts["mail:image"] != "sha256:9" || k.KeptOn != "" {
|
||||
t.Errorf("trunk entry = %+v, %v", k, ok)
|
||||
named := p.namedBuild("mail", "t")
|
||||
if _, ok := named("t"); ok {
|
||||
t.Error("a trunk entry whose build.ended is not heard names a version")
|
||||
}
|
||||
_, _ = named("t")
|
||||
if k, ok := named("k"); !ok || k.KeptOn != "g14" || k.Version != "" {
|
||||
t.Errorf("kept build = %+v, %v", k, ok)
|
||||
}
|
||||
@@ -89,40 +90,23 @@ func TestATrunkEntryTakesItsVersionFromTheReleaseOfItsFingerprintsSource(t *test
|
||||
if k, ok := named("old"); !ok || k.Version != "1.2.3" {
|
||||
t.Errorf("a held build whose parts were released = %+v, %v; want 1.2.3", k, ok)
|
||||
}
|
||||
p.graph.source = 8 // a later merge that did not rebuild mail
|
||||
if k, ok := named("t"); !ok || k.Version != "1.2.3" {
|
||||
t.Errorf("after a later merge the trunk entry = %+v, %v; want the release of its fingerprint's source", k, ok)
|
||||
// The entry's module value carries no source stamp: the catalog writes none (H-A-48).
|
||||
if v, _, _ := fromEntry(meshcatalog.CatalogEntry{Module: "mail", Fp: "t", Inputs: &meshcatalog.EntryInputs{}}); v.Fp2 != "t" {
|
||||
t.Errorf("the entry's module value is %+v", v)
|
||||
}
|
||||
if _, ok := p.namedBuild("mail", "t", 8)("t"); ok {
|
||||
t.Error("an fp-src with no release names a version")
|
||||
}
|
||||
_, _ = p.namedBuild("mail", "t", 8)("t")
|
||||
if _, ok := p.namedBuild("mail", "t", 0)("t"); ok {
|
||||
t.Error("an entry naming no fp-src, whose build.ended is not heard, names a version")
|
||||
}
|
||||
// The release names each artifact by its whole reference, as the catalog says it, and the parts are keyed so (A-96); the
|
||||
// assigner reads the entry's fp-src from its inputs (A-419).
|
||||
if v, _, _ := fromEntry(meshcatalog.CatalogEntry{Module: "mail", Fp: "t", Inputs: &meshcatalog.EntryInputs{Src: 9, FpSrc: 7}}); v.FpSrc != 7 || v.Src != 9 {
|
||||
t.Errorf("the entry's module value carries fp-src %d and src %d, want 7 and 9", v.FpSrc, v.Src)
|
||||
}
|
||||
// A-421: an entry naming no fp-src takes the release whose parts are what its build.ended made.
|
||||
made, _ := json.Marshal(builds.BuildEnded{Module: "mail", Fingerprint: "t", Made: map[string]string{"image": "sha256:9"}})
|
||||
if err := w.ends.put(made); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if k, ok := p.namedBuild("mail", "t", 0)("t"); !ok || k.Version != "1.2.3" {
|
||||
t.Errorf("an entry naming no fp-src, its build made the released digests: %+v, %v", k, ok)
|
||||
p.graph.source = 8 // a later merge that did not rebuild mail
|
||||
if k, ok := named("t"); !ok || k.Version != "1.2.3" || k.Parts["mail:image"] != "sha256:9" {
|
||||
t.Errorf("the trunk entry whose build made the released digests: %+v, %v", k, ok)
|
||||
}
|
||||
// A release from an earlier source than the entry's fp-src (novox 2026-11-16, 962 against 963) is still this build's when
|
||||
// its parts are exactly what the build made.
|
||||
if k, ok := p.namedBuild("mail", "t", 8)("t"); !ok || k.Version != "1.2.3" || k.Parts["mail:image"] != "sha256:9" {
|
||||
t.Errorf("an fp-src with no release, its build made the released digests: %+v, %v", k, ok)
|
||||
}
|
||||
if len(logs) != 2 || !strings.Contains(logs[0], "the release of mail at fingerprint t is not heard: no version-released of it from source 8") || !strings.Contains(logs[1], "names no fp-src, and no version-released of it names the parts its build.ended made") {
|
||||
t.Errorf("logs = %q, want each unheard release said once, naming the module, the fingerprint and the source", logs)
|
||||
if len(logs) != 1 || !strings.Contains(logs[0], "the release of mail at fingerprint t is not heard: no version-released of it names the parts its build.ended made") {
|
||||
t.Errorf("logs = %q, want the unheard release said once, naming the module and the fingerprint", logs)
|
||||
}
|
||||
p.graph.ok = false
|
||||
if _, ok := p.namedBuild("mail", "t", 7)("t"); ok {
|
||||
if _, ok := p.namedBuild("mail", "t")("t"); ok {
|
||||
t.Error("no revision kept names a release")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func (p *passer) addedOf(node string, laid *mma.Assignments, current map[string]
|
||||
p.skippedAdd(node, module, "", "the branch "+branch+" names no fingerprint of it")
|
||||
continue
|
||||
}
|
||||
k, ok := p.namedBuild(module, fp, entry.FpSrc)(fp)
|
||||
k, ok := p.namedBuild(module, fp)(fp)
|
||||
if !ok {
|
||||
p.skippedAdd(node, module, fp, "no version-released of it is heard for that fingerprint, so the candidate carries no version and no parts")
|
||||
continue
|
||||
|
||||
@@ -17,19 +17,23 @@ import (
|
||||
func TestACandidateThatAddsAModuleCarriesItsParts(t *testing.T) {
|
||||
w := newWorld()
|
||||
for _, m := range []string{"mail", "web", "db"} {
|
||||
w.putModule("main", m, meshcatalog.ModulesByModuleValue{Fp2: "fp-" + m, FpSrc: 7}, graph.Node{}, nil)
|
||||
w.putModule("main", m, meshcatalog.ModulesByModuleValue{Fp2: "fp-" + m}, graph.Node{}, nil)
|
||||
}
|
||||
w.first = "main"
|
||||
rel, _ := json.Marshal(meshcatalog.VersionReleasedEvent{Module: "mail", Source: 7, Version: "1.2.3", Artifacts: []meshcatalog.VersionArtifact{{Artifact: "mail:image", Digest: "sha256:9"}}})
|
||||
if err := w.released.put(rel); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
built, _ := json.Marshal(builds.BuildEnded{Module: "mail", Fingerprint: "fp-mail", Made: map[string]string{"image": "sha256:9"}})
|
||||
if err := w.ends.put(built); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
end, _ := json.Marshal(builds.BuildEnded{Module: "db", Fingerprint: "fp-db", Made: map[string]string{"program": "sha256:3"}, KeptOn: "g14"})
|
||||
if err := w.ends.put(end); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
w.put(buckets.Wants(), "want.ace.web", []byte(`{}`))
|
||||
p := &passer{w: w, graph: &graphKeeper{ok: true, source: 9}} // a later merge: the release is matched by fp-src (A-419)
|
||||
p := &passer{w: w, graph: &graphKeeper{ok: true, source: 9}} // a later merge: the release is matched by the parts its build made (A-421, H-A-48)
|
||||
laid := &mma.Assignments{Node: "ace", Modules: []mma.PlacedModule{{Module: "mail"}, {Module: "web"}, {Module: "db"}, {Module: "old"}}}
|
||||
current := map[string]mma.Assignments{"ace": {Node: "ace", Modules: []mma.PlacedModule{{Module: "old"}}}}
|
||||
c := p.candidateOf("p1", "ace", laid, current)
|
||||
|
||||
@@ -162,10 +162,9 @@ func (p *passer) sayWanted(node, module, fp, pipeline string, removed bool) {
|
||||
|
||||
// namedBuild answers what a want of module at fp names of its build (design 47 G §379, §526, A-96): a kept build's or another watched
|
||||
// branch's parts and keeping node from the builder's `build.ended`; for the trunk's entry (fp is the module's, trunkFP), the released
|
||||
// version and the parts of the `version-released` of the module whose source is the one its fingerprint was built at, the entry's
|
||||
// `fp-src` (A-419: a merge that does not rebuild the module leaves it so), or for an entry naming none the one whose parts are the
|
||||
// digests its build.ended made (A-421). A trunk entry whose release is not heard is said, once, naming which was tried.
|
||||
func (p *passer) namedBuild(module, trunkFP string, fpSrc int64, unreleased ...bool) func(fp string) (assign.KeptBuild, bool) {
|
||||
// version and the parts of the `version-released` whose parts are the digests its build.ended made (A-421): the catalog stamps no
|
||||
// source on an entry (design 47 H §764, H-A-48). A trunk entry whose release is not heard is said, once, naming which was tried.
|
||||
func (p *passer) namedBuild(module, trunkFP string, unreleased ...bool) func(fp string) (assign.KeptBuild, bool) {
|
||||
return func(fp string) (assign.KeptBuild, bool) {
|
||||
if k, ok := p.w.ends.partsOf(module, fp); ok {
|
||||
return k, true
|
||||
@@ -190,25 +189,11 @@ func (p *passer) namedBuild(module, trunkFP string, fpSrc int64, unreleased ...b
|
||||
p.unheardRelease(module, fp, "no assignment graph revision is kept yet, so no release is looked up")
|
||||
return assign.KeptBuild{}, false
|
||||
}
|
||||
if fpSrc == 0 {
|
||||
// No fp-src (its fingerprint moved with no merge): the release whose parts are what its build made (A-421).
|
||||
if k, ok := p.w.released.withParts(module, p.w.ends.madeOf(module, fp)); ok {
|
||||
return k, true
|
||||
}
|
||||
p.unheardRelease(module, fp, "its catalog entry names no fp-src, and no version-released of it names the parts its build.ended made")
|
||||
return assign.KeptBuild{}, false
|
||||
if k, ok := p.w.released.withParts(module, p.w.ends.madeOf(module, fp)); ok {
|
||||
return k, true
|
||||
}
|
||||
k, ok := p.w.released.of(module, fpSrc)
|
||||
if !ok {
|
||||
// The release names the source its reservation was made at, which can be an earlier revision than the entry's
|
||||
// fp-src (novox 2026-11-16: mesh-hand-acts 0.1.13 released from 962, its entry's fp-src 963): the release whose parts
|
||||
// are exactly the digests this fingerprint's build made is this build's (A-421).
|
||||
if k, ok = p.w.released.withParts(module, p.w.ends.madeOf(module, fp)); ok {
|
||||
return k, true
|
||||
}
|
||||
p.unheardRelease(module, fp, fmt.Sprintf("no version-released of it from source %d, the one its fingerprint was built at, nor one naming the parts its build.ended made, is heard", fpSrc))
|
||||
}
|
||||
return k, ok
|
||||
p.unheardRelease(module, fp, "no version-released of it names the parts its build.ended made")
|
||||
return assign.KeptBuild{}, false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,11 +148,6 @@ func (h *halves) changed(branch, module string, raw json.RawMessage, deleted boo
|
||||
func fromEntry(e meshcatalog.CatalogEntry) (meshcatalog.ModulesByModuleValue, graph.Node, *parsed) {
|
||||
v := meshcatalog.ModulesByModuleValue{Commit: e.Commit, Fp2: e.Fp, Needs: e.Needs, None2: e.None, Packages: e.Packages,
|
||||
Path: e.Path, Repository: e.Repository, Verdict: e.Verdict}
|
||||
// The source revisions it was taken in at and its fingerprint was built at: the release of a trunk build is matched by the
|
||||
// latter (design 47 G A-419).
|
||||
if e.Inputs != nil {
|
||||
v.Src, v.FpSrc = e.Inputs.Src, e.Inputs.FpSrc
|
||||
}
|
||||
n := graph.Node{FP: e.Fp, None: e.None, Repository: e.Repository, Path: e.Path, Bases: e.Bases, Provides: e.Provides, Requires: e.Requires,
|
||||
Awaits: e.Awaits, Invokes: e.Invokes, Serves: e.Serves, LeftOut: e.LeftOut}
|
||||
for p := range e.Packages {
|
||||
|
||||
@@ -676,7 +676,7 @@ func aReleasesApproveAnswersTheMoveOfItsBuildAlone(t *testing.T) {
|
||||
asksKV := &memKV{values: map[string][]byte{}}
|
||||
p := newPasser(kvSet{buckets.Asks(): asksKV}, time.Now())
|
||||
p.logf = t.Logf
|
||||
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: fpTest, Repository: "novox/web", Commit: commit, Src: 7, FpSrc: 7, Path: meshcatalogclient.RootPath})
|
||||
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: fpTest, Repository: "novox/web", Commit: commit, Path: meshcatalogclient.RootPath})
|
||||
putModuleRaw(p.w, trunkBranch, "web", mod)
|
||||
have, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: fpOld, Composed: was, Phase: nodeengineclient.PhaseWaitingYes, Health: nodeengineclient.HealthOK,
|
||||
Judgement: assign.JudgedRecreates, Waits: waiting, Detail: "it recreates web.server", BuildAlone: true})
|
||||
|
||||
@@ -39,7 +39,6 @@ type orderMod struct {
|
||||
run, trunk string
|
||||
forms map[string]int
|
||||
holds []string
|
||||
src int64
|
||||
}
|
||||
|
||||
type orderFixture struct {
|
||||
@@ -87,7 +86,7 @@ func newOrderFixture(t *testing.T, mods []orderMod, history ...map[string]string
|
||||
forms[fp] = form
|
||||
}
|
||||
mdigest := fmt.Sprintf("%064x", len(modules))
|
||||
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: m.trunk, Manifest: mdigest, Repository: "novox/" + m.name, Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath, Src: m.src})
|
||||
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: m.trunk, Manifest: mdigest, Repository: "novox/" + m.name, Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath})
|
||||
putModuleRaw(p.w, trunkBranch, m.name, mod)
|
||||
p.w.manifests[mdigest] = parsed{module: m.name, manifest: catalogue.Manifest{Module: m.name}}
|
||||
endDone(t, p.w, m.name, m.trunk, mdigest)
|
||||
|
||||
Reference in New Issue
Block a user