From 1d3e2b8acafc7341460c61693438c696082801e7 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 1 Nov 2026 03:22:13 +0100 Subject: [PATCH] pacman reads the node-engine's packages, not the controller's declared-packages mirror (ADR 0565 clause 6, issue 1953) Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL --- modules/pacman/README.md | 2 +- .../pacman-tools/keeper_integration_test.go | 2 +- .../cmd/pacman-tools/keeper_manifest_test.go | 2 +- modules/pacman/cmd/pacman-tools/view.go | 26 ++++++++----------- modules/pacman/cmd/pacman-tools/view_test.go | 4 +-- modules/pacman/module.json | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/modules/pacman/README.md b/modules/pacman/README.md index fd400323..d1bae6ba 100644 --- a/modules/pacman/README.md +++ b/modules/pacman/README.md @@ -30,7 +30,7 @@ that seat (ADR 0207). `package.changed`. A list over the bus's cap on a value is not written: the key keeps its last value and `.not-current` says the size and since when, which the health says too. `pacman_packages`, `pacman_updates`, `pacman_installed` and `pacman_foreign` answer every node from these states, and what no - module declares from the controller's `declared-packages`, without asking a machine. + module declares from the node-engine's `packages`, without asking a machine. - **Upgrades as runs, one node at a time (ADR 0508).** Every full upgrade and every rollback is a run in the state `runs` at `.`, written at each step and emitted as it: the package record taken and read back (`records`, kept `record-days`), the DKMS gate before the transaction (a kernel an installed DKMS module's own diff --git a/modules/pacman/cmd/pacman-tools/keeper_integration_test.go b/modules/pacman/cmd/pacman-tools/keeper_integration_test.go index 4cb3c2f2..d994641c 100644 --- a/modules/pacman/cmd/pacman-tools/keeper_integration_test.go +++ b/modules/pacman/cmd/pacman-tools/keeper_integration_test.go @@ -102,7 +102,7 @@ func TestTheKeeperPutsTheNodesPackagesOnARealBusAndAnotherInstanceReadsThem(t *t } buckets[name] = kv } - declared, err := js.CreateKeyValue(ctx, jetstream.KeyValueConfig{Bucket: "mesh-controller_declared-packages"}) + declared, err := js.CreateKeyValue(ctx, jetstream.KeyValueConfig{Bucket: "node-engine_packages"}) if err != nil { t.Fatal(err) } diff --git a/modules/pacman/cmd/pacman-tools/keeper_manifest_test.go b/modules/pacman/cmd/pacman-tools/keeper_manifest_test.go index be4304c0..aa0383c2 100644 --- a/modules/pacman/cmd/pacman-tools/keeper_manifest_test.go +++ b/modules/pacman/cmd/pacman-tools/keeper_manifest_test.go @@ -133,7 +133,7 @@ func TestTheKeeperDeclaresTheModulesStatesAndEvents(t *testing.T) { } // The verbs read which packages each node's modules declare; the process reads no other module's state // (ADR 0507 §5, ADR 0436 §1). - if got := strs(raw["reads"]); !reflect.DeepEqual(got, []string{"mesh-controller.declared-packages"}) { + if got := strs(raw["reads"]); !reflect.DeepEqual(got, []string{"node-engine.packages"}) { t.Errorf("reads: %v", got) } } diff --git a/modules/pacman/cmd/pacman-tools/view.go b/modules/pacman/cmd/pacman-tools/view.go index 1d7918b5..1980bd6b 100644 --- a/modules/pacman/cmd/pacman-tools/view.go +++ b/modules/pacman/cmd/pacman-tools/view.go @@ -1,7 +1,7 @@ package main // The package view (novox/hq ADR 0507 §6, §7; acceptance 1840/AC6): verbs that read the module's states and the -// controller's `declared-packages`, so any instance answers for every node and no machine is asked. A node that is +// node-engine's `packages`, so any instance answers for every node and no machine is asked. A node that is // off keeps its last values, shown with the time they describe; a node whose packages are over the bus's cap is // marked not current. A foreign package is listed apart in every answer. @@ -11,21 +11,17 @@ import ( "sort" "strings" "time" + + "git.novox.be/novox/mesh-sdk/go/delivery" ) -// DeclaredPackagesState is the controller's state of the packages each node's modules declare (ADR 0507 §5), -// read through the manifest's `reads`. -const DeclaredPackagesState = "mesh-controller.declared-packages" +// DeclaredPackagesState is the node-engine's state of the packages its node's modules declare, one key per node, +// written by that node's engine alone (ADR 0565 clause 6, which moved ADR 0507 §5's mirror off the controller), read +// through the manifest's `reads`. +const DeclaredPackagesState = "node-engine." + delivery.EnginePackagesState -// declaredValue is a node's value of `declared-packages`, as the controller writes it. -type declaredValue struct { - Node string `json:"node"` - Packages []struct { - Package string `json:"package"` - Modules []string `json:"modules"` - Absent bool `json:"absent"` - } `json:"packages"` -} +// declaredValue is a node's key of `packages`, in mesh-sdk's layout (the controller's mirror unchanged). +type declaredValue = delivery.DeclaredPackages // nodeInstalled is one node's key of `installed` with its not-current mark. type nodeInstalled struct { @@ -112,7 +108,7 @@ func (m *Machine) installedOn(node string) ([]nodeInstalled, error) { } // declaredOn is what each node's modules declare present, by node and package, with the declaring modules; a -// node the controller holds nothing for is missing. +// node whose engine has written no key is missing. func (m *Machine) declaredOn(nodes []string) (map[string]map[string][]string, error) { r := m.States(DeclaredPackagesState) out := map[string]map[string][]string{} @@ -146,7 +142,7 @@ type NodeView struct { Current bool `json:"current"` NotCurrent *NotCurrent `json:"not_current,omitempty"` // Undeclared is the packages installed explicitly from a repository that no module assigned to the node - // declares; null when the controller holds no declaration of the node. + // declares; null when the node-engine has published no declaration of the node. Undeclared []PackageVersion `json:"undeclared"` Foreign []PackageVersion `json:"foreign"` } diff --git a/modules/pacman/cmd/pacman-tools/view_test.go b/modules/pacman/cmd/pacman-tools/view_test.go index 8a823c55..afcea49e 100644 --- a/modules/pacman/cmd/pacman-tools/view_test.go +++ b/modules/pacman/cmd/pacman-tools/view_test.go @@ -1,7 +1,7 @@ package main // The package view over the bus (novox/hq ADR 0507 §6, §7; acceptance 1840/AC6): two nodes' `installed` keys and -// their `declared-packages`, answered without asking any machine. +// the node-engine's `packages`, answered without asking any machine. import ( "context" @@ -13,7 +13,7 @@ import ( ) // viewStates is two nodes' packages on the bus: node-a current and declared, node-b over the cap since a while, -// with a foreign package, and no declaration the controller holds. +// with a foreign package, and no declaration the node-engine published. func viewStates(t *testing.T) (*fakeStates, *Machine) { t.Helper() states := &fakeStates{} diff --git a/modules/pacman/module.json b/modules/pacman/module.json index 97eaad3f..ae23589e 100644 --- a/modules/pacman/module.json +++ b/modules/pacman/module.json @@ -12,7 +12,7 @@ } ], "reads": [ - "mesh-controller.declared-packages" + "node-engine.packages" ], "uses": [ "operator-channel"