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
This commit is contained in:
2026-11-01 09:53:59 +01:00
parent 462bcfe451
commit 1d3e2b8aca
6 changed files with 17 additions and 21 deletions
+1 -1
View File
@@ -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
`<node>.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 `<node>.<run>`, 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
@@ -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)
}
@@ -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)
}
}
+11 -15
View File
@@ -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"`
}
+2 -2
View File
@@ -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{}
+1 -1
View File
@@ -12,7 +12,7 @@
}
],
"reads": [
"mesh-controller.declared-packages"
"node-engine.packages"
],
"uses": [
"operator-channel"