Name every kind of an untaken module's resources in the adoption envelope, not only files and containers (hq ADR 0103)

This commit is contained in:
2026-09-22 18:03:03 +02:00
parent c91fe1a6eb
commit 41c300eae0
2 changed files with 12 additions and 10 deletions
+8 -8
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"sort"
"strings"
"github.com/novox/mesh-controller/internal/catalogue"
"github.com/novox/mesh-controller/internal/inventory"
@@ -23,8 +24,8 @@ type sendable struct {
}
// adoptionEnvelope is what an adopted node is told about its mode. Taken is every module taken on
// it that it runs; Untaken is, for every module it runs that is not taken, the ids of that module's
// files and containers — the resources the host keeps as found until the module is taken. Ids
// it that it runs; Untaken is, for every module it runs that is not taken, the ids of every one of
// that module's resources — what the host keeps as found until the module is taken (ADR 0103). Ids
// rather than a rule to split them by, because a module's name may contain a dot.
type adoptionEnvelope struct {
Taken []string `json:"taken"`
@@ -75,12 +76,11 @@ func adoptionFor(plan catalogue.Resolution, taken []string,
for _, r := range composed.Resources {
id, _ := r["id"].(string)
module, owned := composed.Owner[id]
if !owned || !runs[module] || isTaken[module] {
continue
}
switch r["type"] {
case "file", "container":
default:
// Every kind, not only files and containers (novox/hq ADR 0103): a directory, a service, a
// container mounting what was found and an action run in a held container all reach what
// the machine already has. What the mesh declares of its own is never held.
if !owned || !runs[module] || isTaken[module] ||
strings.HasPrefix(id, catalogue.AdoptionPrefix) {
continue
}
if out.Untaken == nil {