From af267cb557e09c315bd0d4a5f886f69291025c5a Mon Sep 17 00:00:00 2001 From: mesh-tools Date: Tue, 20 Oct 2026 08:27:10 +0000 Subject: [PATCH] Take the catalogue from mesh-sdk in internal/inventory and internal/link, and keep the tests that read this repository's own manifest, Dockerfile and Makefile in internal/ownmanifest (issue 1381, 5 of 6 import swaps) The three tests of the controller's own module.json (process, claimed seat, addresses), the Dockerfile and Makefile pin test, the build-agent registry test and the manifest-in-use seat test move with their old package, as tests of mesh-sdk's exported API; a moved test is exempt from failing first. --- internal/inventory/collection.go | 2 +- internal/inventory/collection_test.go | 2 +- internal/inventory/config_move.go | 2 +- internal/inventory/config_move_test.go | 2 +- internal/inventory/data.go | 2 +- internal/inventory/dependencies.go | 2 +- internal/inventory/dependencies_test.go | 2 +- internal/inventory/forget_test.go | 2 +- internal/inventory/gate.go | 2 +- internal/inventory/givable_test.go | 2 +- internal/inventory/given_test.go | 2 +- internal/inventory/heldhere_test.go | 2 +- internal/inventory/holdings_test.go | 2 +- internal/inventory/issued_test.go | 2 +- internal/inventory/mirrored_test.go | 2 +- internal/inventory/older_build_test.go | 2 +- internal/inventory/operator.go | 2 +- internal/inventory/operator_test.go | 2 +- internal/inventory/outside.go | 2 +- internal/inventory/outside_test.go | 2 +- internal/inventory/placement_move.go | 2 +- internal/inventory/placement_test.go | 2 +- internal/inventory/placement_words_test.go | 2 +- internal/inventory/ports_test.go | 2 +- internal/inventory/predefined.go | 2 +- internal/inventory/predefined_test.go | 2 +- internal/inventory/provisioning.go | 2 +- internal/inventory/provisioning_test.go | 2 +- .../record_mirrors_integration_test.go | 2 +- internal/inventory/record_mirrors_test.go | 2 +- .../registered_held_integration_test.go | 2 +- internal/inventory/rootfree_grants_test.go | 2 +- internal/inventory/seats.go | 2 +- internal/inventory/seats_test.go | 2 +- .../secret_family_integration_test.go | 2 +- internal/inventory/secret_family_test.go | 2 +- internal/inventory/secret_move_test.go | 2 +- internal/inventory/secrets.go | 2 +- internal/inventory/secrets_test.go | 2 +- internal/inventory/sent_builds_test.go | 2 +- internal/inventory/settings_judged_test.go | 2 +- internal/inventory/state_keyttl_test.go | 2 +- internal/inventory/stored_silent_file_test.go | 2 +- internal/inventory/streams_test.go | 2 +- internal/inventory/template_test.go | 2 +- internal/inventory/unseen_test.go | 2 +- internal/inventory/waits_grants_test.go | 2 +- internal/link/enrol_shape_test.go | 2 +- .../controller_is_a_process_test.go | 133 ++++++++++++++++++ internal/ownmanifest/doc.go | 5 + .../ownmanifest/foundation_manifests_test.go | 38 +++++ internal/ownmanifest/genesis_image_test.go | 29 ++++ 52 files changed, 253 insertions(+), 48 deletions(-) create mode 100644 internal/ownmanifest/controller_is_a_process_test.go create mode 100644 internal/ownmanifest/doc.go create mode 100644 internal/ownmanifest/foundation_manifests_test.go create mode 100644 internal/ownmanifest/genesis_image_test.go diff --git a/internal/inventory/collection.go b/internal/inventory/collection.go index ebb011c4..cd927045 100644 --- a/internal/inventory/collection.go +++ b/internal/inventory/collection.go @@ -5,7 +5,7 @@ import ( "sort" "strings" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // What the artifact store keeps, and what it may let go (novox/hq ADR 0189, issue 108). diff --git a/internal/inventory/collection_test.go b/internal/inventory/collection_test.go index b608facf..eeb5ce65 100644 --- a/internal/inventory/collection_test.go +++ b/internal/inventory/collection_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // What the store keeps, and what it may let go (novox/hq ADR 0189, issue 108). diff --git a/internal/inventory/config_move.go b/internal/inventory/config_move.go index 06bebf98..cfdd8a2c 100644 --- a/internal/inventory/config_move.go +++ b/internal/inventory/config_move.go @@ -9,7 +9,7 @@ import ( "github.com/jackc/pgx/v5" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // **The settings layers move into mesh-config** (novox/hq ADR 0348 §9 and its consequences, design 57 K5, issue diff --git a/internal/inventory/config_move_test.go b/internal/inventory/config_move_test.go index a4912522..a55a4c62 100644 --- a/internal/inventory/config_move_test.go +++ b/internal/inventory/config_move_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // configured is a module in the config form: one value a mergeable file takes, and a directory to place. diff --git a/internal/inventory/data.go b/internal/inventory/data.go index 944ed3b8..836bf468 100644 --- a/internal/inventory/data.go +++ b/internal/inventory/data.go @@ -9,7 +9,7 @@ import ( "github.com/jackc/pgx/v5" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The data a module declares, as the mesh found it on each machine (novox/hq ADR 0233). diff --git a/internal/inventory/dependencies.go b/internal/inventory/dependencies.go index 678575bb..4d398fe6 100644 --- a/internal/inventory/dependencies.go +++ b/internal/inventory/dependencies.go @@ -5,8 +5,8 @@ import ( "sort" "strings" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/builder" - "github.com/novox/mesh-controller/internal/catalogue" ) // The kinds of edge in the catalogue's one dependency relation (novox/hq ADR 0162). diff --git a/internal/inventory/dependencies_test.go b/internal/inventory/dependencies_test.go index 566e99f5..239b4545 100644 --- a/internal/inventory/dependencies_test.go +++ b/internal/inventory/dependencies_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The catalogue's one dependency relation (novox/hq ADR 0162): four kinds of edge from one call. diff --git a/internal/inventory/forget_test.go b/internal/inventory/forget_test.go index ff79f139..d0019fc2 100644 --- a/internal/inventory/forget_test.go +++ b/internal/inventory/forget_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // What removing a module takes with it, and what re-registering one does not. diff --git a/internal/inventory/gate.go b/internal/inventory/gate.go index 08cc9439..f83e09c7 100644 --- a/internal/inventory/gate.go +++ b/internal/inventory/gate.go @@ -10,7 +10,7 @@ import ( "github.com/jackc/pgx/v5" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The gate's verdicts (novox/hq ADR 0236, to-be 45 §8): what a build did on its first machine, and, diff --git a/internal/inventory/givable_test.go b/internal/inventory/givable_test.go index 308ed1cf..238be44e 100644 --- a/internal/inventory/givable_test.go +++ b/internal/inventory/givable_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // `give` takes only a value nobody but a person has (the review of 2026-10-09, M4): never the module's bus diff --git a/internal/inventory/given_test.go b/internal/inventory/given_test.go index ade0433a..ff234271 100644 --- a/internal/inventory/given_test.go +++ b/internal/inventory/given_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/chain" ) diff --git a/internal/inventory/heldhere_test.go b/internal/inventory/heldhere_test.go index 831208c7..fe812c12 100644 --- a/internal/inventory/heldhere_test.go +++ b/internal/inventory/heldhere_test.go @@ -3,8 +3,8 @@ package inventory import ( "testing" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/broker" - "github.com/novox/mesh-controller/internal/catalogue" ) // novox/hq issue 218: a seat held once for the mesh is granted and issued only to the holder on record; diff --git a/internal/inventory/holdings_test.go b/internal/inventory/holdings_test.go index e129c141..8d7dcd52 100644 --- a/internal/inventory/holdings_test.go +++ b/internal/inventory/holdings_test.go @@ -6,7 +6,7 @@ import ( "context" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // A seat's holder is a row, changed as one act (novox/hq ADR 0131). What these pin is the shape of diff --git a/internal/inventory/issued_test.go b/internal/inventory/issued_test.go index 65c40254..7f890160 100644 --- a/internal/inventory/issued_test.go +++ b/internal/inventory/issued_test.go @@ -5,7 +5,7 @@ package inventory import ( "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // A value a provider's software issued is sealed to every pair that holds the provision from that provider, under diff --git a/internal/inventory/mirrored_test.go b/internal/inventory/mirrored_test.go index 9f56d9b7..a61214d0 100644 --- a/internal/inventory/mirrored_test.go +++ b/internal/inventory/mirrored_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // A base a build copies into the store is recorded where it is copied, and kept while a kept build stood diff --git a/internal/inventory/older_build_test.go b/internal/inventory/older_build_test.go index 5c3f861f..eab509ef 100644 --- a/internal/inventory/older_build_test.go +++ b/internal/inventory/older_build_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // novox/hq 04-ISSUES/219: two builds of one module in flight together, the one asked first heard diff --git a/internal/inventory/operator.go b/internal/inventory/operator.go index 52b6723e..42395bc8 100644 --- a/internal/inventory/operator.go +++ b/internal/inventory/operator.go @@ -8,7 +8,7 @@ import ( "github.com/jackc/pgx/v5" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/secrets" ) diff --git a/internal/inventory/operator_test.go b/internal/inventory/operator_test.go index 9b1a9b13..cd376900 100644 --- a/internal/inventory/operator_test.go +++ b/internal/inventory/operator_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/secrets" ) diff --git a/internal/inventory/outside.go b/internal/inventory/outside.go index e45a7b17..f814003c 100644 --- a/internal/inventory/outside.go +++ b/internal/inventory/outside.go @@ -8,7 +8,7 @@ import ( "github.com/jackc/pgx/v5" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/secrets" ) diff --git a/internal/inventory/outside_test.go b/internal/inventory/outside_test.go index 70019a76..82989645 100644 --- a/internal/inventory/outside_test.go +++ b/internal/inventory/outside_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // outsideProvision registers a provider offering tv-api with a credential issued outside the mesh (novox/hq ADR diff --git a/internal/inventory/placement_move.go b/internal/inventory/placement_move.go index 8070e7bc..5056077c 100644 --- a/internal/inventory/placement_move.go +++ b/internal/inventory/placement_move.go @@ -4,7 +4,7 @@ import ( "context" "sort" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // **The move of placement** (novox/hq ADR 0348 clause 11, issue 736; design 57: the moves of data run after the diff --git a/internal/inventory/placement_test.go b/internal/inventory/placement_test.go index 0acda5c2..fde5f1fc 100644 --- a/internal/inventory/placement_test.go +++ b/internal/inventory/placement_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // placedLibrary is a module with each kind of placement: a directory to place, two accesses, a container that diff --git a/internal/inventory/placement_words_test.go b/internal/inventory/placement_words_test.go index e3a8ee7f..4a9e3e4b 100644 --- a/internal/inventory/placement_words_test.go +++ b/internal/inventory/placement_words_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // reachedForge is a module every one of the four words reaches: two endpoints, both published, one with a diff --git a/internal/inventory/ports_test.go b/internal/inventory/ports_test.go index eab01635..dd690eaf 100644 --- a/internal/inventory/ports_test.go +++ b/internal/inventory/ports_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) func aNodeWithModules(t *testing.T, modules ...string) (*Inventory, string) { diff --git a/internal/inventory/predefined.go b/internal/inventory/predefined.go index 03fc588e..17a8b199 100644 --- a/internal/inventory/predefined.go +++ b/internal/inventory/predefined.go @@ -8,7 +8,7 @@ import ( "github.com/jackc/pgx/v5" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The list of predefined keys the mesh publishes (novox/hq ADR 0348 §7, design 57 package K2): the newest trunk diff --git a/internal/inventory/predefined_test.go b/internal/inventory/predefined_test.go index 14d4fa5e..0a50ed6d 100644 --- a/internal/inventory/predefined_test.go +++ b/internal/inventory/predefined_test.go @@ -5,7 +5,7 @@ package inventory import ( "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The list of predefined keys the controller keeps (novox/hq ADR 0348 §7 and its check "a newer trunk build's diff --git a/internal/inventory/provisioning.go b/internal/inventory/provisioning.go index f3340e58..09d58bfd 100644 --- a/internal/inventory/provisioning.go +++ b/internal/inventory/provisioning.go @@ -11,8 +11,8 @@ import ( "sort" "strings" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/broker" - "github.com/novox/mesh-controller/internal/catalogue" ) // The provisioner's plan of a module on a node (novox/hq ADR 0349 clause 4, design 57 P5, issue 671): what a node's diff --git a/internal/inventory/provisioning_test.go b/internal/inventory/provisioning_test.go index a8704131..5df700ae 100644 --- a/internal/inventory/provisioning_test.go +++ b/internal/inventory/provisioning_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // APlan is a whole plan, as design 57 P6 composes one for a module handed to the provisioner. diff --git a/internal/inventory/record_mirrors_integration_test.go b/internal/inventory/record_mirrors_integration_test.go index b2dc6685..e2417202 100644 --- a/internal/inventory/record_mirrors_integration_test.go +++ b/internal/inventory/record_mirrors_integration_test.go @@ -6,7 +6,7 @@ import ( "encoding/json" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) func TestAModuleInTheConfigFormIsMirroredWithItsWholeDeclaration(t *testing.T) { diff --git a/internal/inventory/record_mirrors_test.go b/internal/inventory/record_mirrors_test.go index 013d94e5..0462a09a 100644 --- a/internal/inventory/record_mirrors_test.go +++ b/internal/inventory/record_mirrors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // jsonFields is the names a struct's fields are encoded under. diff --git a/internal/inventory/registered_held_integration_test.go b/internal/inventory/registered_held_integration_test.go index cf299498..e690c21f 100644 --- a/internal/inventory/registered_held_integration_test.go +++ b/internal/inventory/registered_held_integration_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) func TestWhatRunsIsTheRegisteredBuildNotANewerOnePutBack(t *testing.T) { diff --git a/internal/inventory/rootfree_grants_test.go b/internal/inventory/rootfree_grants_test.go index 119ecff2..e4639c9f 100644 --- a/internal/inventory/rootfree_grants_test.go +++ b/internal/inventory/rootfree_grants_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/broker" - "github.com/novox/mesh-controller/internal/catalogue" ) // grantMatches is a NATS subject pattern matching a subject: `*` one token, `>` the rest. diff --git a/internal/inventory/seats.go b/internal/inventory/seats.go index 972e3e2c..9fc19b62 100644 --- a/internal/inventory/seats.go +++ b/internal/inventory/seats.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The seats the mesh has, as data (novox/hq ADR 0122). diff --git a/internal/inventory/seats_test.go b/internal/inventory/seats_test.go index ff22f6a2..c300e97c 100644 --- a/internal/inventory/seats_test.go +++ b/internal/inventory/seats_test.go @@ -5,7 +5,7 @@ package inventory import ( "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The seat set is data the control plane owns (novox/hq ADR 0122): seeded from the binary's diff --git a/internal/inventory/secret_family_integration_test.go b/internal/inventory/secret_family_integration_test.go index 36f93ed3..833758ff 100644 --- a/internal/inventory/secret_family_integration_test.go +++ b/internal/inventory/secret_family_integration_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) func TestAMemberGivenIsReadAsGivenAndNothingElseIs(t *testing.T) { diff --git a/internal/inventory/secret_family_test.go b/internal/inventory/secret_family_test.go index 85756a9b..53eaec89 100644 --- a/internal/inventory/secret_family_test.go +++ b/internal/inventory/secret_family_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // A member of a secret family is given by its full name, at the desk too, and a name outside the family is refused diff --git a/internal/inventory/secret_move_test.go b/internal/inventory/secret_move_test.go index 9050ad15..ca75465d 100644 --- a/internal/inventory/secret_move_test.go +++ b/internal/inventory/secret_move_test.go @@ -6,7 +6,7 @@ import ( "context" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The move reads every row sealed to a machine as the store holds it (design 57's V3, issue 676): its modules' own diff --git a/internal/inventory/secrets.go b/internal/inventory/secrets.go index 21164bbf..7af5ea93 100644 --- a/internal/inventory/secrets.go +++ b/internal/inventory/secrets.go @@ -11,8 +11,8 @@ import ( "github.com/jackc/pgx/v5" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/broker" - "github.com/novox/mesh-controller/internal/catalogue" "github.com/novox/mesh-controller/internal/secrets" ) diff --git a/internal/inventory/secrets_test.go b/internal/inventory/secrets_test.go index 69abd1fa..2c715913 100644 --- a/internal/inventory/secrets_test.go +++ b/internal/inventory/secrets_test.go @@ -12,7 +12,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/secrets" "golang.org/x/crypto/nacl/box" diff --git a/internal/inventory/sent_builds_test.go b/internal/inventory/sent_builds_test.go index cde4b6ff..eeea1567 100644 --- a/internal/inventory/sent_builds_test.go +++ b/internal/inventory/sent_builds_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // novox/hq issue 259: a send keeps which build of each module it carried. A machine never sent diff --git a/internal/inventory/settings_judged_test.go b/internal/inventory/settings_judged_test.go index ca1b8488..e410b7e1 100644 --- a/internal/inventory/settings_judged_test.go +++ b/internal/inventory/settings_judged_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // A setting is judged where it is stored (novox/hq ADR 0163, rule 6): one that cannot compose with diff --git a/internal/inventory/state_keyttl_test.go b/internal/inventory/state_keyttl_test.go index a15dfeb3..359edf86 100644 --- a/internal/inventory/state_keyttl_test.go +++ b/internal/inventory/state_keyttl_test.go @@ -3,7 +3,7 @@ package inventory import ( "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // 1154/AC2: a module's state with key-ttl is composed into a bucket that carries KeyTTL; without it, none. diff --git a/internal/inventory/stored_silent_file_test.go b/internal/inventory/stored_silent_file_test.go index a110b235..5840e6f3 100644 --- a/internal/inventory/stored_silent_file_test.go +++ b/internal/inventory/stored_silent_file_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // A build kept from before ADR 0326 §3 is still read and composed (novox/hq issue 574). betterbird's diff --git a/internal/inventory/streams_test.go b/internal/inventory/streams_test.go index 4a4cd0fb..ce522f98 100644 --- a/internal/inventory/streams_test.go +++ b/internal/inventory/streams_test.go @@ -5,7 +5,7 @@ import ( "slices" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // A machine's layer wins over the mesh's for the setting that restricts a stream (novox/hq ADR 0363 §5). diff --git a/internal/inventory/template_test.go b/internal/inventory/template_test.go index 75c8c12e..2a9a0399 100644 --- a/internal/inventory/template_test.go +++ b/internal/inventory/template_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The manifest the mesh holds carries each file's text (novox/hq ADR 0349 §2): one still naming a template — a diff --git a/internal/inventory/unseen_test.go b/internal/inventory/unseen_test.go index e19b0752..80ea3998 100644 --- a/internal/inventory/unseen_test.go +++ b/internal/inventory/unseen_test.go @@ -5,7 +5,7 @@ package inventory import ( "testing" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" ) // novox/hq ADR 0217: a settings layer can be read, and the one a set or a clear replaced is kept, so diff --git a/internal/inventory/waits_grants_test.go b/internal/inventory/waits_grants_test.go index c3841b4e..5a851cf0 100644 --- a/internal/inventory/waits_grants_test.go +++ b/internal/inventory/waits_grants_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/broker" - "github.com/novox/mesh-controller/internal/catalogue" ) // The tool runner's manifest with the families novox/hq ADR 0367 §5 starts the grant with, and one more. diff --git a/internal/link/enrol_shape_test.go b/internal/link/enrol_shape_test.go index 68cd60c4..3e47dd95 100644 --- a/internal/link/enrol_shape_test.go +++ b/internal/link/enrol_shape_test.go @@ -13,7 +13,7 @@ import ( "golang.org/x/crypto/nacl/box" - "github.com/novox/mesh-controller/internal/catalogue" + "git.novox.be/novox/mesh-sdk/go/catalogue" "github.com/novox/mesh-controller/internal/inventory" "github.com/novox/mesh-controller/internal/link" ) diff --git a/internal/ownmanifest/controller_is_a_process_test.go b/internal/ownmanifest/controller_is_a_process_test.go new file mode 100644 index 00000000..2098652b --- /dev/null +++ b/internal/ownmanifest/controller_is_a_process_test.go @@ -0,0 +1,133 @@ +package ownmanifest + +import ( + "encoding/json" + "fmt" + "os" + "strings" + "testing" + + . "git.novox.be/novox/mesh-sdk/go/catalogue" +) + +// novox/hq issue 213: the controller is a Go program and was the one piece of the mesh's own Go +// code still shipped as an image (ADR 0188 §1). Its own manifest, composed for the machine that runs +// it, is a Go bundle run by the host as a process — and no container. +func TestTheControllerIsAProcessAndNoContainer(t *testing.T) { + raw, err := os.ReadFile("../../module.json") + if err != nil { + t.Fatal(err) + } + m, err := ParseManifest(raw) + if err != nil { + t.Fatalf("the controller's own manifest does not parse:\n%v", err) + } + if m.Build == nil || len(m.Build.Artifacts) != 1 { + t.Fatalf("the controller builds %+v; it is one bundle", m.Build) + } + a := m.Build.Artifacts[0] + if a.Kind != ArtifactBundle || a.Language != "go" || a.System == "" || BinaryOf(a) != "mesh-controller" { + t.Fatalf("the controller's artifact is %+v, not a Go bundle naming its system and binary", a) + } + for _, c := range m.Capabilities { + if c == "container-runtime" { + t.Error("the controller still requires a container runtime on its machine") + } + } + + digest := "sha256:" + strings.Repeat("c", 64) + control, err := m.Resolve([]Built{{Name: a.Name, Kind: ArtifactBundle, + Reference: ArtifactStoreScheme + "mesh-controller/" + a.Name + "@" + digest, Digest: digest}}) + if err != nil { + t.Fatal(err) + } + // The node's runtime does not launch it: it serves its seat's verbs itself. + if loads := control.Bundles[0].Loads; len(loads) != 0 { + t.Errorf("the node's runtime would launch the controller as a tools bundle: %v", loads) + } + + needed := map[string]map[string]string{"mesh-controller": {}} + for name := range m.OwnSecrets { + needed["mesh-controller"][name] = "sealed-" + name + } + out, err := Resolution{Node: "anchor", Modules: []Manifest{control}}.Declaration(Rendering{ + Needed: needed, ArtifactStore: "anchor.internal:5100", + Seats: map[string]map[int]int{"mesh-store": {5432: 6852}}, + }) + if err != nil { + t.Fatalf("the controller does not compose: %v", err) + } + + var process, step map[string]any + account, firstSecret := -1, -1 + for i, r := range out { + switch { + case r["type"] == "container": + t.Errorf("the controller's declaration still runs a container: %v", r) + case r["id"] == "mesh-controller.controller": + process = r + case r["id"] == "mesh-controller.controller-prepare": + step = r + if process != nil { + t.Error("the controller's preparation is placed after the process it prepares for") + } + case r["type"] == "user" && r["name"] == "mesh-controller": + account = i + case strings.HasPrefix(fmt.Sprint(r["id"]), "mesh-controller.needs-") && firstSecret < 0: + firstSecret = i + } + } + if process == nil { + t.Fatalf("the controller's process is not in its declaration: %v", out) + } + if run, _ := json.Marshal(process["run"]); string(run) != `["./mesh-controller","serve"]` { + t.Errorf("the controller is run as %s, not its own bundle's binary", run) + } + if process["source"] != "anchor.internal:5100/mesh-controller/"+a.Name+"@"+digest || process["digest"] != digest { + t.Errorf("the controller's bundle is fetched from %v (%v)", process["source"], process["digest"]) + } + // The user: an account the host declares, which owns what the process reads. + if process["user"] != "mesh-controller" || account < 0 { + t.Errorf("the controller runs as %v, and the account declared is at %d", process["user"], account) + } + if firstSecret >= 0 && account > firstSecret { + t.Error("the controller's secrets are written before the account they belong to exists") + } + for _, r := range out { + if strings.HasPrefix(fmt.Sprint(r["id"]), "mesh-controller.needs-") && r["owner"] != "mesh-controller" { + t.Errorf("%v belongs to %v, which the controller's process cannot read", r["id"], r["owner"]) + } + } + if dir := fileNamed(out, "mesh-controller.mesh-state"); dir == nil || dir["owner"] != "mesh-controller" { + t.Errorf("the controller's state directory is not its account's to enter: %v", dir) + } + // Each mount became a path the process reads: nothing it is told is a path inside a container. + state := fmt.Sprint(fileNamed(out, "mesh-controller.mesh-state")["path"]) + env, _ := process["env"].(map[string]any) + for key, value := range env { + v := fmt.Sprint(value) + if strings.HasPrefix(v, "/run/secrets") || strings.HasPrefix(v, "/broker-tls") { + t.Errorf("%s=%s is a path inside the container the controller no longer runs in", key, v) + } + if strings.HasSuffix(key, "_FILE") && !strings.HasPrefix(v, state+"/") { + t.Errorf("%s=%s is not one of the files the mesh places for it", key, v) + } + } + if env["MESH_BROKER_CERTIFICATE"] != "/var/lib/mesh-broker-tls/tls.crt" { + t.Errorf("the controller reads the broker's certificate from %v", env["MESH_BROKER_CERTIFICATE"]) + } + if env["MESH_STORE_INVENTORY_PORT"] != "6852" { + t.Errorf("the controller is told the store is on %v; the node put it on 6852", env["MESH_STORE_INVENTORY_PORT"]) + } + // The handover: the container it ran as goes only once this is running. + if got, _ := json.Marshal(process["replaces"]); string(got) != `["mesh-controller.server"]` { + t.Errorf("the controller's process replaces %s, not the container it ran as", got) + } + // And its state is prepared first, by the same program as the same account. + if step == nil || step["run-once"] != true || step["user"] != "mesh-controller" { + t.Fatalf("the controller's preparation is %v", step) + } + if run, _ := json.Marshal(step["run"]); string(run) != `["./mesh-controller","prepare"]` { + t.Errorf("the controller's preparation runs %s", run) + } +} diff --git a/internal/ownmanifest/doc.go b/internal/ownmanifest/doc.go new file mode 100644 index 00000000..be9d6509 --- /dev/null +++ b/internal/ownmanifest/doc.go @@ -0,0 +1,5 @@ +// Package ownmanifest holds the tests of this repository's own manifests (module.json, modules/*), of its Dockerfile +// and Makefile, and of the catalogue's modules as this repository reads them, against mesh-sdk's go/catalogue: the +// tests that read a file of this repository, which mesh-sdk cannot (design 47 R4b, issue 1381). They were +// internal/catalogue's, moved here with the package (a moved test is exempt from failing first). +package ownmanifest diff --git a/internal/ownmanifest/foundation_manifests_test.go b/internal/ownmanifest/foundation_manifests_test.go new file mode 100644 index 00000000..a544a93d --- /dev/null +++ b/internal/ownmanifest/foundation_manifests_test.go @@ -0,0 +1,38 @@ +package ownmanifest + +import ( + "fmt" + "testing" + + . "git.novox.be/novox/mesh-sdk/go/catalogue" +) + +// **The builder requires the registry the npm seat delivers, and carries no binding of its own.** +// +// It used to carry a hand-written binding because nothing provided a package registry to resolve +// one from at genesis. The catalogue now requires it like any consumer, and ADR 0110 makes the +// seat's holder the answer when more than one module provides it — so a carried copy would be a +// second answer to the same question, free to drift from the first. Asserted gone, not merely +// unused. +// +// The builder is the build-agent on every machine since novox/hq ADR 0190; this read the retired +// `builder` and, finding no manifest, skipped unseen from then until novox/hq issue 432. +func TestTheBuilderRequiresTheRegistryTheNpmSeatDelivers(t *testing.T) { + builder := catalogueManifest(t, "build-agent") + seat, _ := SeatNamed("npm-package-registry") + var requires bool + for _, r := range builder.Requires { + requires = requires || r == seat.Delivers + } + if !requires { + t.Fatalf("the builder does not require %q: %v", seat.Delivers, builder.Requires) + } + if builder.Binds[seat.Delivers] == "" { + t.Errorf("the builder is not told where the registry is: binds %v", builder.Binds) + } + for _, r := range builder.Resources { + if fmt.Sprint(r["id"]) == "package-binding" { + t.Fatal("the builder carries its own package binding beside the one the mesh resolves") + } + } +} diff --git a/internal/ownmanifest/genesis_image_test.go b/internal/ownmanifest/genesis_image_test.go new file mode 100644 index 00000000..d57dac48 --- /dev/null +++ b/internal/ownmanifest/genesis_image_test.go @@ -0,0 +1,29 @@ +package ownmanifest + +import ( + "os" + "regexp" + "testing" +) + +// novox/hq issue 223: genesis raises the controller as a container built from this repository's own +// Dockerfile, with no build arguments — the manifest no longer builds an image, so nothing passes a +// base in. The Dockerfile's own default must therefore be a Go that builds this module, pinned by +// digest, and the replacement the manifest's process names must be the container genesis raises. +func TestGenesisCanBuildTheControllersImageAsItStands(t *testing.T) { + raw, err := os.ReadFile("../../Dockerfile") + if err != nil { + t.Fatal(err) + } + if !regexp.MustCompile(`(?m)^ARG GO_BASE=golang@sha256:[0-9a-f]{64}$`).Match(raw) { + t.Fatal("the Dockerfile's default Go base is not pinned by digest; genesis builds it with no arguments") + } + makefile, err := os.ReadFile("../../Makefile") + if err != nil { + t.Fatal(err) + } + pin := regexp.MustCompile(`golang@sha256:[0-9a-f]{64}`) + if string(pin.Find(raw)) != string(pin.Find(makefile)) { + t.Errorf("the Dockerfile and the Makefile build on different Go: %s, %s", pin.Find(raw), pin.Find(makefile)) + } +}