H-A-48: no source stamp on a module; the take-in's commit names it
srcOf and the Src and FpSrc stamps go with the source per merged message: a module's value and its catalog entry carry where it was taken in by its commit alone. Builds: design 47 H §764 (the indexer); H-A-48 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -45,7 +45,7 @@ func CatalogEntryOf(module string, cur meshcatalog.ModulesByModuleValue, m catal
|
||||
e.Fp, e.None = cur.Fp2, cur.None2
|
||||
}
|
||||
in := meshcatalog.EntryInputs{Toolchains: maps.Clone(cur.Toolchains), Paths: maps.Clone(cur.Paths), Problems: cur.Problems,
|
||||
Warnings: cur.Warnings, Unknown: cur.Unknown, Src: cur.Src, FpSrc: cur.FpSrc}
|
||||
Warnings: cur.Warnings, Unknown: cur.Unknown}
|
||||
if cur.Inputs2 != nil {
|
||||
from := meshcatalog.FingerprintInputs(*cur.Inputs2)
|
||||
in.From = &from
|
||||
@@ -71,7 +71,6 @@ func ModuleValueOf(e meshcatalog.CatalogEntry) meshcatalog.ModulesByModuleValue
|
||||
Verdict: e.Verdict, Fp2: e.Fp, None2: e.None, Packages: maps.Clone(e.Packages)}
|
||||
if in := e.Inputs; in != nil {
|
||||
v.Toolchains, v.Paths, v.Problems, v.Warnings, v.Unknown = maps.Clone(in.Toolchains), maps.Clone(in.Paths), in.Problems, in.Warnings, in.Unknown
|
||||
v.Src, v.FpSrc = in.Src, in.FpSrc
|
||||
if in.From != nil {
|
||||
from := meshcatalog.ModulesByModuleValueInputs2(*in.From)
|
||||
v.Inputs2 = &from
|
||||
|
||||
@@ -19,8 +19,8 @@ import (
|
||||
|
||||
// applyMerged writes, for each module whose manifest the merged message carries (each directory of the merge commit that
|
||||
// holds a module.json, the module its manifest names), its value at the merge commit: its directory, its manifest digest,
|
||||
// its new-form inputs and why it has no new-form fingerprint yet, with the source revision that names the merge commit as
|
||||
// the repository's head when the indexer has seen it (ApplySource), and Src 0 when it has not. The fingerprint itself is
|
||||
// its new-form inputs and why it has no new-form fingerprint yet; no source revision is stamped on it (design 47 H §764,
|
||||
// H-A-48: the take-in's commit names where it was taken in). The fingerprint itself is
|
||||
// computed by Recompute (toolchains.go) once the merge is written, and again when a build module reports its toolchain.
|
||||
//
|
||||
// The modules are listed from the message, never from the controller's build records (novox/hq ADR 0501 clause 6, issue
|
||||
@@ -98,7 +98,7 @@ func (ix *Indexer) applyMoving(ctx context.Context, f whole, drop bool, moves ma
|
||||
ix.logf("%s at %s: %q and %q both name the module %s; %q, which the indexer holds, is written", f.Repository, f.Merge, other, dir, name, dir)
|
||||
}
|
||||
dirOf[name] = dir
|
||||
next := meshcatalog.ModulesByModuleValue{Repository: f.Repository, Commit: f.Merge, Src: int64(ix.srcOf(f.Repository, f.Merge)), Manifest: digests[dir], Path: pathOf(dir)}
|
||||
next := meshcatalog.ModulesByModuleValue{Repository: f.Repository, Commit: f.Merge, Manifest: digests[dir], Path: pathOf(dir)}
|
||||
// The reader capabilities a changed manifest needs are written with it, before the judge's pass names them with its
|
||||
// verdict, so no reader takes a new manifest as needing nothing (ADR 0614 §4).
|
||||
next.Needs, _ = catalogue.ManifestNeeds([]byte(raw))
|
||||
|
||||
@@ -532,6 +532,9 @@ func TestAModuleMovesBetweenRepositoriesOnlyWhenItsTrunkDropsIt(t *testing.T) {
|
||||
if ok && m.Path != "modules/a" {
|
||||
t.Errorf("modules.a at %q, want modules/a", m.Path)
|
||||
}
|
||||
if ok && (m.Src != 0 || m.FpSrc != 0) { // design 47 H §764 (H-A-48): no source stamp, the take-in's commit names it
|
||||
t.Errorf("modules.a stamped src %d, fp-src %d, want none", m.Src, m.FpSrc)
|
||||
}
|
||||
if ok && m.Repository == to && tc.heads && m.Commit != toHead {
|
||||
t.Errorf("modules.a at %s, want the other trunk's head %s", m.Commit, toHead)
|
||||
}
|
||||
|
||||
@@ -24,17 +24,6 @@ type sourceNow struct {
|
||||
heads map[string]string
|
||||
}
|
||||
|
||||
// srcOf is the source revision that names this merge commit as the repository's head, or 0 when the latest source seen
|
||||
// names another head or none has been seen.
|
||||
func (ix *Indexer) srcOf(repository, merge string) uint64 {
|
||||
ix.mu.Lock()
|
||||
defer ix.mu.Unlock()
|
||||
if ix.source.rev != 0 && merge != "" && ix.source.heads[repository] == merge {
|
||||
return ix.source.rev
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// sourceHeads is the head the latest source seen names for each repository (a copy), nil while none has been seen.
|
||||
func (ix *Indexer) sourceHeads() map[string]string {
|
||||
ix.mu.Lock()
|
||||
|
||||
@@ -346,13 +346,6 @@ func (ix *Indexer) recomputeLocked(ctx context.Context, overlay map[string]meshc
|
||||
if cur.Fp2 == r.fp && cur.None2 == r.none && sameUsed(cur, r.tcs, r.pkgs) {
|
||||
return nil, false, nil
|
||||
}
|
||||
if cur.Fp2 != r.fp {
|
||||
// Moved with no merge (a toolchain, a package, a base): no release carries this build, and the source revision
|
||||
// moves only at a merge, so it is not known (0) and the move is asked of a person; never the revision of now,
|
||||
// which may be the very release that last merged the module (ADR 0601 §1). The source stamp leaves it, since
|
||||
// Src is set.
|
||||
cur.FpSrc = 0
|
||||
}
|
||||
cur.Fp2, cur.None2, cur.Toolchains, cur.Packages = r.fp, r.none, r.tcs, r.pkgs
|
||||
cur.Inputs2, cur.Paths = inputs, paths
|
||||
data, err := meshcatalogclient.EncodeModule(cur)
|
||||
@@ -403,13 +396,6 @@ func (ix *Indexer) writeOverlay(ctx context.Context, overlay, finals map[string]
|
||||
next.Verdict, next.Problems, next.Unknown, next.Warnings = cur.Verdict, cur.Problems, cur.Unknown, cur.Warnings
|
||||
next.Needs = cur.Needs
|
||||
}
|
||||
// The source revision at which FP2 last changed (ADR 0601 §1): this merge's when it moved it (0 until the
|
||||
// source revision naming the merge is heard, which stamps it), else the one held.
|
||||
if held && cur.Fp2 == next.Fp2 {
|
||||
next.FpSrc = cur.FpSrc
|
||||
} else {
|
||||
next.FpSrc = next.Src
|
||||
}
|
||||
if held && sameButWhere(cur, next) {
|
||||
return nil, false, nil
|
||||
}
|
||||
@@ -430,11 +416,11 @@ func (ix *Indexer) writeOverlay(ctx context.Context, overlay, finals map[string]
|
||||
return nil
|
||||
}
|
||||
|
||||
// sameButWhere says the held value cur is next but for where it was computed (Commit and Src) and the judge's verdict,
|
||||
// sameButWhere says the held value cur is next but for where it was computed (Commit) and the judge's verdict,
|
||||
// which only the judge writes: the module is unchanged.
|
||||
func sameButWhere(cur, next meshcatalog.ModulesByModuleValue) bool {
|
||||
next = withV(next)
|
||||
next.Commit, next.Src, next.FpSrc = cur.Commit, cur.Src, cur.FpSrc
|
||||
next.Commit = cur.Commit
|
||||
next.Verdict, next.Problems, next.Unknown, next.Warnings = cur.Verdict, cur.Problems, cur.Unknown, cur.Warnings
|
||||
next.Needs = cur.Needs
|
||||
return reflect.DeepEqual(cur, next)
|
||||
|
||||
Reference in New Issue
Block a user