Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be306f4a04 | ||
|
|
bee9aa6e1c | ||
|
|
e5d5b2d267 | ||
|
|
61548a07b5 | ||
|
|
3bb2c4e7f4 |
@@ -150,8 +150,8 @@ func TestAnUnreadCatalogHalfLetsItsOwnReadsThrough(t *testing.T) {
|
||||
{"", "bridge_merged_message", false, nil, "controller", false},
|
||||
{"", "bridge_merged_message", false, nil, "unproven", false},
|
||||
{"", "bridge_merged_message", true, nil, "n1.mesh-delivery-indexer", false}, // the tool's own module's account (A-433)
|
||||
{"", "ledger_repair", false, nil, "n1.mesh-delivery-runner", true}, // the runner's own tool
|
||||
{"git", "merge-pull", true, nil, "n1.mesh-delivery-runner", false}, // a module's account, a seat verb too (A-433)
|
||||
{"", "ledger_repair", false, nil, "n1.mesh-delivery-runner", true}, // the runner's own tool
|
||||
{"git", "merge-pull", true, nil, "n1.mesh-delivery-runner", false}, // a module's account, a seat verb too (A-433)
|
||||
{"git", "merge-pull", false, nil, "n1.node-tools", false}, // the console's account stays held
|
||||
} {
|
||||
ran := false
|
||||
|
||||
@@ -64,6 +64,7 @@ func (m Manifest) Resolve(built []Built) (Manifest, error) {
|
||||
// **Each template's text, as the build read it back from its templates archive** (novox/hq ADR 0349 §2): into
|
||||
// the file's content, so what the mesh holds and composes is what the same text inline would be.
|
||||
var handed *Handed
|
||||
templatesDigest := ""
|
||||
if m.Templated() {
|
||||
name := TemplatesArtifact(m)
|
||||
texts := by[name].Texts
|
||||
@@ -90,12 +91,14 @@ func (m Manifest) Resolve(built []Built) (Manifest, error) {
|
||||
// And, for a moved module, where its templates are and which one each file and item is filled from
|
||||
// (handed.go): read while its resources and items still name their templates.
|
||||
handed = handedBy(m, by[name])
|
||||
templatesDigest = by[name].Digest
|
||||
m.Resources = filled
|
||||
m.Items = items
|
||||
}
|
||||
|
||||
out := m
|
||||
out.Handed = handed
|
||||
out.TemplatesDigest = templatesDigest
|
||||
out.Build = nil
|
||||
// Read with the build, like Build: the manifest the mesh holds carries each file's text (issue 731).
|
||||
out.Templates = ""
|
||||
|
||||
@@ -120,3 +120,19 @@ func TestAResourceNamingAPackageIsRefused(t *testing.T) {
|
||||
t.Fatal("a resource backed by a package was accepted; a package is not a resource")
|
||||
}
|
||||
}
|
||||
|
||||
// A templated module's resolved manifest keeps the digest of the archive its files were rendered from, handed or not
|
||||
// (design 47 G A-481, A-481a); a module with no templates keeps none.
|
||||
func TestResolveKeepsTheDigestOfTheTemplatesArchive(t *testing.T) {
|
||||
m := Manifest{Module: "tidy", Build: &Build{Artifacts: []Artifact{{Name: "files", Kind: ArtifactArchive, From: "files"}}}, Resources: []map[string]any{
|
||||
{"id": "tidy:conf", "type": "file", "path": "/etc/tidy.conf", TemplateField: "files/tidy.conf"}}}
|
||||
digest := "sha256:" + strings.Repeat("c", 64)
|
||||
got, err := m.Resolve([]Built{{Name: "files", Kind: ArtifactArchive, Digest: digest,
|
||||
Reference: ArtifactStoreScheme + "tidy/files/blobs/" + digest, Texts: map[string]string{"tidy.conf": "x"}}})
|
||||
if err != nil || got.TemplatesDigest != digest {
|
||||
t.Fatalf("templates digest %q, %v; want %s", got.TemplatesDigest, err, digest)
|
||||
}
|
||||
if plain, err := buildable().Resolve(wasBuilt()); err != nil || plain.TemplatesDigest != "" {
|
||||
t.Fatalf("a module with no templates keeps no templates digest: %q, %v", plain.TemplatesDigest, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,6 +749,9 @@ type Manifest struct {
|
||||
// Handed is what its build kept for that (handed.go): written by Resolve, never in a repository.
|
||||
Moved bool `json:"moved,omitempty"`
|
||||
Handed *Handed `json:"handed,omitempty"`
|
||||
// TemplatesDigest is the digest of the archive a templated module's files were rendered from, "sha256:<hex>": written
|
||||
// by Resolve, never in a repository; the composition names it (design 47 G A-481, A-481a).
|
||||
TemplatesDigest string `json:"templates-digest,omitempty"`
|
||||
|
||||
// Binds is where this module wants to be told about something it requires, per requirement.
|
||||
//
|
||||
|
||||
@@ -1364,107 +1364,6 @@
|
||||
"description": "the kept predefined list",
|
||||
"history": 5
|
||||
},
|
||||
{
|
||||
"name": "config-candidates",
|
||||
"template": "state",
|
||||
"key-forms": [
|
||||
{
|
||||
"key": "<pull>",
|
||||
"value": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"v": {
|
||||
"type": "integer",
|
||||
"description": "the layout version"
|
||||
},
|
||||
"pull": {
|
||||
"type": "string"
|
||||
},
|
||||
"head": {
|
||||
"type": "string"
|
||||
},
|
||||
"declares": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": {
|
||||
"description": "the default"
|
||||
},
|
||||
"why": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"enum": {
|
||||
"description": "the allowed values"
|
||||
},
|
||||
"minimum": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"description": "a declared bound; 0 is a bound, absent is none"
|
||||
},
|
||||
"maximum": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"description": "a declared bound; 0 is a bound, absent is none"
|
||||
},
|
||||
"pattern": {
|
||||
"type": "string"
|
||||
},
|
||||
"trusted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"predefined": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"runtime": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"default",
|
||||
"why"
|
||||
]
|
||||
}
|
||||
},
|
||||
"description": "module to key to declaration"
|
||||
},
|
||||
"at": {
|
||||
"type": "string",
|
||||
"description": "when (RFC 3339 time)",
|
||||
"format": "date-time"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pull",
|
||||
"head",
|
||||
"declares"
|
||||
]
|
||||
},
|
||||
"description": "the configuration a pull request declares"
|
||||
}
|
||||
],
|
||||
"description": "the configuration declared by open pull requests",
|
||||
"history": 5
|
||||
},
|
||||
{
|
||||
"name": "packages",
|
||||
"template": "state",
|
||||
@@ -2959,6 +2858,10 @@
|
||||
},
|
||||
"description": "the merges it holds, oldest first"
|
||||
},
|
||||
"revision": {
|
||||
"type": "integer",
|
||||
"description": "the catalog graph revision of the branch the take-in made, which the pipelines of its entries start at (design 47 G section 476, A-448)"
|
||||
},
|
||||
"group": {
|
||||
"type": "string",
|
||||
"description": "the delivery group, for a group being gathered"
|
||||
|
||||
@@ -266,80 +266,6 @@
|
||||
}
|
||||
],
|
||||
"description": "the value each module on each node takes for each config key, built from the sources alone"
|
||||
},
|
||||
{
|
||||
"name": "kept",
|
||||
"template": "state",
|
||||
"key-forms": [
|
||||
{
|
||||
"key": "<owner>.<repository>.<number>.<node>.<module>.<key>",
|
||||
"value": {
|
||||
"type": "object",
|
||||
"description": "an approved held value, kept apart from the values mesh-config resolves, laid only over the composition of its own pull request at its head (ADR 0565 clause 5)",
|
||||
"properties": {
|
||||
"pull": {
|
||||
"type": "string",
|
||||
"description": "the pull request, owner/repository#number"
|
||||
},
|
||||
"head": {
|
||||
"type": "string",
|
||||
"description": "the head the declaration was read at"
|
||||
},
|
||||
"declaration": {
|
||||
"type": "string",
|
||||
"description": "the digest of what the declaration holds the value to; the value stays only while it is the same"
|
||||
},
|
||||
"node": {
|
||||
"type": "string"
|
||||
},
|
||||
"module": {
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"description": "the config key"
|
||||
},
|
||||
"value": {
|
||||
"description": "the value held, as the operator approved it"
|
||||
},
|
||||
"by": {
|
||||
"type": "string"
|
||||
},
|
||||
"via": {
|
||||
"type": "string",
|
||||
"description": "where the value was proposed from"
|
||||
},
|
||||
"why": {
|
||||
"type": "string"
|
||||
},
|
||||
"approved": {
|
||||
"type": "string",
|
||||
"description": "who approved it, as the proposal kept it"
|
||||
},
|
||||
"proposal": {
|
||||
"type": "string",
|
||||
"description": "the proposal's id"
|
||||
},
|
||||
"at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "when it was kept"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pull",
|
||||
"head",
|
||||
"declaration",
|
||||
"node",
|
||||
"module",
|
||||
"key",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"description": "one held value: the pull request (owner, repository and number, none holding a dot), the node, the module and the config key, which may hold dots"
|
||||
}
|
||||
],
|
||||
"description": "the approved held values of open pull requests, read by the checker and the assigner's composition check"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1364,107 +1364,6 @@
|
||||
"description": "the kept predefined list",
|
||||
"history": 5
|
||||
},
|
||||
{
|
||||
"name": "config-candidates",
|
||||
"template": "state",
|
||||
"key-forms": [
|
||||
{
|
||||
"key": "<pull>",
|
||||
"value": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"v": {
|
||||
"type": "integer",
|
||||
"description": "the layout version"
|
||||
},
|
||||
"pull": {
|
||||
"type": "string"
|
||||
},
|
||||
"head": {
|
||||
"type": "string"
|
||||
},
|
||||
"declares": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": {
|
||||
"description": "the default"
|
||||
},
|
||||
"why": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"enum": {
|
||||
"description": "the allowed values"
|
||||
},
|
||||
"minimum": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"description": "a declared bound; 0 is a bound, absent is none"
|
||||
},
|
||||
"maximum": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"description": "a declared bound; 0 is a bound, absent is none"
|
||||
},
|
||||
"pattern": {
|
||||
"type": "string"
|
||||
},
|
||||
"trusted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"predefined": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"runtime": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"default",
|
||||
"why"
|
||||
]
|
||||
}
|
||||
},
|
||||
"description": "module to key to declaration"
|
||||
},
|
||||
"at": {
|
||||
"type": "string",
|
||||
"description": "when (RFC 3339 time)",
|
||||
"format": "date-time"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pull",
|
||||
"head",
|
||||
"declares"
|
||||
]
|
||||
},
|
||||
"description": "the configuration a pull request declares"
|
||||
}
|
||||
],
|
||||
"description": "the configuration declared by open pull requests",
|
||||
"history": 5
|
||||
},
|
||||
{
|
||||
"name": "packages",
|
||||
"template": "state",
|
||||
@@ -2959,6 +2858,10 @@
|
||||
},
|
||||
"description": "the merges it holds, oldest first"
|
||||
},
|
||||
"revision": {
|
||||
"type": "integer",
|
||||
"description": "the catalog graph revision of the branch the take-in made, which the pipelines of its entries start at (design 47 G section 476, A-448)"
|
||||
},
|
||||
"group": {
|
||||
"type": "string",
|
||||
"description": "the delivery group, for a group being gathered"
|
||||
|
||||
@@ -266,80 +266,6 @@
|
||||
}
|
||||
],
|
||||
"description": "the value each module on each node takes for each config key, built from the sources alone"
|
||||
},
|
||||
{
|
||||
"name": "kept",
|
||||
"template": "state",
|
||||
"key-forms": [
|
||||
{
|
||||
"key": "<owner>.<repository>.<number>.<node>.<module>.<key>",
|
||||
"value": {
|
||||
"type": "object",
|
||||
"description": "an approved held value, kept apart from the values mesh-config resolves, laid only over the composition of its own pull request at its head (ADR 0565 clause 5)",
|
||||
"properties": {
|
||||
"pull": {
|
||||
"type": "string",
|
||||
"description": "the pull request, owner/repository#number"
|
||||
},
|
||||
"head": {
|
||||
"type": "string",
|
||||
"description": "the head the declaration was read at"
|
||||
},
|
||||
"declaration": {
|
||||
"type": "string",
|
||||
"description": "the digest of what the declaration holds the value to; the value stays only while it is the same"
|
||||
},
|
||||
"node": {
|
||||
"type": "string"
|
||||
},
|
||||
"module": {
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"description": "the config key"
|
||||
},
|
||||
"value": {
|
||||
"description": "the value held, as the operator approved it"
|
||||
},
|
||||
"by": {
|
||||
"type": "string"
|
||||
},
|
||||
"via": {
|
||||
"type": "string",
|
||||
"description": "where the value was proposed from"
|
||||
},
|
||||
"why": {
|
||||
"type": "string"
|
||||
},
|
||||
"approved": {
|
||||
"type": "string",
|
||||
"description": "who approved it, as the proposal kept it"
|
||||
},
|
||||
"proposal": {
|
||||
"type": "string",
|
||||
"description": "the proposal's id"
|
||||
},
|
||||
"at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "when it was kept"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pull",
|
||||
"head",
|
||||
"declaration",
|
||||
"node",
|
||||
"module",
|
||||
"key",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"description": "one held value: the pull request (owner, repository and number, none holding a dot), the node, the module and the config key, which may hold dots"
|
||||
}
|
||||
],
|
||||
"description": "the approved held values of open pull requests, read by the checker and the assigner's composition check"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -266,80 +266,6 @@
|
||||
}
|
||||
],
|
||||
"description": "the value each module on each node takes for each config key, built from the sources alone"
|
||||
},
|
||||
{
|
||||
"name": "kept",
|
||||
"template": "state",
|
||||
"key-forms": [
|
||||
{
|
||||
"key": "<owner>.<repository>.<number>.<node>.<module>.<key>",
|
||||
"value": {
|
||||
"type": "object",
|
||||
"description": "an approved held value, kept apart from the values mesh-config resolves, laid only over the composition of its own pull request at its head (ADR 0565 clause 5)",
|
||||
"properties": {
|
||||
"pull": {
|
||||
"type": "string",
|
||||
"description": "the pull request, owner/repository#number"
|
||||
},
|
||||
"head": {
|
||||
"type": "string",
|
||||
"description": "the head the declaration was read at"
|
||||
},
|
||||
"declaration": {
|
||||
"type": "string",
|
||||
"description": "the digest of what the declaration holds the value to; the value stays only while it is the same"
|
||||
},
|
||||
"node": {
|
||||
"type": "string"
|
||||
},
|
||||
"module": {
|
||||
"type": "string"
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"description": "the config key"
|
||||
},
|
||||
"value": {
|
||||
"description": "the value held, as the operator approved it"
|
||||
},
|
||||
"by": {
|
||||
"type": "string"
|
||||
},
|
||||
"via": {
|
||||
"type": "string",
|
||||
"description": "where the value was proposed from"
|
||||
},
|
||||
"why": {
|
||||
"type": "string"
|
||||
},
|
||||
"approved": {
|
||||
"type": "string",
|
||||
"description": "who approved it, as the proposal kept it"
|
||||
},
|
||||
"proposal": {
|
||||
"type": "string",
|
||||
"description": "the proposal's id"
|
||||
},
|
||||
"at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "when it was kept"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pull",
|
||||
"head",
|
||||
"declaration",
|
||||
"node",
|
||||
"module",
|
||||
"key",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
"description": "one held value: the pull request (owner, repository and number, none holding a dot), the node, the module and the config key, which may hold dots"
|
||||
}
|
||||
],
|
||||
"description": "the approved held values of open pull requests, read by the checker and the assigner's composition check"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+4
-101
@@ -1364,107 +1364,6 @@
|
||||
"description": "the kept predefined list",
|
||||
"history": 5
|
||||
},
|
||||
{
|
||||
"name": "config-candidates",
|
||||
"template": "state",
|
||||
"key-forms": [
|
||||
{
|
||||
"key": "<pull>",
|
||||
"value": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"v": {
|
||||
"type": "integer",
|
||||
"description": "the layout version"
|
||||
},
|
||||
"pull": {
|
||||
"type": "string"
|
||||
},
|
||||
"head": {
|
||||
"type": "string"
|
||||
},
|
||||
"declares": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": {
|
||||
"description": "the default"
|
||||
},
|
||||
"why": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"enum": {
|
||||
"description": "the allowed values"
|
||||
},
|
||||
"minimum": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"description": "a declared bound; 0 is a bound, absent is none"
|
||||
},
|
||||
"maximum": {
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
],
|
||||
"description": "a declared bound; 0 is a bound, absent is none"
|
||||
},
|
||||
"pattern": {
|
||||
"type": "string"
|
||||
},
|
||||
"trusted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"predefined": {
|
||||
"type": "string"
|
||||
},
|
||||
"required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"runtime": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"default",
|
||||
"why"
|
||||
]
|
||||
}
|
||||
},
|
||||
"description": "module to key to declaration"
|
||||
},
|
||||
"at": {
|
||||
"type": "string",
|
||||
"description": "when (RFC 3339 time)",
|
||||
"format": "date-time"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"pull",
|
||||
"head",
|
||||
"declares"
|
||||
]
|
||||
},
|
||||
"description": "the configuration a pull request declares"
|
||||
}
|
||||
],
|
||||
"description": "the configuration declared by open pull requests",
|
||||
"history": 5
|
||||
},
|
||||
{
|
||||
"name": "packages",
|
||||
"template": "state",
|
||||
@@ -2959,6 +2858,10 @@
|
||||
},
|
||||
"description": "the merges it holds, oldest first"
|
||||
},
|
||||
"revision": {
|
||||
"type": "integer",
|
||||
"description": "the catalog graph revision of the branch the take-in made, which the pipelines of its entries start at (design 47 G section 476, A-448)"
|
||||
},
|
||||
"group": {
|
||||
"type": "string",
|
||||
"description": "the delivery group, for a group being gathered"
|
||||
|
||||
@@ -1247,7 +1247,7 @@ func subViews(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("an event names its state on its subject, and decodes as it was encoded", func(t *testing.T) {
|
||||
if s := StateOfEvent("mesh.stream.mesh-delivery-indexer.event.views.config-candidates"); s != "config-candidates" {
|
||||
if s := StateOfEvent("mesh.stream.mesh-delivery-indexer.event.views.predefined"); s != "predefined" {
|
||||
t.Errorf("state of subject = %q", s)
|
||||
}
|
||||
for subject, want := range map[string]string{"mesh.mod.o.event.views.modules": "o", "mesh.mod.o.event.views.a.b": "", "mesh.mod.o.event.other": "",
|
||||
|
||||
Reference in New Issue
Block a user