Files
mesh-host/internal/compose/resolution/unknown_field.go
T
jschoubben d68e241724 Take the catalogue's composition rules into the node-engine
ADR 0593 §7: the composer with its refusals leaves mesh-sdk, so mesh-sdk
carries no composition rule. The catalogue functions only the
node-engine's composition reaches (Resolve, Resolution's Compose,
Declaration, DataItems, LeftOut, Rules and the rest, the settings,
placeholder and template refusals, the rendering helpers) are copied
with their tests into internal/compose/resolution; a method of a
mesh-sdk shape becomes a function taking it first. The composition
calls its own copies, and the captured catalogue its tests read lives
here now, shared by mesh-compose's tests.

Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
2026-11-02 19:15:55 +01:00

37 lines
1.7 KiB
Go

package resolution
import (
"fmt"
mcat "git.novox.be/novox/mesh-sdk/go/catalogue"
)
// UnknownFieldReason is why a module whose stored manifest has a key this reader does not know is left out of a
// machine's declaration, or "" when it is not. **A field set aside no longer leaves the module out** (novox/hq ADR 0578
// §6, which changes ADR 0262 here): the lenient decoder reads the rest, the reader names the field (SetAside), and the
// part that needs the field takes the newer package. Only a manifest not read past the field, which holds its name and
// version alone (ReadNoFurther), is still left out, since nothing of it could be composed.
func UnknownFieldReason(m mcat.Manifest) string {
if !m.ReadNoFurther() {
return ""
}
return m.Module + " uses a field this controller does not know (" + m.UnknownField() + "); it is left out " +
"until the controller is updated: nothing of it is changed on its machines and its contributions to " +
"other modules and its open ports stop. Its data is still backed up as this controller reads it, " +
"which may not be what its newer manifest asks, and it still provides what it provides " +
"(novox/hq ADR 0262)"
}
// backupView is what of a left-out module still reaches its machine: its data, so the backup holder
// keeps copying it, and the directories and accesses its data items name. No contribution, shell code
// or environment of its own: those are what leaving it out stops.
func backupView(m mcat.Manifest) mcat.Manifest {
view := mcat.Manifest{Module: m.Module, Data: m.Data, Accesses: m.Accesses, BestEffort: true}
for _, r := range m.Resources {
if fmt.Sprint(r["type"]) == "directory" {
view.Resources = append(view.Resources, r)
}
}
return view
}