H-A-458 (1): compare a want's run with the have's only within its branch

A pipeline's key is <branch>.<source>, so every pipeline of a branch has its
own key, and comparing the whole key found no applied run for a stale want of
an older pipeline of the same branch (main.175 after main.180): it was
applied. settleOne now compares the branches, each key without its last
part; a want of another branch still replaces whatever stands. Rows with real
keys: feat.10 applied, feat.9 refused and said, main.5 applied, the have
naming run 5 of main.5.

Review round 2, finding: the whole pipeline key compared instead of its branch.

Builds: design 47 H2 §813 (1); H-A-429 (1), H-A-458 (1)
This commit is contained in:
2026-11-22 03:13:15 +01:00
parent a9d41d44ec
commit 876bf45223
3 changed files with 22 additions and 11 deletions
+14 -4
View File
@@ -84,7 +84,7 @@ type Have struct {
Run string
// Pipeline is the pipeline of the want the module was applied from, its key <branch>.<source>, kept beside Run
// (H-A-429 (1), H-A-458 (1); nodeengine.HaveByNodeModuleValue.Pipeline): a want's run is compared with Run only when
// the want names the same pipeline. Kept and replaced together with Run.
// the want's pipeline is of the same branch (pipelineBranch). Kept and replaced together with Run.
Pipeline string
}
@@ -1536,8 +1536,9 @@ func (a *Agent) settleOne(ctx context.Context, module string) {
}
// Design 47 H2 §813 (1), H-A-384 (2): the run the module was applied from is its have's, never this engine's memory, so
// a restarted engine applies no older run again. Read only for a want that carries one, and compared only within the
// want's pipeline: a want of another pipeline is a placement the assigner made on purpose and replaces whatever stands
// (H-A-429 (1), H-A-458 (1)).
// want's branch: a want of another branch is a placement the assigner made on purpose and replaces whatever stands
// (H-A-429 (1), H-A-458 (1)). A pipeline's key is <branch>.<source>, so every pipeline of a branch has its own key and
// the branch is the key without its last part.
appliedRun := ""
if w.Want.Run != "" {
h, found, unread := a.readHave(ctx, module)
@@ -1548,7 +1549,7 @@ func (a *Agent) settleOne(ctx context.Context, module string) {
a.mu.Unlock()
return
}
if found && h.Pipeline == w.Want.Pipeline {
if found && pipelineBranch(h.Pipeline) == pipelineBranch(w.Want.Pipeline) {
appliedRun = h.Run
}
}
@@ -1903,6 +1904,15 @@ func (a *Agent) takenAtStart(module string, runs compositions.Composed) {
// pipeline (settleOne compares no runs of two, H-A-458 (1)): each is
// the composition run's pipeline sequence in decimal. A want or an apply without one is not ordered by run, nor is a run
// that is no decimal number.
// pipelineBranch is the branch of a pipeline's key <branch>.<source> (design 47 H1, the runner's key; H-A-458 (1)): the
// key without its last part. A key with no source part is its own branch.
func pipelineBranch(key string) string {
if i := strings.LastIndexByte(key, '.'); i >= 0 {
return key[:i]
}
return key
}
func runIsNewer(want, applied string) bool {
if want == "" || applied == "" {
return true