From 3fbe33612fcecd4e0270b50d5bd9b68fcdaeca22 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 23:04:35 +0100 Subject: [PATCH 1/8] H2 composition-diff: the node-engine seat's read verb composition-diff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The node-engine serves seat verbs and has no tools bundle, so the composed values read by resource are a read verb beside composition: given a module and a revision or digest, the entries that differ between the running composition and the other, per resource, environment entries by name, a secret masked. Packages generated again by seatgen (seatgen -check clean). Builds: design 47 H2 §813 (3); H-A-349 DQ-12b --- go/seats/nodeengine/contract.go | 46 +++++++++++- go/seats/nodeengine/contract_test.go | 6 ++ seats/node-engine/fixtures/verbs.json | 48 ++++++++++++ seats/node-engine/seat.json | 103 ++++++++++++++++++++++++++ ts/seats/nodeengine/index.d.ts | 44 +++++++++++ ts/seats/nodeengine/index.js | 1 + 6 files changed, 247 insertions(+), 1 deletion(-) diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index 17f22ec..2be3506 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -23,6 +23,7 @@ const ( VerbActs = "acts" VerbPackages = "packages" VerbComposition = "composition" + VerbCompositionDiff = "composition-diff" VerbCompose = "compose" VerbComposeCandidate = "compose-candidate" VerbManifestReads = "manifest-reads" @@ -49,7 +50,7 @@ const ( // Verbs is every verb the seat serves, in its definition's order: a new copy each call. func Verbs() []string { - return []string{VerbHandOver, VerbAccessAct, VerbJudgeDirectories, VerbSetuidSearch, VerbRootFree, VerbActs, VerbPackages, VerbComposition, VerbCompose, VerbComposeCandidate, VerbManifestReads, VerbApplyOrder, VerbSeatList, VerbSeatListAgain, VerbFirstViews, VerbFirstViewAgain, VerbEntryAgain, VerbProcessBuilds, VerbConverged} + return []string{VerbHandOver, VerbAccessAct, VerbJudgeDirectories, VerbSetuidSearch, VerbRootFree, VerbActs, VerbPackages, VerbComposition, VerbCompositionDiff, VerbCompose, VerbComposeCandidate, VerbManifestReads, VerbApplyOrder, VerbSeatList, VerbSeatListAgain, VerbFirstViews, VerbFirstViewAgain, VerbEntryAgain, VerbProcessBuilds, VerbConverged} } // Events is every event published on the seat's subject: a new copy each call. @@ -625,6 +626,26 @@ type Composed struct { V int64 `json:"v"` } +// CompositionDiffEntry is one entry that differs between the running composition and the other. +type CompositionDiffEntry struct { + // the value is a secret, so neither value is given + Masked bool `json:"masked,omitempty"` + // the entry: an environment entry by its name, else the part of the resource that differs + Name string `json:"name"` + // its value in the other composition; absent where the other lacks it or the value is a secret + Other string `json:"other,omitempty"` + // its value in the running composition; absent where the running one lacks it or the value is a secret + Running string `json:"running,omitempty"` +} + +// CompositionDiffResource is one resource with the entries of it that differ. +type CompositionDiffResource struct { + // the entries of the resource that differ + Entries []CompositionDiffEntry `json:"entries"` + // the resource, as the composition names it + Resource string `json:"resource"` +} + // DeclaredGroup is a group. type DeclaredGroup struct { Gid int64 `json:"gid"` @@ -1338,6 +1359,29 @@ type CompositionAnswer struct { WithheldUnknown string `json:"withheld-unknown,omitempty"` } +// CompositionDiffInput is what composition-diff takes. +type CompositionDiffInput struct { + // the digest (sha256:…) of the composition to compare with; give it or revision + Digest string `json:"digest,omitempty"` + // the module, as placed on this machine; node for the node's own + Module string `json:"module"` + // the revision of the module's composition key to compare with, from the revisions the bucket keeps; give it or digest + Revision int64 `json:"revision,omitempty"` +} + +// CompositionDiffAnswer is what composition-diff answers. +type CompositionDiffAnswer struct { + // the module + Module string `json:"module"` + // the node + Node string `json:"node"` + Other *Revision `json:"other,omitempty"` + // each resource with an entry that differs; empty when none differs + Resources []CompositionDiffResource `json:"resources"` + // the digest of the composition that runs; absent when nothing runs + Running string `json:"running,omitempty"` +} + // ComposeInput is what compose takes. type ComposeInput struct { // a module placed on this machine whose apply is also tried again (optional) diff --git a/go/seats/nodeengine/contract_test.go b/go/seats/nodeengine/contract_test.go index d8150dd..0e1072c 100644 --- a/go/seats/nodeengine/contract_test.go +++ b/go/seats/nodeengine/contract_test.go @@ -135,6 +135,12 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v ConvergedAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "composition names the filter part kept because allowed did not answer", subject: "", given: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}", wire: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}", decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "composition-diff asks a module against a digest", subject: "", given: "{\"digest\":\"sha256:aa\",\"module\":\"plex\"}", wire: "{\"digest\":\"sha256:aa\",\"module\":\"plex\"}", + decode: func(b []byte) (any, error) { var v CompositionDiffInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "composition-diff answers the entries that differ per resource, a secret masked", subject: "", given: "{\"module\":\"plex\",\"node\":\"ace\",\"other\":{\"digest\":\"sha256:aa\",\"key\":\"plex\",\"revision\":12},\"resources\":[{\"entries\":[{\"name\":\"PLEX_LOG_LEVEL\",\"other\":\"debug\",\"running\":\"info\"},{\"masked\":true,\"name\":\"PLEX_TOKEN\"}],\"resource\":\"service:plex\"}],\"running\":\"sha256:bb\"}", wire: "{\"module\":\"plex\",\"node\":\"ace\",\"other\":{\"digest\":\"sha256:aa\",\"key\":\"plex\",\"revision\":12},\"resources\":[{\"entries\":[{\"name\":\"PLEX_LOG_LEVEL\",\"other\":\"debug\",\"running\":\"info\"},{\"masked\":true,\"name\":\"PLEX_TOKEN\"}],\"resource\":\"service:plex\"}],\"running\":\"sha256:bb\"}", + decode: func(b []byte) (any, error) { var v CompositionDiffAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "composition-diff answers no resource when none differs", subject: "", given: "{\"module\":\"plex\",\"node\":\"ace\",\"resources\":[],\"running\":\"sha256:aa\"}", wire: "{\"module\":\"plex\",\"node\":\"ace\",\"resources\":[],\"running\":\"sha256:aa\"}", + decode: func(b []byte) (any, error) { var v CompositionDiffAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, } for _, c := range cases { v, err := c.decode([]byte(c.given)) diff --git a/seats/node-engine/fixtures/verbs.json b/seats/node-engine/fixtures/verbs.json index a495cb6..23dfb66 100644 --- a/seats/node-engine/fixtures/verbs.json +++ b/seats/node-engine/fixtures/verbs.json @@ -332,5 +332,53 @@ } ] } + }, + { + "name": "composition-diff asks a module against a digest", + "of": "verb:composition-diff.input", + "given": { + "module": "plex", + "digest": "sha256:aa" + } + }, + { + "name": "composition-diff answers the entries that differ per resource, a secret masked", + "of": "verb:composition-diff.answer", + "given": { + "node": "ace", + "module": "plex", + "running": "sha256:bb", + "other": { + "key": "plex", + "revision": 12, + "digest": "sha256:aa" + }, + "resources": [ + { + "resource": "service:plex", + "entries": [ + { + "name": "PLEX_LOG_LEVEL", + "running": "info", + "other": "debug" + }, + { + "name": "PLEX_TOKEN", + "masked": true + } + ] + } + ] + } + }, + { + "name": "composition-diff answers no resource when none differs", + "of": "verb:composition-diff.answer", + "given": { + "node": "ace", + "module": "plex", + "running": "sha256:aa", + "resources": [] + } } ] diff --git a/seats/node-engine/seat.json b/seats/node-engine/seat.json index 46220d9..cb12b6f 100644 --- a/seats/node-engine/seat.json +++ b/seats/node-engine/seat.json @@ -550,6 +550,63 @@ }, "class": "read" }, + { + "name": "composition-diff", + "description": "One module's composed values read by resource (design 47 H2 \u00a7813 (3), H-A-349 DQ-12b): given a module and a revision or a digest of its composition, the entries that differ between the composition that runs and that one, per resource, environment entries by name, a secret's value masked. Read-only. Answered by this machine's engine alone.", + "class": "read", + "input": { + "type": "object", + "required": [ + "module" + ], + "properties": { + "module": { + "type": "string", + "description": "the module, as placed on this machine; node for the node's own" + }, + "revision": { + "type": "integer", + "description": "the revision of the module's composition key to compare with, from the revisions the bucket keeps; give it or digest" + }, + "digest": { + "type": "string", + "description": "the digest (sha256:\u2026) of the composition to compare with; give it or revision" + } + } + }, + "answer": { + "type": "object", + "required": [ + "node", + "module", + "resources" + ], + "properties": { + "node": { + "type": "string", + "description": "the node" + }, + "module": { + "type": "string", + "description": "the module" + }, + "running": { + "type": "string", + "description": "the digest of the composition that runs; absent when nothing runs" + }, + "other": { + "$ref": "#/defs/Revision" + }, + "resources": { + "type": "array", + "description": "each resource with an entry that differs; empty when none differs", + "items": { + "$ref": "#/defs/CompositionDiffResource" + } + } + } + } + }, { "name": "compose", "description": "Compose this machine's modules now and say how it went, so a composition that failed, or a module held, recovers without a restart: what the pass refused or held, each with why, and when the engine composes again on its own after a seat that did not answer (a deadline, no responders: retried with a growing wait; a refusal never). With module, that module's apply is also tried again. Changes only what a pass the engine makes on its own would change.", @@ -3398,6 +3455,52 @@ "step", "since" ] + }, + "CompositionDiffEntry": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "the entry: an environment entry by its name, else the part of the resource that differs" + }, + "running": { + "type": "string", + "description": "its value in the running composition; absent where the running one lacks it or the value is a secret" + }, + "other": { + "type": "string", + "description": "its value in the other composition; absent where the other lacks it or the value is a secret" + }, + "masked": { + "type": "boolean", + "description": "the value is a secret, so neither value is given" + } + }, + "description": "one entry that differs between the running composition and the other" + }, + "CompositionDiffResource": { + "type": "object", + "required": [ + "resource", + "entries" + ], + "properties": { + "resource": { + "type": "string", + "description": "the resource, as the composition names it" + }, + "entries": { + "type": "array", + "items": { + "$ref": "#/defs/CompositionDiffEntry" + }, + "description": "the entries of the resource that differ" + } + }, + "description": "one resource with the entries of it that differ" } } } diff --git a/ts/seats/nodeengine/index.d.ts b/ts/seats/nodeengine/index.d.ts index eb6830a..6858c26 100644 --- a/ts/seats/nodeengine/index.d.ts +++ b/ts/seats/nodeengine/index.d.ts @@ -13,6 +13,7 @@ export declare const verbs: { readonly acts: "acts"; readonly packages: "packages"; readonly composition: "composition"; + readonly compositionDiff: "composition-diff"; readonly compose: "compose"; readonly composeCandidate: "compose-candidate"; readonly manifestReads: "manifest-reads"; @@ -304,6 +305,26 @@ export interface Composed { "v": number; } +/** one entry that differs between the running composition and the other */ +export interface CompositionDiffEntry { + /** the value is a secret, so neither value is given */ + "masked"?: boolean; + /** the entry: an environment entry by its name, else the part of the resource that differs */ + "name": string; + /** its value in the other composition; absent where the other lacks it or the value is a secret */ + "other"?: string; + /** its value in the running composition; absent where the running one lacks it or the value is a secret */ + "running"?: string; +} + +/** one resource with the entries of it that differ */ +export interface CompositionDiffResource { + /** the entries of the resource that differ */ + "entries": CompositionDiffEntry[]; + /** the resource, as the composition names it */ + "resource": string; +} + /** a group */ export interface DeclaredGroup { "gid": number; @@ -963,6 +984,29 @@ export interface CompositionAnswer { "withheld-unknown"?: string; } +/** is what composition-diff takes. */ +export interface CompositionDiffInput { + /** the digest (sha256:…) of the composition to compare with; give it or revision */ + "digest"?: string; + /** the module, as placed on this machine; node for the node's own */ + "module": string; + /** the revision of the module's composition key to compare with, from the revisions the bucket keeps; give it or digest */ + "revision"?: number; +} + +/** is what composition-diff answers. */ +export interface CompositionDiffAnswer { + /** the module */ + "module": string; + /** the node */ + "node": string; + "other"?: Revision; + /** each resource with an entry that differs; empty when none differs */ + "resources": CompositionDiffResource[]; + /** the digest of the composition that runs; absent when nothing runs */ + "running"?: string; +} + /** is what compose takes. */ export interface ComposeInput { /** a module placed on this machine whose apply is also tried again (optional) */ diff --git a/ts/seats/nodeengine/index.js b/ts/seats/nodeengine/index.js index 56850c7..245c586 100644 --- a/ts/seats/nodeengine/index.js +++ b/ts/seats/nodeengine/index.js @@ -13,6 +13,7 @@ export const verbs = { acts: "acts", packages: "packages", composition: "composition", + compositionDiff: "composition-diff", compose: "compose", composeCandidate: "compose-candidate", manifestReads: "manifest-reads", -- 2.54.0 From 28cb4d54412853ccd0fb132fcb0e1c87d786e327 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 23:06:03 +0100 Subject: [PATCH 2/8] H2 own-put: the vault seat takes a module's own secret in two sealed steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vault served no write of a module's own secret, so the forge module could not keep its token there. own-put, modelled on licence-put: the first step names the secret and answers a call and a key; the second sends the call and the value sealed to that key, kept as the calling module's own (named by the caller's account, never an argument), newest generation only. get answers it to a process of the same module, sealed to that process's key. Packages generated again by seatgen (seatgen -check clean). Builds: design 47 H2 §822, §808; H-A-345; H-A-349 DQ-7 --- .../go/seats/meshvault/contract.go | 16 ++++++++++- .../go/seats/meshvault/contract_test.go | 6 ++++ .../seats/mesh-vault/fixtures/verbs.json | 23 +++++++++++++++ .../seats/mesh-vault/seat.json | 28 ++++++++++++++++++- .../ts/seats/meshvault/index.d.ts | 14 ++++++++++ .../ts/seats/meshvault/index.js | 1 + 6 files changed, 86 insertions(+), 2 deletions(-) diff --git a/identity-and-access/go/seats/meshvault/contract.go b/identity-and-access/go/seats/meshvault/contract.go index 07a19f4..8529393 100644 --- a/identity-and-access/go/seats/meshvault/contract.go +++ b/identity-and-access/go/seats/meshvault/contract.go @@ -31,11 +31,12 @@ const ( VerbAbandon = "abandon" VerbRetire = "retire" VerbLicencePut = "licence-put" + VerbOwnPut = "own-put" ) // Verbs is every verb the seat serves, in its definition's order: a new copy each call. func Verbs() []string { - return []string{VerbGet, VerbSecretAsk, VerbIssued, VerbRotate, VerbMoveIn, VerbNodeKey, VerbOwn, VerbIssueAccount, VerbSign, VerbEnrolmentToken, VerbNodeAccount, VerbRotateNode, VerbNodeAccountConfirm, VerbAbandon, VerbRetire, VerbLicencePut} + return []string{VerbGet, VerbSecretAsk, VerbIssued, VerbRotate, VerbMoveIn, VerbNodeKey, VerbOwn, VerbIssueAccount, VerbSign, VerbEnrolmentToken, VerbNodeAccount, VerbRotateNode, VerbNodeAccountConfirm, VerbAbandon, VerbRetire, VerbLicencePut, VerbOwnPut} } // The holder's own events, listed beside the seat and published under the holder's subjects (ADR 0620 §2). @@ -524,6 +525,19 @@ type LicencePutInput struct { // LicencePutAnswer is what licence-put answers. type LicencePutAnswer = map[string]any +// OwnPutInput is what own-put takes. +type OwnPutInput struct { + // the second step: the call the first step answered + Call string `json:"call,omitempty"` + // the first step: the secret's name, among the calling module's own + Name string `json:"name,omitempty"` + // the second step: the value sealed to the call's key — never the value + Sealed string `json:"sealed,omitempty"` +} + +// OwnPutAnswer is what own-put answers. +type OwnPutAnswer = map[string]any + // SignedHolderEvent is the body of the holder's event signed. type SignedHolderEvent struct { // when it was signed, RFC 3339 diff --git a/identity-and-access/go/seats/meshvault/contract_test.go b/identity-and-access/go/seats/meshvault/contract_test.go index 8b8c520..1fda141 100644 --- a/identity-and-access/go/seats/meshvault/contract_test.go +++ b/identity-and-access/go/seats/meshvault/contract_test.go @@ -51,6 +51,12 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v EnrolmentTokenAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "a node account retired", subject: "", given: "{\"node\":\"ace\",\"retired\":true}", wire: "{\"node\":\"ace\",\"retired\":true}", decode: func(b []byte) (any, error) { var v NodeAccountAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "own-put's first step names the secret", subject: "", given: "{\"name\":\"forge-token\"}", wire: "{\"name\":\"forge-token\"}", + decode: func(b []byte) (any, error) { var v OwnPutInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "own-put's second step sends the call and the sealed value", subject: "", given: "{\"call\":\"c-1\",\"sealed\":\"AAAA\"}", wire: "{\"call\":\"c-1\",\"sealed\":\"AAAA\"}", + decode: func(b []byte) (any, error) { var v OwnPutInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "own-put's first step answers the call and the key to seal to", subject: "", given: "{\"call\":\"c-1\",\"seal_to\":\"-----BEGIN PUBLIC KEY-----\"}", wire: "{\"call\":\"c-1\",\"seal_to\":\"-----BEGIN PUBLIC KEY-----\"}", + decode: func(b []byte) (any, error) { var v OwnPutAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, } for _, c := range cases { v, err := c.decode([]byte(c.given)) diff --git a/identity-and-access/seats/mesh-vault/fixtures/verbs.json b/identity-and-access/seats/mesh-vault/fixtures/verbs.json index 49b29f3..2767436 100644 --- a/identity-and-access/seats/mesh-vault/fixtures/verbs.json +++ b/identity-and-access/seats/mesh-vault/fixtures/verbs.json @@ -39,5 +39,28 @@ "node": "ace", "retired": true } + }, + { + "name": "own-put's first step names the secret", + "of": "verb:own-put.input", + "given": { + "name": "forge-token" + } + }, + { + "name": "own-put's second step sends the call and the sealed value", + "of": "verb:own-put.input", + "given": { + "call": "c-1", + "sealed": "AAAA" + } + }, + { + "name": "own-put's first step answers the call and the key to seal to", + "of": "verb:own-put.answer", + "given": { + "call": "c-1", + "seal_to": "-----BEGIN PUBLIC KEY-----" + } } ] diff --git a/identity-and-access/seats/mesh-vault/seat.json b/identity-and-access/seats/mesh-vault/seat.json index 95c08b6..57afdfc 100644 --- a/identity-and-access/seats/mesh-vault/seat.json +++ b/identity-and-access/seats/mesh-vault/seat.json @@ -9,7 +9,7 @@ "verbs": [ { "name": "get", - "description": "One secret, sealed to the public key the asker sends (the sealed box of ADR 0206), with its generation; answered only to an asker the vault allows, as the bus proved it. Never the value in the clear, and never to a private key.", + "description": "One secret, sealed to the public key the asker sends (the sealed box of ADR 0206), with its generation; answered only to an asker the vault allows, as the bus proved it, and a module's own secret put through own-put only to a process of the same module (design 47 H2 §822). Never the value in the clear, and never to a private key.", "optional": true, "input": { "properties": { @@ -676,6 +676,32 @@ "type": "object", "description": "the holder's answer" } + }, + { + "name": "own-put", + "description": "Store a secret as the calling module's own, in two steps modelled on licence-put (design 47 H2 §822, H-A-345, H-A-349 DQ-7): name the secret and get a call and a key made for it (call, seal_to); then send the call and the value sealed to that key, and the vault keeps it under that name as the module's own, the module named by the caller's account as the bus proved it, never by an argument, keeping its newest generation only (name, generation). get answers it to a process of the same module, sealed to the process's key. The holder says each write in its journal without the value.", + "optional": true, + "input": { + "properties": { + "call": { + "description": "the second step: the call the first step answered", + "type": "string" + }, + "name": { + "description": "the first step: the secret's name, among the calling module's own", + "type": "string" + }, + "sealed": { + "description": "the second step: the value sealed to the call's key — never the value", + "type": "string" + } + }, + "type": "object" + }, + "answer": { + "type": "object", + "description": "the holder's answer: to the first step the call and the key to seal to (call, seal_to); to the second the secret's name and the generation kept (name, generation)" + } } ], "description": "The mesh's secrets. accept and move-asks, which no holder served and nothing called, are left out (ADR 0620 §3). The vault's own events stay under its own subjects (ADR 0620 §2).", diff --git a/identity-and-access/ts/seats/meshvault/index.d.ts b/identity-and-access/ts/seats/meshvault/index.d.ts index 646d66f..6485559 100644 --- a/identity-and-access/ts/seats/meshvault/index.d.ts +++ b/identity-and-access/ts/seats/meshvault/index.d.ts @@ -21,6 +21,7 @@ export declare const verbs: { readonly abandon: "abandon"; readonly retire: "retire"; readonly licencePut: "licence-put"; + readonly ownPut: "own-put"; }; export declare const holderEvents: { @@ -387,6 +388,19 @@ export interface LicencePutInput { /** is what licence-put answers. */ export type LicencePutAnswer = Record; +/** is what own-put takes. */ +export interface OwnPutInput { + /** the second step: the call the first step answered */ + "call"?: string; + /** the first step: the secret's name, among the calling module's own */ + "name"?: string; + /** the second step: the value sealed to the call's key — never the value */ + "sealed"?: string; +} + +/** is what own-put answers. */ +export type OwnPutAnswer = Record; + /** is the body of the holder's event signed. */ export interface SignedHolderEvent { /** when it was signed, RFC 3339 */ diff --git a/identity-and-access/ts/seats/meshvault/index.js b/identity-and-access/ts/seats/meshvault/index.js index 54bc9f7..c61607a 100644 --- a/identity-and-access/ts/seats/meshvault/index.js +++ b/identity-and-access/ts/seats/meshvault/index.js @@ -21,6 +21,7 @@ export const verbs = { abandon: "abandon", retire: "retire", licencePut: "licence-put", + ownPut: "own-put", }; export const holderEvents = { -- 2.54.0 From 2172a8732daba71754651e4a219cd62c43047940 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 23:15:25 +0100 Subject: [PATCH 3/8] H2 K1: every seat package read tolerantly, saying its form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A reader of another part's value refused a field it did not know, so a holder that added one broke every reader until each was rebuilt. Every package is generated again by mesh-delivery's seatgen (feat/47-H2 ff7db337): each generated decoder keeps unknown fields, returns the form read (1 when absent) and each package states its Form (1 everywhere, left out on the wire). The hand-written clients take the three values, and the node-engine client's ask, answer, composition and have decoders keep unknown fields too; their tests now hold that tolerance. seatgen -check clean in all five folders. Builds: design 47 H2 §780; H-A-350 DMC-4 --- go/clients/meshmoduleassignerclient/keys.go | 4 +- go/clients/nodeengineclient/client.go | 16 +- go/clients/nodeengineclient/client_test.go | 8 +- go/clients/nodeengineclient/composed.go | 8 +- go/clients/nodeengineclient/composed_test.go | 4 +- go/clients/nodeengineclient/have.go | 12 +- go/clients/nodeengineclient/have_test.go | 4 +- go/clients/nodeengineclient/health.go | 7 +- go/seats/meshbroker/contract.go | 249 ++++++++- go/seats/meshconfig/contract.go | 94 +++- go/seats/meshmoduleassigner/contract.go | 268 ++++++--- go/seats/meshrecovery/contract.go | 223 +++++++- go/seats/nodeengine/contract.go | 529 ++++++++++++++---- .../meshconditionsclient/heard/heard_test.go | 2 +- .../go/seats/meshconditions/contract.go | 170 ++++-- .../go/seats/meshhandacts/contract.go | 110 +++- .../go/seats/meshhealers/contract.go | 137 +++-- .../go/seats/meshselfcheck/contract.go | 76 ++- .../go/seats/meshwatchdogs/contract.go | 165 ++++-- .../ts/seats/meshconditions/index.d.ts | 10 + .../ts/seats/meshhandacts/index.d.ts | 6 + .../ts/seats/meshhealers/index.d.ts | 8 + .../ts/seats/meshselfcheck/index.d.ts | 2 + .../ts/seats/meshwatchdogs/index.d.ts | 14 + .../go/clients/meshvaultclient/nodelogins.go | 2 +- .../go/clients/meshvaultclient/signers.go | 4 +- .../go/seats/meshgrants/contract.go | 91 ++- .../go/seats/meshnodeenroller/contract.go | 169 +++++- .../go/seats/meshvault/contract.go | 266 +++++++-- .../ts/seats/meshgrants/index.d.ts | 8 + .../ts/seats/meshnodeenroller/index.d.ts | 6 + .../ts/seats/meshvault/index.d.ts | 18 + .../go/seats/operatorchannel/contract.go | 123 +++- .../ts/seats/operatorchannel/index.d.ts | 10 + .../go/seats/meshprovisioner/contract.go | 88 +-- .../ts/seats/meshprovisioner/index.d.ts | 6 + ts/seats/meshbroker/index.d.ts | 22 + ts/seats/meshconfig/index.d.ts | 10 + ts/seats/meshmoduleassigner/index.d.ts | 18 + ts/seats/meshrecovery/index.d.ts | 28 + ts/seats/nodeengine/index.d.ts | 62 ++ 41 files changed, 2514 insertions(+), 543 deletions(-) diff --git a/go/clients/meshmoduleassignerclient/keys.go b/go/clients/meshmoduleassignerclient/keys.go index 72a01a5..72a5bfc 100644 --- a/go/clients/meshmoduleassignerclient/keys.go +++ b/go/clients/meshmoduleassignerclient/keys.go @@ -101,7 +101,7 @@ func DecodeNode(data []byte) (seat.AssignmentsByNodeNodeValue, error) { if err := checkVersion(data); err != nil { return seat.AssignmentsByNodeNodeValue{}, err } - n, err := seat.DecodeAssignmentsByNodeNodeValue(data) + n, _, err := seat.DecodeAssignmentsByNodeNodeValue(data) if err != nil { return n, fmt.Errorf("meshmoduleassignerclient: value does not fit its shape: %w", err) } @@ -141,7 +141,7 @@ func DecodeModule(data []byte) (seat.AssignmentsByNodeModuleValue, error) { if err := checkVersion(data); err != nil { return seat.AssignmentsByNodeModuleValue{}, err } - m, err := seat.DecodeAssignmentsByNodeModuleValue(data) + m, _, err := seat.DecodeAssignmentsByNodeModuleValue(data) if err != nil { return m, fmt.Errorf("meshmoduleassignerclient: value does not fit its shape: %w", err) } diff --git a/go/clients/nodeengineclient/client.go b/go/clients/nodeengineclient/client.go index 50c7533..277076f 100644 --- a/go/clients/nodeengineclient/client.go +++ b/go/clients/nodeengineclient/client.go @@ -128,10 +128,10 @@ func CheckAnswer(a seat.ComposeCandidateAnswer) error { return nil } -// strictDecode reads data into v, refusing an unknown key. -func strictDecode(data []byte, v any, what string) error { +// readDecode reads data into v, keeping a key it does not know (design 47 H2 §780: a reader of another part's value +// decodes it tolerantly). +func readDecode(data []byte, v any, what string) error { d := json.NewDecoder(bytes.NewReader(data)) - d.DisallowUnknownFields() d.UseNumber() // a number in an object the contract leaves open (the composition input) keeps its digits as written if err := d.Decode(v); err != nil { return fmt.Errorf("node-engine: %s does not fit its shape: %w", what, err) @@ -147,10 +147,10 @@ func EncodeAsk(a seat.ComposeCandidateInput) ([]byte, error) { return json.Marshal(a) } -// DecodeAsk reads an ask strictly; it refuses an unknown key and what EncodeAsk refuses. +// DecodeAsk reads an ask tolerantly, keeping a key it does not know; it refuses what EncodeAsk refuses. func DecodeAsk(data []byte) (seat.ComposeCandidateInput, error) { var a seat.ComposeCandidateInput - if err := strictDecode(data, &a, "a compose-candidate ask"); err != nil { + if err := readDecode(data, &a, "a compose-candidate ask"); err != nil { return seat.ComposeCandidateInput{}, err } return a, checkAsk(a) @@ -165,8 +165,8 @@ func EncodeAnswer(a seat.ComposeCandidateAnswer) ([]byte, error) { return json.Marshal(a) } -// DecodeAnswer reads an answer strictly; it refuses an unknown version (ErrUnknownVersion), an unknown key and what -// CheckAnswer refuses. +// DecodeAnswer reads an answer tolerantly, keeping a key it does not know; it refuses an unknown version +// (ErrUnknownVersion) and what CheckAnswer refuses. func DecodeAnswer(data []byte) (seat.ComposeCandidateAnswer, error) { var probe struct { V *int64 `json:"v"` @@ -178,7 +178,7 @@ func DecodeAnswer(data []byte) (seat.ComposeCandidateAnswer, error) { return seat.ComposeCandidateAnswer{}, fmt.Errorf("%w: this reader reads %d", ErrUnknownVersion, Version) } var a seat.ComposeCandidateAnswer - if err := strictDecode(data, &a, "a compose-candidate answer"); err != nil { + if err := readDecode(data, &a, "a compose-candidate answer"); err != nil { return seat.ComposeCandidateAnswer{}, err } return a, CheckAnswer(a) diff --git a/go/clients/nodeengineclient/client_test.go b/go/clients/nodeengineclient/client_test.go index d4ef6b8..d508a5c 100644 --- a/go/clients/nodeengineclient/client_test.go +++ b/go/clients/nodeengineclient/client_test.go @@ -24,8 +24,8 @@ func TestComposeCandidateRoundTripsAndRefuses(t *testing.T) { if a, err := DecodeAsk(raw); err != nil || a.Candidate != key || !a.Input { t.Fatalf("ask round trip: %v, %+v", err, a) } - if _, err := DecodeAsk([]byte(`{"candidate":"` + key + `","other":1}`)); err == nil { - t.Error("an ask with an unknown key was read") + if a, err := DecodeAsk([]byte(`{"candidate":"` + key + `","other":1}`)); err != nil || a.Candidate != key { + t.Errorf("an ask with an unknown key is refused (§780 reads it tolerantly): %+v, %v", a, err) } if _, err := EncodeAsk(seat.ComposeCandidateInput{Candidate: "nope"}); err == nil { t.Error("an ask naming no candidate key was encoded") @@ -46,8 +46,8 @@ func TestComposeCandidateRoundTripsAndRefuses(t *testing.T) { if err != nil || back.Verdict != Refused || len(back.Modules) != 3 || !reflect.DeepEqual(back.Input, good.Input) { t.Fatalf("answer round trip: %v, %+v", err, back) } - if _, err := DecodeAnswer([]byte(strings.Replace(string(raw), `"took"`, `"other":1,"took"`, 1))); err == nil { - t.Error("an answer with an unknown key was read") + if _, err := DecodeAnswer([]byte(strings.Replace(string(raw), `"took"`, `"other":1,"took"`, 1))); err != nil { + t.Errorf("an answer with an unknown key is refused (§780 reads it tolerantly): %v", err) } if _, err := DecodeAnswer([]byte(strings.Replace(string(raw), `"v":1`, `"v":2`, 1))); !errors.Is(err, ErrUnknownVersion) { t.Errorf("an answer at another version read as %v", err) diff --git a/go/clients/nodeengineclient/composed.go b/go/clients/nodeengineclient/composed.go index 88f5891..ae795af 100644 --- a/go/clients/nodeengineclient/composed.go +++ b/go/clients/nodeengineclient/composed.go @@ -289,16 +289,14 @@ func EncodeComposition(c Composition) ([]byte, error) { return json.Marshal(w) } -// DecodeComposition reads a composition; it refuses an unknown version (keys.ErrUnknownVersion), a field it does not -// know, and what EncodeComposition refuses. +// DecodeComposition reads a composition tolerantly, keeping a field it does not know (design 47 H2 §780); it refuses an +// unknown version (keys.ErrUnknownVersion) and what EncodeComposition refuses. func DecodeComposition(data []byte) (Composition, error) { if err := keys.CheckVersion(data); err != nil { return Composition{}, err } var w composedWire - d := json.NewDecoder(bytes.NewReader(data)) - d.DisallowUnknownFields() - if err := d.Decode(&w); err != nil { + if err := json.Unmarshal(data, &w); err != nil { return Composition{}, fmt.Errorf("node-engine: a composition does not fit its shape: %w", err) } c := Composition{V: w.V, Node: w.Node, Module: w.Module, FP: w.FP, Data: w.Data, Resources: w.Resources, diff --git a/go/clients/nodeengineclient/composed_test.go b/go/clients/nodeengineclient/composed_test.go index 73a1248..21f893b 100644 --- a/go/clients/nodeengineclient/composed_test.go +++ b/go/clients/nodeengineclient/composed_test.go @@ -124,8 +124,8 @@ func TestCompositionRefusals(t *testing.T) { if _, err := DecodeComposition([]byte(`{"v":2,"node":"ace","resources":[]}`)); err == nil { t.Error("a composition of version 2 is read") } - if _, err := DecodeComposition([]byte(`{"v":1,"node":"ace","resources":[],"extra":1}`)); err == nil { - t.Error("a composition with a field it does not know is read") + if c, err := DecodeComposition([]byte(`{"v":1,"node":"ace","resources":[],"extra":1}`)); err != nil || c.Node != "ace" { + t.Errorf("a composition with a field it does not know is refused (§780 reads it tolerantly): %v", err) } if _, err := DecodeComposition([]byte(`{"v":1,"node":"ace","resources":[],"signature":"x"}`)); err != nil { t.Errorf("a signed composition of the ended controller is refused: %v", err) diff --git a/go/clients/nodeengineclient/have.go b/go/clients/nodeengineclient/have.go index 7babbbe..23a4733 100644 --- a/go/clients/nodeengineclient/have.go +++ b/go/clients/nodeengineclient/have.go @@ -101,13 +101,13 @@ func EncodeHave(h seat.HaveByNodeModuleValue) ([]byte, error) { return json.Marshal(h) } -// DecodeHave reads a have; it refuses an unknown version (keys.ErrUnknownVersion), a field the contract does not know and -// what EncodeHave refuses. +// DecodeHave reads a have; it refuses an unknown version (keys.ErrUnknownVersion) and what EncodeHave refuses, and keeps a field +// the contract does not know (design 47 H2 §780). func DecodeHave(data []byte) (seat.HaveByNodeModuleValue, error) { if err := keys.CheckVersion(data); err != nil { return seat.HaveByNodeModuleValue{}, err } - h, err := seat.DecodeHaveByNodeModuleValue(data) + h, _, err := seat.DecodeHaveByNodeModuleValue(data) if err != nil { return seat.HaveByNodeModuleValue{}, fmt.Errorf("node-engine: value does not fit its shape: %w", err) } @@ -145,13 +145,13 @@ func EncodeHaveNode(n seat.HaveByNodeNodeValue) ([]byte, error) { return json.Marshal(n) } -// DecodeHaveNode reads a node's facts; it refuses an unknown version (keys.ErrUnknownVersion), a field the contract does -// not know and what EncodeHaveNode refuses. +// DecodeHaveNode reads a node's facts; it refuses an unknown version (keys.ErrUnknownVersion) and what EncodeHaveNode +// refuses, and keeps a field the contract does not know (design 47 H2 §780). func DecodeHaveNode(data []byte) (seat.HaveByNodeNodeValue, error) { if err := keys.CheckVersion(data); err != nil { return seat.HaveByNodeNodeValue{}, err } - n, err := seat.DecodeHaveByNodeNodeValue(data) + n, _, err := seat.DecodeHaveByNodeNodeValue(data) if err != nil { return seat.HaveByNodeNodeValue{}, fmt.Errorf("node-engine: value does not fit its shape: %w", err) } diff --git a/go/clients/nodeengineclient/have_test.go b/go/clients/nodeengineclient/have_test.go index 0ccf323..4a49636 100644 --- a/go/clients/nodeengineclient/have_test.go +++ b/go/clients/nodeengineclient/have_test.go @@ -55,8 +55,8 @@ func TestHaveCodec(t *testing.T) { if _, err := DecodeHave([]byte(`{"v":2,"phase":"running","health":"ok"}`)); !errors.Is(err, keys.ErrUnknownVersion) { t.Fatalf("version 2: %v", err) } - if _, err := DecodeHave([]byte(`{"v":1,"phase":"running","health":"ok","extra":1}`)); err == nil { - t.Fatal("an unknown field is read") + if h, err := DecodeHave([]byte(`{"v":1,"phase":"running","health":"ok","extra":1}`)); err != nil || h.Phase != "running" { + t.Fatalf("an unknown field is refused (§780 reads it tolerantly): %v", err) } t.Run("SameHaveComparesTimesAsInstants", func(t *testing.T) { at := time.Date(2026, 11, 5, 12, 0, 0, 0, time.UTC) diff --git a/go/clients/nodeengineclient/health.go b/go/clients/nodeengineclient/health.go index a5d3b56..bf0249f 100644 --- a/go/clients/nodeengineclient/health.go +++ b/go/clients/nodeengineclient/health.go @@ -30,12 +30,13 @@ func EncodeHealth(h seat.HealthByNodeValue) ([]byte, error) { return json.Marshal(h) } -// DecodeHealth reads a report; it refuses another version (keys.ErrUnknownVersion) and a field the contract does not know. +// DecodeHealth reads a report; it refuses another version (keys.ErrUnknownVersion) and keeps a field the contract does not know +// (design 47 H2 §780). func DecodeHealth(raw []byte) (seat.HealthByNodeValue, error) { if err := keys.CheckVersion(raw); err != nil { return seat.HealthByNodeValue{}, err } - h, err := seat.DecodeHealthByNodeValue(raw) + h, _, err := seat.DecodeHealthByNodeValue(raw) if err != nil { return seat.HealthByNodeValue{}, fmt.Errorf("node-engine: a node's health report is not readable: %w", err) } @@ -76,7 +77,7 @@ func DecodeData(raw []byte) (seat.DataByNodeModuleValue, error) { if err := keys.CheckVersion(raw); err != nil { return seat.DataByNodeModuleValue{}, err } - d, err := seat.DecodeDataByNodeModuleValue(raw) + d, _, err := seat.DecodeDataByNodeModuleValue(raw) if err != nil { return seat.DataByNodeModuleValue{}, fmt.Errorf("node-engine: a module's data items are not readable: %w", err) } diff --git a/go/seats/meshbroker/contract.go b/go/seats/meshbroker/contract.go index 6dc0efb..42a0752 100644 --- a/go/seats/meshbroker/contract.go +++ b/go/seats/meshbroker/contract.go @@ -3,11 +3,25 @@ // Package meshbroker is the contract of the seat "mesh-broker", defined whole (seats/mesh-broker/seat.json): The mesh's bus, and the bus state modules ask of it in requires (design 25 § 12). create, apply, recreate and drop are granted to the bus module's own credential alone. package meshbroker -import "time" +import ( + "encoding/json" + "time" +) // Seat is the seat's name. const Seat = "mesh-broker" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "ddc1534e14865923e0c10a7670539ae3f11349c8f6282f31992d2b337d39c498" +) + const ( VerbList = "list" VerbShow = "show" @@ -174,6 +188,8 @@ type Held struct { // its own configuration, where no template fits Configuration map[string]any `json:"configuration,omitempty"` Fill *Fill `json:"fill,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // its local name in the module's manifest LocalName string `json:"local-name"` // the module asking it @@ -239,6 +255,8 @@ type Said struct { // its own configuration, where no template fits Configuration map[string]any `json:"configuration,omitempty"` Fill *Fill `json:"fill,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the settings held Held map[string]any `json:"held,omitempty"` // its local name in the module's manifest @@ -309,6 +327,8 @@ type ListAnswer struct { Caps *ListAnswerCaps `json:"caps,omitempty"` // every entry Entries []Held `json:"entries"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // ShowInput is what show takes. @@ -341,6 +361,8 @@ type CheckAnswerDifferencesItem struct { type CheckAnswer struct { // every difference Differences []CheckAnswerDifferencesItem `json:"differences"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // OrphansInput is what orphans takes. @@ -351,6 +373,8 @@ type OrphansInput struct { type OrphansAnswer struct { // every orphan Entries []Held `json:"entries"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // CreateInput is what create takes. @@ -378,6 +402,8 @@ type DropInput = Warranted type DropAnswer struct { // it is gone Dropped bool `json:"dropped"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the snapshot taken first Snapshot string `json:"snapshot,omitempty"` } @@ -400,6 +426,8 @@ type SnapshotGetAnswer struct { Digest string `json:"digest,omitempty"` // why not: snapshot damaged, snapshot missing, snapshot protected or snapshot taken before milestone G; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the entry's local name Local string `json:"local,omitempty"` Module string `json:"module,omitempty"` @@ -427,6 +455,8 @@ type SnapshotRestoreAnswer struct { Busy string `json:"busy,omitempty"` // why not; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // SnapshotRestoreCancelInput is what snapshot-restore-cancel takes. @@ -445,6 +475,8 @@ type SnapshotRestoreCancelAnswer struct { Busy string `json:"busy,omitempty"` // why not; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // SnapshotRemoveInput is what snapshot-remove takes. @@ -465,6 +497,8 @@ type SnapshotRemoveAnswer struct { Busy string `json:"busy,omitempty"` // why not; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // CreatedEvent is the body of the event created. @@ -498,7 +532,9 @@ type DroppedEvent = Said type SnapshotRestoredEvent struct { Act string `json:"act"` // when failed - Error string `json:"error,omitempty"` + Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Outcome string `json:"outcome"` Request string `json:"request"` } @@ -511,3 +547,212 @@ const ( // BusStateForm is the form of the provision bus-state. type BusStateForm = Binding + +// DecodeListAnswer reads a ListAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeListAnswer(raw []byte) (ListAnswer, int, error) { + var v ListAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeShowAnswer reads a ShowAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeShowAnswer(raw []byte) (ShowAnswer, int, error) { + var v ShowAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeCheckAnswer reads a CheckAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCheckAnswer(raw []byte) (CheckAnswer, int, error) { + var v CheckAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeOrphansAnswer reads a OrphansAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeOrphansAnswer(raw []byte) (OrphansAnswer, int, error) { + var v OrphansAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeCreateAnswer reads a CreateAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCreateAnswer(raw []byte) (CreateAnswer, int, error) { + var v CreateAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeApplyAnswer reads a ApplyAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeApplyAnswer(raw []byte) (ApplyAnswer, int, error) { + var v ApplyAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRecreateAnswer reads a RecreateAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRecreateAnswer(raw []byte) (RecreateAnswer, int, error) { + var v RecreateAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDropAnswer reads a DropAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDropAnswer(raw []byte) (DropAnswer, int, error) { + var v DropAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSnapshotGetAnswer reads a SnapshotGetAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSnapshotGetAnswer(raw []byte) (SnapshotGetAnswer, int, error) { + var v SnapshotGetAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSnapshotRestoreAnswer reads a SnapshotRestoreAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSnapshotRestoreAnswer(raw []byte) (SnapshotRestoreAnswer, int, error) { + var v SnapshotRestoreAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSnapshotRestoreCancelAnswer reads a SnapshotRestoreCancelAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSnapshotRestoreCancelAnswer(raw []byte) (SnapshotRestoreCancelAnswer, int, error) { + var v SnapshotRestoreCancelAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSnapshotRemoveAnswer reads a SnapshotRemoveAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSnapshotRemoveAnswer(raw []byte) (SnapshotRemoveAnswer, int, error) { + var v SnapshotRemoveAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeCreatedEvent reads a CreatedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCreatedEvent(raw []byte) (CreatedEvent, int, error) { + var v CreatedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRefusedEvent reads a RefusedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRefusedEvent(raw []byte) (RefusedEvent, int, error) { + var v RefusedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDriftedEvent reads a DriftedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDriftedEvent(raw []byte) (DriftedEvent, int, error) { + var v DriftedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDriftClearedEvent reads a DriftClearedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDriftClearedEvent(raw []byte) (DriftClearedEvent, int, error) { + var v DriftClearedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeFullEvent reads a FullEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFullEvent(raw []byte) (FullEvent, int, error) { + var v FullEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeFullClearedEvent reads a FullClearedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFullClearedEvent(raw []byte) (FullClearedEvent, int, error) { + var v FullClearedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeOrphanedEvent reads a OrphanedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeOrphanedEvent(raw []byte) (OrphanedEvent, int, error) { + var v OrphanedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRecreatedEvent reads a RecreatedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRecreatedEvent(raw []byte) (RecreatedEvent, int, error) { + var v RecreatedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDroppedEvent reads a DroppedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDroppedEvent(raw []byte) (DroppedEvent, int, error) { + var v DroppedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSnapshotRestoredEvent reads a SnapshotRestoredEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSnapshotRestoredEvent(raw []byte) (SnapshotRestoredEvent, int, error) { + var v SnapshotRestoredEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/go/seats/meshconfig/contract.go b/go/seats/meshconfig/contract.go index 3c126d1..7ea02fe 100644 --- a/go/seats/meshconfig/contract.go +++ b/go/seats/meshconfig/contract.go @@ -4,15 +4,24 @@ package meshconfig import ( - "bytes" "encoding/json" - "errors" "strings" ) // Seat is the seat's name. const Seat = "mesh-config" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "bb4b161b9473b00406c9f007cac28b4631fb96c4c1b16609f97b269d3e0cdae1" +) + const ( VerbConfig = "config" VerbRenames = "renames" @@ -78,18 +87,13 @@ func ParseResolvedByNodeModuleKeyKey(key string) (string, string, string, bool) return v0, v2, v4, true } -// DecodeResolvedByNodeModuleKeyValue reads one value of the state resolved under the form "..", refusing a field ResolvedByNodeModuleKeyValue does not know and any text after the value. -func DecodeResolvedByNodeModuleKeyValue(raw []byte) (ResolvedByNodeModuleKeyValue, error) { +// DecodeResolvedByNodeModuleKeyValue reads one value of the state resolved under the form ".." as another part wrote it: a field ResolvedByNodeModuleKeyValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeResolvedByNodeModuleKeyValue(raw []byte) (ResolvedByNodeModuleKeyValue, int, error) { var v ResolvedByNodeModuleKeyValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // ConfigInput is what config takes. @@ -137,6 +141,8 @@ type RenamesAnswerRenamesItem struct { // RenamesAnswer is what renames answers. type RenamesAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // every open rename Renames []RenamesAnswerRenamesItem `json:"renames"` } @@ -145,6 +151,8 @@ type RenamesAnswer struct { type RenamedHolderEvent struct { // when, RFC 3339 At string `json:"at"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the old name From string `json:"from"` // the module @@ -157,6 +165,8 @@ type RenamedHolderEvent struct { type RetiringHolderEvent struct { // the ask's id Ask string `json:"ask,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the value's or secret's name Key string `json:"key"` Kind string `json:"kind"` @@ -176,6 +186,8 @@ const ( type RetiredHolderEvent struct { // the ask's id Ask string `json:"ask,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the module Module string `json:"module"` // the name @@ -186,6 +198,8 @@ type RetiredHolderEvent struct { // ResolvedByNodeModuleKeyValue is one value of the state resolved under the key ... type ResolvedByNodeModuleKeyValue struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Key string `json:"key"` Module string `json:"module"` Node string `json:"node"` @@ -197,3 +211,59 @@ type ResolvedByNodeModuleKeyValue struct { Trusted bool `json:"trusted,omitempty"` Value any `json:"value,omitempty"` } + +// DecodeConfigAnswer reads a ConfigAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConfigAnswer(raw []byte) (ConfigAnswer, int, error) { + var v ConfigAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRenamesAnswer reads a RenamesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRenamesAnswer(raw []byte) (RenamesAnswer, int, error) { + var v RenamesAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRenamedHolderEvent reads a RenamedHolderEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRenamedHolderEvent(raw []byte) (RenamedHolderEvent, int, error) { + var v RenamedHolderEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRetiringHolderEvent reads a RetiringHolderEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRetiringHolderEvent(raw []byte) (RetiringHolderEvent, int, error) { + var v RetiringHolderEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRetiredHolderEvent reads a RetiredHolderEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRetiredHolderEvent(raw []byte) (RetiredHolderEvent, int, error) { + var v RetiredHolderEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/go/seats/meshmoduleassigner/contract.go b/go/seats/meshmoduleassigner/contract.go index 5a4e6c1..1860da1 100644 --- a/go/seats/meshmoduleassigner/contract.go +++ b/go/seats/meshmoduleassigner/contract.go @@ -4,9 +4,7 @@ package meshmoduleassigner import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "mesh-module-assigner" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "f21389d1d8b60132bbc05b35395261c01260b7f09f20428722ecb6f888875640" +) + const ( VerbAssignments = "assignments" VerbProposals = "proposals" @@ -83,18 +92,13 @@ func ParseAssignmentsByNodeNodeKey(key string) (string, bool) { return v0, true } -// DecodeAssignmentsByNodeNodeValue reads one value of the state assignments under the form ".node", refusing a field AssignmentsByNodeNodeValue does not know and any text after the value. -func DecodeAssignmentsByNodeNodeValue(raw []byte) (AssignmentsByNodeNodeValue, error) { +// DecodeAssignmentsByNodeNodeValue reads one value of the state assignments under the form ".node" as another part wrote it: a field AssignmentsByNodeNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAssignmentsByNodeNodeValue(raw []byte) (AssignmentsByNodeNodeValue, int, error) { var v AssignmentsByNodeNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // AssignmentsByNodeModuleKey is the key of one value of the state assignments under the form ".". @@ -119,18 +123,13 @@ func ParseAssignmentsByNodeModuleKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeAssignmentsByNodeModuleValue reads one value of the state assignments under the form ".", refusing a field AssignmentsByNodeModuleValue does not know and any text after the value. -func DecodeAssignmentsByNodeModuleValue(raw []byte) (AssignmentsByNodeModuleValue, error) { +// DecodeAssignmentsByNodeModuleValue reads one value of the state assignments under the form "." as another part wrote it: a field AssignmentsByNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAssignmentsByNodeModuleValue(raw []byte) (AssignmentsByNodeModuleValue, int, error) { var v AssignmentsByNodeModuleValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // ProposalsByProposalKey is the key of one value of the state proposals under the form "". @@ -150,18 +149,13 @@ func ParseProposalsByProposalKey(key string) (string, bool) { return v0, true } -// DecodeProposalsByProposalValue reads one value of the state proposals under the form "", refusing a field ProposalsByProposalValue does not know and any text after the value. -func DecodeProposalsByProposalValue(raw []byte) (ProposalsByProposalValue, error) { +// DecodeProposalsByProposalValue reads one value of the state proposals under the form "" as another part wrote it: a field ProposalsByProposalValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProposalsByProposalValue(raw []byte) (ProposalsByProposalValue, int, error) { var v ProposalsByProposalValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // CandidatesByProposalNodeKey is the key of one value of the state candidates under the form ".". @@ -186,18 +180,13 @@ func ParseCandidatesByProposalNodeKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeCandidatesByProposalNodeValue reads one value of the state candidates under the form ".", refusing a field CandidatesByProposalNodeValue does not know and any text after the value. -func DecodeCandidatesByProposalNodeValue(raw []byte) (CandidatesByProposalNodeValue, error) { +// DecodeCandidatesByProposalNodeValue reads one value of the state candidates under the form "." as another part wrote it: a field CandidatesByProposalNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCandidatesByProposalNodeValue(raw []byte) (CandidatesByProposalNodeValue, int, error) { var v CandidatesByProposalNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // PulsesByAnswerProposalNodeKey is the key of one value of the state pulses under the form "answer..". @@ -228,18 +217,13 @@ func ParsePulsesByAnswerProposalNodeKey(key string) (string, string, bool) { return v1, v3, true } -// DecodePulsesByAnswerProposalNodeValue reads one value of the state pulses under the form "answer..", refusing a field PulsesByAnswerProposalNodeValue does not know and any text after the value. -func DecodePulsesByAnswerProposalNodeValue(raw []byte) (PulsesByAnswerProposalNodeValue, error) { +// DecodePulsesByAnswerProposalNodeValue reads one value of the state pulses under the form "answer.." as another part wrote it: a field PulsesByAnswerProposalNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePulsesByAnswerProposalNodeValue(raw []byte) (PulsesByAnswerProposalNodeValue, int, error) { var v PulsesByAnswerProposalNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // PulsesByAskProposalKey is the key of one value of the state pulses under the form "ask.". @@ -263,18 +247,13 @@ func ParsePulsesByAskProposalKey(key string) (string, bool) { return v1, true } -// DecodePulsesByAskProposalValue reads one value of the state pulses under the form "ask.", refusing a field PulsesByAskProposalValue does not know and any text after the value. -func DecodePulsesByAskProposalValue(raw []byte) (PulsesByAskProposalValue, error) { +// DecodePulsesByAskProposalValue reads one value of the state pulses under the form "ask." as another part wrote it: a field PulsesByAskProposalValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePulsesByAskProposalValue(raw []byte) (PulsesByAskProposalValue, int, error) { var v PulsesByAskProposalValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // SeatHoldersBySeatKey is the key of one value of the state seat-holders under the form "". @@ -294,18 +273,13 @@ func ParseSeatHoldersBySeatKey(key string) (string, bool) { return v0, true } -// DecodeSeatHoldersBySeatValue reads one value of the state seat-holders under the form "", refusing a field SeatHoldersBySeatValue does not know and any text after the value. -func DecodeSeatHoldersBySeatValue(raw []byte) (SeatHoldersBySeatValue, error) { +// DecodeSeatHoldersBySeatValue reads one value of the state seat-holders under the form "" as another part wrote it: a field SeatHoldersBySeatValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSeatHoldersBySeatValue(raw []byte) (SeatHoldersBySeatValue, int, error) { var v SeatHoldersBySeatValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // SeatHoldersBySeatNodeKey is the key of one value of the state seat-holders under the form ".". @@ -330,18 +304,13 @@ func ParseSeatHoldersBySeatNodeKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeSeatHoldersBySeatNodeValue reads one value of the state seat-holders under the form ".", refusing a field SeatHoldersBySeatNodeValue does not know and any text after the value. -func DecodeSeatHoldersBySeatNodeValue(raw []byte) (SeatHoldersBySeatNodeValue, error) { +// DecodeSeatHoldersBySeatNodeValue reads one value of the state seat-holders under the form "." as another part wrote it: a field SeatHoldersBySeatNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSeatHoldersBySeatNodeValue(raw []byte) (SeatHoldersBySeatNodeValue, int, error) { var v SeatHoldersBySeatNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // AddedModule is what the want a candidate would write for a module carries of its build, in the want's own forms (the seat mesh-wants' state wants: `version` and `parts`; copied here because a seat definition cannot reuse another repository's seat's forms, design 47 G A-316). @@ -375,6 +344,8 @@ type AssignmentsEventWarrant struct { type AssignmentsEvent struct { // for assignments-withdrawn, why it ended Ended string `json:"ended,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // for assignments-changed, by node the revisions before and after and the modules added, removed or changed Nodes []map[string]any `json:"nodes,omitempty"` Proposal Proposal `json:"proposal"` @@ -470,10 +441,12 @@ type Proposal struct { By string `json:"by"` Changes []ProposalChange `json:"changes"` ExportDigest string `json:"export-digest,omitempty"` - HandBack bool `json:"hand-back,omitempty"` - ID string `json:"id"` - Must []string `json:"must,omitempty"` - Seed bool `json:"seed,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + HandBack bool `json:"hand-back,omitempty"` + ID string `json:"id"` + Must []string `json:"must,omitempty"` + Seed bool `json:"seed,omitempty"` // answering, failed or asked State string `json:"state"` V int64 `json:"v,omitempty"` @@ -539,6 +512,8 @@ type SeatHoldersHoldersItem struct { // SeatHolders is one key of seat-holders. type SeatHolders struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Holders []SeatHoldersHoldersItem `json:"holders"` Node string `json:"node,omitempty"` // the claim names no seat of the seat list @@ -649,6 +624,8 @@ type PlacementInput struct { // PlacementAnswer is what placement answers. type PlacementAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // one per branch and build, the nodes that run the module from it Placements []ModulePlacement `json:"placements"` } @@ -675,7 +652,9 @@ type AssignmentsByNodeNodeValueModulesItem struct { // AssignmentsByNodeNodeValue is one value of the state assignments under the key .node. type AssignmentsByNodeNodeValue struct { Decided NodeDecided `json:"decided"` - Holds []Holding `json:"holds,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Holds []Holding `json:"holds,omitempty"` // the modules placed, in the order the composition reads them Modules []AssignmentsByNodeNodeValueModulesItem `json:"modules"` Node string `json:"node"` @@ -685,6 +664,8 @@ type AssignmentsByNodeNodeValue struct { // AssignmentsByNodeModuleValue is one value of the state assignments under the key .. type AssignmentsByNodeModuleValue struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Node string `json:"node"` Placed PlacedModule `json:"placed"` // the value it replaces while a write is under way @@ -701,7 +682,9 @@ type CandidatesByProposalNodeValue struct { Added map[string]AddedModule `json:"added,omitempty"` // the node's assignments with the proposal laid over it; absent when the proposal takes its key away Assignments *Assignments `json:"assignments,omitempty"` - Proposal string `json:"proposal"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Proposal string `json:"proposal"` // the proposal changes this node's composition through another's key Reached bool `json:"reached,omitempty"` V int64 `json:"v,omitempty"` @@ -709,12 +692,16 @@ type CandidatesByProposalNodeValue struct { // PulsesByAnswerProposalNodeValue is one value of the state pulses under the key answer... type PulsesByAnswerProposalNodeValue struct { - V int64 `json:"v,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + V int64 `json:"v,omitempty"` } // PulsesByAskProposalValue is one value of the state pulses under the key ask.. type PulsesByAskProposalValue struct { - V int64 `json:"v,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + V int64 `json:"v,omitempty"` } // SeatHoldersBySeatValue is one value of the state seat-holders under the key . @@ -722,3 +709,104 @@ type SeatHoldersBySeatValue = SeatHolders // SeatHoldersBySeatNodeValue is one value of the state seat-holders under the key .. type SeatHoldersBySeatNodeValue = SeatHolders + +// DecodeAssignmentsAnswer reads a AssignmentsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAssignmentsAnswer(raw []byte) (AssignmentsAnswer, int, error) { + var v AssignmentsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeProposalsAnswer reads a ProposalsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProposalsAnswer(raw []byte) (ProposalsAnswer, int, error) { + var v ProposalsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeProposeAnswer reads a ProposeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProposeAnswer(raw []byte) (ProposeAnswer, int, error) { + var v ProposeAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeWithdrawAnswer reads a WithdrawAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWithdrawAnswer(raw []byte) (WithdrawAnswer, int, error) { + var v WithdrawAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAgainAnswer reads a AgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAgainAnswer(raw []byte) (AgainAnswer, int, error) { + var v AgainAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodePlacementAnswer reads a PlacementAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePlacementAnswer(raw []byte) (PlacementAnswer, int, error) { + var v PlacementAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAssignmentsProposedEvent reads a AssignmentsProposedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAssignmentsProposedEvent(raw []byte) (AssignmentsProposedEvent, int, error) { + var v AssignmentsProposedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAssignmentsWithdrawnEvent reads a AssignmentsWithdrawnEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAssignmentsWithdrawnEvent(raw []byte) (AssignmentsWithdrawnEvent, int, error) { + var v AssignmentsWithdrawnEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAssignmentsJudgedEvent reads a AssignmentsJudgedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAssignmentsJudgedEvent(raw []byte) (AssignmentsJudgedEvent, int, error) { + var v AssignmentsJudgedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAssignmentsChangedEvent reads a AssignmentsChangedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAssignmentsChangedEvent(raw []byte) (AssignmentsChangedEvent, int, error) { + var v AssignmentsChangedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/go/seats/meshrecovery/contract.go b/go/seats/meshrecovery/contract.go index e028a54..f7ad0b1 100644 --- a/go/seats/meshrecovery/contract.go +++ b/go/seats/meshrecovery/contract.go @@ -3,11 +3,25 @@ // Package meshrecovery is the contract of the seat "mesh-recovery", defined whole (seats/mesh-recovery/seat.json): Takes, sets aside and restores a module's kept data on the live bus, each act in the hand-act log (design 47 G 554). Its verbs answer at once and the result is the event. package meshrecovery -import "time" +import ( + "encoding/json" + "time" +) // Seat is the seat's name. const Seat = "mesh-recovery" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "855ed5958d0dac251a91148faf0c58ad9dbfa3e86d86aef6c847b8c5de001e81" +) + const ( VerbSnapshotKept = "snapshot-kept" VerbRestoreKept = "restore-kept" @@ -205,6 +219,8 @@ type SnapshotKeptAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // RestoreKeptInput is what restore-kept takes. @@ -233,6 +249,8 @@ type RestoreKeptAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // KeptPointsInput is what kept-points takes. @@ -245,7 +263,9 @@ type KeptPointsInput struct { // KeptPointsAnswer is what kept-points answers. type KeptPointsAnswer struct { - Asides []Aside `json:"asides"` + Asides []Aside `json:"asides"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Points []Point `json:"points"` Running *Running `json:"running,omitempty"` // the asides whose record ended at removed that no running act holds: the live data of those names is gone and only the aside holds it; the module's health check fails while one is listed (design 47 G 554, 657, A-129) @@ -274,6 +294,8 @@ type RestoreAsideAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // CancelInput is what cancel takes. @@ -294,6 +316,8 @@ type CancelAnswer struct { Busy string `json:"busy,omitempty"` // why not, naming the step an act has begun; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // TakeInput is what take takes. @@ -318,6 +342,8 @@ type TakeAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // RestoreInput is what restore takes. @@ -346,6 +372,8 @@ type RestoreAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // RetryInput is what retry takes. @@ -368,6 +396,8 @@ type RetryAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // AsideInput is what aside takes. @@ -390,6 +420,8 @@ type AsideAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // DiscardAsideInput is what discard-aside takes. @@ -414,6 +446,8 @@ type DiscardAsideAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // ExpirePointsInput is what expire-points takes. @@ -432,6 +466,8 @@ type ExpirePointsAnswer struct { Busy string `json:"busy,omitempty"` // why it was not taken; set alone Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` } // EndedEvent is the body of the event ended. @@ -509,7 +545,9 @@ type SetAsideEvent struct { Act string `json:"act"` // when it was said, RFC 3339 At time.Time `json:"at"` - ID string `json:"id"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + ID string `json:"id"` // the bus names it was live under, one per bus object Names []string `json:"names"` Size int64 `json:"size"` @@ -521,7 +559,9 @@ type AsideDiscardedEvent struct { Act string `json:"act"` // when it was said, RFC 3339 At time.Time `json:"at"` - ID string `json:"id"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + ID string `json:"id"` // the bus names it was live under, one per bus object Names []string `json:"names"` Size int64 `json:"size"` @@ -546,6 +586,181 @@ type ExpiryEndedEvent struct { Act string `json:"act"` // when it was said, RFC 3339 At time.Time `json:"at"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the number of points the run removed, 0 included Removed int64 `json:"removed"` } + +// DecodeSnapshotKeptAnswer reads a SnapshotKeptAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSnapshotKeptAnswer(raw []byte) (SnapshotKeptAnswer, int, error) { + var v SnapshotKeptAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRestoreKeptAnswer reads a RestoreKeptAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRestoreKeptAnswer(raw []byte) (RestoreKeptAnswer, int, error) { + var v RestoreKeptAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeKeptPointsAnswer reads a KeptPointsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeKeptPointsAnswer(raw []byte) (KeptPointsAnswer, int, error) { + var v KeptPointsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRestoreAsideAnswer reads a RestoreAsideAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRestoreAsideAnswer(raw []byte) (RestoreAsideAnswer, int, error) { + var v RestoreAsideAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeCancelAnswer reads a CancelAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCancelAnswer(raw []byte) (CancelAnswer, int, error) { + var v CancelAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeTakeAnswer reads a TakeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeTakeAnswer(raw []byte) (TakeAnswer, int, error) { + var v TakeAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRestoreAnswer reads a RestoreAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRestoreAnswer(raw []byte) (RestoreAnswer, int, error) { + var v RestoreAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRetryAnswer reads a RetryAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRetryAnswer(raw []byte) (RetryAnswer, int, error) { + var v RetryAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAsideAnswer reads a AsideAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAsideAnswer(raw []byte) (AsideAnswer, int, error) { + var v AsideAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDiscardAsideAnswer reads a DiscardAsideAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDiscardAsideAnswer(raw []byte) (DiscardAsideAnswer, int, error) { + var v DiscardAsideAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeExpirePointsAnswer reads a ExpirePointsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeExpirePointsAnswer(raw []byte) (ExpirePointsAnswer, int, error) { + var v ExpirePointsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeEndedEvent reads a EndedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEndedEvent(raw []byte) (EndedEvent, int, error) { + var v EndedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRestoreStartedEvent reads a RestoreStartedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRestoreStartedEvent(raw []byte) (RestoreStartedEvent, int, error) { + var v RestoreStartedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRestoredEvent reads a RestoredEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRestoredEvent(raw []byte) (RestoredEvent, int, error) { + var v RestoredEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSetAsideEvent reads a SetAsideEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSetAsideEvent(raw []byte) (SetAsideEvent, int, error) { + var v SetAsideEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAsideDiscardedEvent reads a AsideDiscardedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAsideDiscardedEvent(raw []byte) (AsideDiscardedEvent, int, error) { + var v AsideDiscardedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodePointRemovedEvent reads a PointRemovedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePointRemovedEvent(raw []byte) (PointRemovedEvent, int, error) { + var v PointRemovedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeExpiryEndedEvent reads a ExpiryEndedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeExpiryEndedEvent(raw []byte) (ExpiryEndedEvent, int, error) { + var v ExpiryEndedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index 2be3506..c853eec 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -4,9 +4,7 @@ package nodeengine import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "node-engine" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "7aedbf50b5318425acb9a4ff0bcb65ab61b3e9276585934936cd2498a7117107" +) + const ( VerbHandOver = "hand-over" VerbAccessAct = "access-act" @@ -149,18 +158,13 @@ func ParseHaveByNodeModuleKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeHaveByNodeModuleValue reads one value of the state have under the form ".", refusing a field HaveByNodeModuleValue does not know and any text after the value. -func DecodeHaveByNodeModuleValue(raw []byte) (HaveByNodeModuleValue, error) { +// DecodeHaveByNodeModuleValue reads one value of the state have under the form "." as another part wrote it: a field HaveByNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHaveByNodeModuleValue(raw []byte) (HaveByNodeModuleValue, int, error) { var v HaveByNodeModuleValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // HaveByNodeNodeKey is the key of one value of the state have under the form ".node". @@ -180,18 +184,13 @@ func ParseHaveByNodeNodeKey(key string) (string, bool) { return v0, true } -// DecodeHaveByNodeNodeValue reads one value of the state have under the form ".node", refusing a field HaveByNodeNodeValue does not know and any text after the value. -func DecodeHaveByNodeNodeValue(raw []byte) (HaveByNodeNodeValue, error) { +// DecodeHaveByNodeNodeValue reads one value of the state have under the form ".node" as another part wrote it: a field HaveByNodeNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHaveByNodeNodeValue(raw []byte) (HaveByNodeNodeValue, int, error) { var v HaveByNodeNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // ComposedByNodeModuleFingerprintKey is the key of one value of the state composed under the form "..". @@ -223,18 +222,13 @@ func ParseComposedByNodeModuleFingerprintKey(key string) (string, string, string return v0, v2, v4, true } -// DecodeComposedByNodeModuleFingerprintValue reads one value of the state composed under the form "..", refusing a field ComposedByNodeModuleFingerprintValue does not know and any text after the value. -func DecodeComposedByNodeModuleFingerprintValue(raw []byte) (ComposedByNodeModuleFingerprintValue, error) { +// DecodeComposedByNodeModuleFingerprintValue reads one value of the state composed under the form ".." as another part wrote it: a field ComposedByNodeModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeComposedByNodeModuleFingerprintValue(raw []byte) (ComposedByNodeModuleFingerprintValue, int, error) { var v ComposedByNodeModuleFingerprintValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // ComposedByNodeNodeKey is the key of one value of the state composed under the form ".node". @@ -254,18 +248,13 @@ func ParseComposedByNodeNodeKey(key string) (string, bool) { return v0, true } -// DecodeComposedByNodeNodeValue reads one value of the state composed under the form ".node", refusing a field ComposedByNodeNodeValue does not know and any text after the value. -func DecodeComposedByNodeNodeValue(raw []byte) (ComposedByNodeNodeValue, error) { +// DecodeComposedByNodeNodeValue reads one value of the state composed under the form ".node" as another part wrote it: a field ComposedByNodeNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeComposedByNodeNodeValue(raw []byte) (ComposedByNodeNodeValue, int, error) { var v ComposedByNodeNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // DataByNodeModuleKey is the key of one value of the state data under the form ".". @@ -290,18 +279,13 @@ func ParseDataByNodeModuleKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeDataByNodeModuleValue reads one value of the state data under the form ".", refusing a field DataByNodeModuleValue does not know and any text after the value. -func DecodeDataByNodeModuleValue(raw []byte) (DataByNodeModuleValue, error) { +// DecodeDataByNodeModuleValue reads one value of the state data under the form "." as another part wrote it: a field DataByNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDataByNodeModuleValue(raw []byte) (DataByNodeModuleValue, int, error) { var v DataByNodeModuleValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // PackagesByNodeKey is the key of one value of the state packages under the form "". @@ -321,18 +305,13 @@ func ParsePackagesByNodeKey(key string) (string, bool) { return v0, true } -// DecodePackagesByNodeValue reads one value of the state packages under the form "", refusing a field PackagesByNodeValue does not know and any text after the value. -func DecodePackagesByNodeValue(raw []byte) (PackagesByNodeValue, error) { +// DecodePackagesByNodeValue reads one value of the state packages under the form "" as another part wrote it: a field PackagesByNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePackagesByNodeValue(raw []byte) (PackagesByNodeValue, int, error) { var v PackagesByNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // HealthByNodeKey is the key of one value of the state health under the form "". @@ -352,18 +331,13 @@ func ParseHealthByNodeKey(key string) (string, bool) { return v0, true } -// DecodeHealthByNodeValue reads one value of the state health under the form "", refusing a field HealthByNodeValue does not know and any text after the value. -func DecodeHealthByNodeValue(raw []byte) (HealthByNodeValue, error) { +// DecodeHealthByNodeValue reads one value of the state health under the form "" as another part wrote it: a field HealthByNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHealthByNodeValue(raw []byte) (HealthByNodeValue, int, error) { var v HealthByNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // FindingsByKeyKey is the key of one value of the state findings under the form "". @@ -383,18 +357,13 @@ func ParseFindingsByKeyKey(key string) (string, bool) { return v0, true } -// DecodeFindingsByKeyValue reads one value of the state findings under the form "", refusing a field FindingsByKeyValue does not know and any text after the value. -func DecodeFindingsByKeyValue(raw []byte) (FindingsByKeyValue, error) { +// DecodeFindingsByKeyValue reads one value of the state findings under the form "" as another part wrote it: a field FindingsByKeyValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFindingsByKeyValue(raw []byte) (FindingsByKeyValue, int, error) { var v FindingsByKeyValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // BoundsByWhatIDKey is the key of one value of the state bounds under the form ".". @@ -419,18 +388,13 @@ func ParseBoundsByWhatIDKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeBoundsByWhatIDValue reads one value of the state bounds under the form ".", refusing a field BoundsByWhatIDValue does not know and any text after the value. -func DecodeBoundsByWhatIDValue(raw []byte) (BoundsByWhatIDValue, error) { +// DecodeBoundsByWhatIDValue reads one value of the state bounds under the form "." as another part wrote it: a field BoundsByWhatIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeBoundsByWhatIDValue(raw []byte) (BoundsByWhatIDValue, int, error) { var v BoundsByWhatIDValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // AccountsHanded is the hashes of the users of the list, sealed to the vault. @@ -500,6 +464,8 @@ type ActSaid struct { Ask string `json:"ask,omitempty"` // the caller as the runtime proved it Caller string `json:"caller"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node whose engine says it Node string `json:"node"` // what the engine said of it @@ -521,6 +487,8 @@ const ( type Acts struct { // the acts, newest first Acts []Act `json:"acts"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node Node string `json:"node"` } @@ -537,6 +505,8 @@ type Adoption struct { type Asked struct { // the ask's id: acts shows where it stands Asked string `json:"asked"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node Node string `json:"node"` // what happens next, in words @@ -618,6 +588,8 @@ type Composed struct { Digest string `json:"digest"` // the fingerprint of the want composed Fingerprint string `json:"fingerprint"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the module Module string `json:"module"` // the node @@ -740,6 +712,8 @@ const ( type ManifestReadsChanged struct { // when it says it, RFC 3339 At string `json:"at"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // what its engine states it reads now ManifestReads []string `json:"manifest-reads,omitempty"` // the node @@ -903,6 +877,8 @@ const ( type ProcessBuilds struct { // why they could not be read Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node Node string `json:"node"` // every process the node-engine started, by module @@ -969,6 +945,8 @@ type Running struct { At time.Time `json:"at"` // the fingerprint of the build it runs; none with stopped Fingerprint string `json:"fingerprint,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the health of the build that runs, as the node-engine's have holds it from the module's declared check (ADR 0240); a running with none, said by a node-engine of before design 47 G, reads as healthy (design 47 G 520). SeatsToPassOn reads none of it: an unhealthy holder still holds its seat Healthy *bool `json:"healthy,omitempty"` // the digest of that build's manifest, the indexer's manifest of it, read by digest from the catalog half @@ -985,6 +963,8 @@ type Running struct { // Said is the answer of a read-only judgement. type Said struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node Node string `json:"node"` // the engine's judgement or search, one line per directory or program @@ -1017,6 +997,8 @@ type SeatListStatus struct { type SeatList struct { // why the read failed, for seat-list-again Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the one line the engine says of it; empty when nothing waits Health string `json:"health"` Status SeatListStatus `json:"status"` @@ -1077,6 +1059,8 @@ type Wait struct { Bound string `json:"bound,omitempty"` // the time the bound counts from (design 47 G 266, 269, 498) ClockFrom *time.Time `json:"clock-from,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node waited on: the build node for a kept build; the subject's is the node that says it Node string `json:"node,omitempty"` // what it waits on @@ -1145,6 +1129,8 @@ type RootFreeInput struct { // RootFreeAnswer is what root-free answers. type RootFreeAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // this machine's verdict Machines []RootVerdict `json:"machines"` } @@ -1192,6 +1178,8 @@ type PackagesAnswerKey struct { // PackagesAnswer is what packages answers. type PackagesAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node's key as the bus holds it; absent when the engine wrote none Key *PackagesAnswerKey `json:"key,omitempty"` // why the key could not be read @@ -1333,6 +1321,8 @@ type CompositionAnswer struct { Composition Revision `json:"composition"` // every resource that differs from what runs, when asked Diff []map[string]any `json:"diff,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // what the module's have key says now; absent when it says nothing Have *CompositionAnswerHave `json:"have,omitempty"` // the move from what runs to the composition read @@ -1371,6 +1361,8 @@ type CompositionDiffInput struct { // CompositionDiffAnswer is what composition-diff answers. type CompositionDiffAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the module Module string `json:"module"` // the node @@ -1406,6 +1398,8 @@ type ComposeAnswerPass struct { // ComposeAnswer is what compose answers. type ComposeAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // how the pass went Pass ComposeAnswerPass `json:"pass"` // the module whose apply was tried again @@ -1428,6 +1422,8 @@ type ComposeCandidateAnswer struct { Candidate string `json:"candidate"` // when asked with input and a call token: how many chunks of at most 512 KiB carry the composition input, sent on the chunk subject of the call, each acknowledged by the caller (design 47 G A-237b) Chunks int64 `json:"chunks,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // when asked without a call token: the composition input it composed from, inline, up to what one answer carries (the checker's form, kept until G removes the checker, G-6 section 321) Input map[string]any `json:"input,omitempty"` // every module placed on the node, sorted by name @@ -1459,6 +1455,8 @@ type ManifestReadsInput struct { // ManifestReadsAnswer is what manifest-reads answers. type ManifestReadsAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the reader capabilities its engine states: the manifest words, forms and seat names it reads; empty for an engine built before it said them, read as the baseline ManifestReads []string `json:"manifest-reads,omitempty"` // the node @@ -1491,6 +1489,8 @@ type ApplyOrderAnswerOrderItem struct { // ApplyOrderAnswer is what apply-order answers. type ApplyOrderAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // one row per unapplied changed want, in the order it will be applied Order []ApplyOrderAnswerOrderItem `json:"order"` } @@ -1546,6 +1546,8 @@ type FirstViewsAnswer struct { Entries []FirstViewsAnswerEntriesItem `json:"entries"` // one status per owner and state followed, as mesh-sdk's views runtime keeps it FirstViews []map[string]any `json:"first-views"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the wants the node-engine keeps (design 47 G 683, 698) Wants []FirstViewsAnswerWantsItem `json:"wants"` } @@ -1580,6 +1582,8 @@ type FirstViewAgainAnswerAsked struct { type FirstViewAgainAnswer struct { // the hand ask written Asked FirstViewAgainAnswerAsked `json:"asked"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the verb that reads the status, first-views Read string `json:"read"` } @@ -1610,6 +1614,8 @@ type EntryAgainAnswerAsked struct { type EntryAgainAnswer struct { // the hand ask written Asked EntryAgainAnswerAsked `json:"asked"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the verb that reads the status, first-views Read string `json:"read"` } @@ -1629,6 +1635,8 @@ type ConvergedInput struct { // ConvergedAnswer is what converged answers. type ConvergedAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the kind of the firewall found, for an adopted node Found string `json:"found,omitempty"` // the links of this node that face outside, as the engine classifies them for its filter render (ADR 0140); an allowance with no interface never opens one @@ -1679,6 +1687,8 @@ type HaveByNodeModuleValue struct { // the digest of the composition the node runs Composed string `json:"composed,omitempty"` Detail string `json:"detail,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the fingerprint held Fp string `json:"fp,omitempty"` Handed *AccountsHanded `json:"handed,omitempty"` @@ -1737,16 +1747,18 @@ type HaveByNodeNodeValue struct { // the digest of the node's own composition it runs Composed string `json:"composed,omitempty"` // own, or none (empty) - Composes string `json:"composes,omitempty"` - ComposesWhy string `json:"composes-why,omitempty"` - Filters []map[string]any `json:"filters,omitempty"` - Profile map[string]any `json:"profile,omitempty"` - Record *NodeRecord `json:"record,omitempty"` - Sealed []string `json:"sealed,omitempty"` - SealedAt map[string]string `json:"sealed-at,omitempty"` - Strays []map[string]any `json:"strays,omitempty"` - V int64 `json:"v"` - Windows []map[string]any `json:"windows,omitempty"` + Composes string `json:"composes,omitempty"` + ComposesWhy string `json:"composes-why,omitempty"` + Filters []map[string]any `json:"filters,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Profile map[string]any `json:"profile,omitempty"` + Record *NodeRecord `json:"record,omitempty"` + Sealed []string `json:"sealed,omitempty"` + SealedAt map[string]string `json:"sealed-at,omitempty"` + Strays []map[string]any `json:"strays,omitempty"` + V int64 `json:"v"` + Windows []map[string]any `json:"windows,omitempty"` } // ComposedByNodeModuleFingerprintValue is one value of the state composed under the key ... @@ -1755,9 +1767,11 @@ type ComposedByNodeModuleFingerprintValue struct { Data bool `json:"data,omitempty"` // the files the provisioner fills FilledFiles []string `json:"filled_files,omitempty"` - Fp string `json:"fp"` - Module string `json:"module"` - Node string `json:"node"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Fp string `json:"fp"` + Module string `json:"module"` + Node string `json:"node"` // the module's whole provisioning plan, catalogue.Plan, kept whole: it is the manifest layer's type Plan map[string]any `json:"plan,omitempty"` // why the module cannot be composed at this fingerprint @@ -1775,8 +1789,10 @@ type ComposedByNodeNodeValue struct { Data bool `json:"data,omitempty"` // the files the provisioner fills FilledFiles []string `json:"filled_files,omitempty"` - Node string `json:"node"` - Own *NodeOwn `json:"own,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Node string `json:"node"` + Own *NodeOwn `json:"own,omitempty"` // the declaration resources, each saying its module Resources []map[string]any `json:"resources"` V int64 `json:"v"` @@ -1784,7 +1800,9 @@ type ComposedByNodeNodeValue struct { // DataByNodeModuleValue is one value of the state data under the key .. type DataByNodeModuleValue struct { - Digest string `json:"digest"` + Digest string `json:"digest"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Items []PlacedDataItem `json:"items"` Module string `json:"module"` Node string `json:"node"` @@ -1800,6 +1818,8 @@ type PackagesByNodeValuePackagesItem struct { // PackagesByNodeValue is one value of the state packages under the key . type PackagesByNodeValue struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Node string `json:"node"` Packages []PackagesByNodeValuePackagesItem `json:"packages"` } @@ -1807,17 +1827,19 @@ type PackagesByNodeValue struct { // HealthByNodeValue is one value of the state health under the key . type HealthByNodeValue struct { // when - At time.Time `json:"at"` - Contract int64 `json:"contract,omitempty"` - Fallback *LoginFallback `json:"fallback,omitempty"` - Found []NodeDirectory `json:"found,omitempty"` - Network *NetworkHealth `json:"network,omitempty"` - Node string `json:"node"` - Peers []PeerSeen `json:"peers,omitempty"` - Relogin []NodeAccount `json:"relogin,omitempty"` - Root []RootAccountVerdict `json:"root,omitempty"` - Units *UnitsHealth `json:"units,omitempty"` - V int64 `json:"v"` + At time.Time `json:"at"` + Contract int64 `json:"contract,omitempty"` + Fallback *LoginFallback `json:"fallback,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Found []NodeDirectory `json:"found,omitempty"` + Network *NetworkHealth `json:"network,omitempty"` + Node string `json:"node"` + Peers []PeerSeen `json:"peers,omitempty"` + Relogin []NodeAccount `json:"relogin,omitempty"` + Root []RootAccountVerdict `json:"root,omitempty"` + Units *UnitsHealth `json:"units,omitempty"` + V int64 `json:"v"` } // FindingsByKeyValue is one value of the state findings under the key . @@ -1827,7 +1849,9 @@ type FindingsByKeyValue struct { // newest first, at most 10 Evidence []FindingEvidence `json:"evidence,omitempty"` Explanation string `json:"explanation,omitempty"` - Headline string `json:"headline,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Headline string `json:"headline,omitempty"` // scope.id.token Key string `json:"key"` Kind string `json:"kind"` @@ -1859,9 +1883,274 @@ const ( // BoundsByWhatIDValue is one value of the state bounds under the key .. type BoundsByWhatIDValue struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Module string `json:"module,omitempty"` // when the wait began, RFC 3339 Since string `json:"since"` // layout version, 1 V int64 `json:"v"` } + +// DecodeHandOverAnswer reads a HandOverAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHandOverAnswer(raw []byte) (HandOverAnswer, int, error) { + var v HandOverAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAccessActAnswer reads a AccessActAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAccessActAnswer(raw []byte) (AccessActAnswer, int, error) { + var v AccessActAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeJudgeDirectoriesAnswer reads a JudgeDirectoriesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeJudgeDirectoriesAnswer(raw []byte) (JudgeDirectoriesAnswer, int, error) { + var v JudgeDirectoriesAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSetuidSearchAnswer reads a SetuidSearchAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSetuidSearchAnswer(raw []byte) (SetuidSearchAnswer, int, error) { + var v SetuidSearchAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRootFreeAnswer reads a RootFreeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRootFreeAnswer(raw []byte) (RootFreeAnswer, int, error) { + var v RootFreeAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeActsAnswer reads a ActsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeActsAnswer(raw []byte) (ActsAnswer, int, error) { + var v ActsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodePackagesAnswer reads a PackagesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePackagesAnswer(raw []byte) (PackagesAnswer, int, error) { + var v PackagesAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeCompositionAnswer reads a CompositionAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCompositionAnswer(raw []byte) (CompositionAnswer, int, error) { + var v CompositionAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeCompositionDiffAnswer reads a CompositionDiffAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCompositionDiffAnswer(raw []byte) (CompositionDiffAnswer, int, error) { + var v CompositionDiffAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeComposeAnswer reads a ComposeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeComposeAnswer(raw []byte) (ComposeAnswer, int, error) { + var v ComposeAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeComposeCandidateAnswer reads a ComposeCandidateAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeComposeCandidateAnswer(raw []byte) (ComposeCandidateAnswer, int, error) { + var v ComposeCandidateAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeManifestReadsAnswer reads a ManifestReadsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeManifestReadsAnswer(raw []byte) (ManifestReadsAnswer, int, error) { + var v ManifestReadsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeApplyOrderAnswer reads a ApplyOrderAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeApplyOrderAnswer(raw []byte) (ApplyOrderAnswer, int, error) { + var v ApplyOrderAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSeatListAnswer reads a SeatListAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSeatListAnswer(raw []byte) (SeatListAnswer, int, error) { + var v SeatListAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSeatListAgainAnswer reads a SeatListAgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSeatListAgainAnswer(raw []byte) (SeatListAgainAnswer, int, error) { + var v SeatListAgainAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeFirstViewsAnswer reads a FirstViewsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFirstViewsAnswer(raw []byte) (FirstViewsAnswer, int, error) { + var v FirstViewsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeFirstViewAgainAnswer reads a FirstViewAgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFirstViewAgainAnswer(raw []byte) (FirstViewAgainAnswer, int, error) { + var v FirstViewAgainAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeEntryAgainAnswer reads a EntryAgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEntryAgainAnswer(raw []byte) (EntryAgainAnswer, int, error) { + var v EntryAgainAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeProcessBuildsAnswer reads a ProcessBuildsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProcessBuildsAnswer(raw []byte) (ProcessBuildsAnswer, int, error) { + var v ProcessBuildsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeConvergedAnswer reads a ConvergedAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConvergedAnswer(raw []byte) (ConvergedAnswer, int, error) { + var v ConvergedAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAskedEvent reads a AskedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAskedEvent(raw []byte) (AskedEvent, int, error) { + var v AskedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDoneEvent reads a DoneEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDoneEvent(raw []byte) (DoneEvent, int, error) { + var v DoneEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRefusedEvent reads a RefusedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRefusedEvent(raw []byte) (RefusedEvent, int, error) { + var v RefusedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeManifestReadsChangedEvent reads a ManifestReadsChangedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeManifestReadsChangedEvent(raw []byte) (ManifestReadsChangedEvent, int, error) { + var v ManifestReadsChangedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeComposedEvent reads a ComposedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeComposedEvent(raw []byte) (ComposedEvent, int, error) { + var v ComposedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRunningEvent reads a RunningEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRunningEvent(raw []byte) (RunningEvent, int, error) { + var v RunningEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeWaitHeldEvent reads a WaitHeldEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWaitHeldEvent(raw []byte) (WaitHeldEvent, int, error) { + var v WaitHeldEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeWaitEndedEvent reads a WaitEndedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWaitEndedEvent(raw []byte) (WaitEndedEvent, int, error) { + var v WaitEndedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/health-and-repair/go/clients/meshconditionsclient/heard/heard_test.go b/health-and-repair/go/clients/meshconditionsclient/heard/heard_test.go index 9beb0e9..7e1d678 100644 --- a/health-and-repair/go/clients/meshconditionsclient/heard/heard_test.go +++ b/health-and-repair/go/clients/meshconditionsclient/heard/heard_test.go @@ -25,7 +25,7 @@ func TestBindWritesTheFindingUntilTheConsumerBinds(t *testing.T) { t.Fatal("a failed bind was not answered") } // Design 47 G 689: the value is the seat's generated finding, read by its strict decoder, key and subject by the rule. - if f, err := seat.DecodeFindingsByScopeIDKindValue(puts[key]); err != nil || f.Observer != "mesh-x" || f.Kind != Kind || + if f, _, err := seat.DecodeFindingsByScopeIDKindValue(puts[key]); err != nil || f.Observer != "mesh-x" || f.Kind != Kind || f.Scope != "module" || f.ID != "mesh-x.placement" || f.Subject.ID != f.ID || f.Severity != "warning" || f.Source == "" { t.Errorf("the finding is not the seat's generated one: %+v (%v)", f, err) } diff --git a/health-and-repair/go/seats/meshconditions/contract.go b/health-and-repair/go/seats/meshconditions/contract.go index 4772056..410ae9a 100644 --- a/health-and-repair/go/seats/meshconditions/contract.go +++ b/health-and-repair/go/seats/meshconditions/contract.go @@ -4,9 +4,7 @@ package meshconditions import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "mesh-conditions" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "836d2140ddb9934850b5ada7636fc2021b1071822179e9e1090c5d170e94db3a" +) + const ( VerbConditions = "conditions" VerbSilence = "silence" @@ -81,18 +90,13 @@ func ParseConditionsByKeyKey(key string) (string, bool) { return v0, true } -// DecodeConditionsByKeyValue reads one value of the state conditions under the form "", refusing a field ConditionsByKeyValue does not know and any text after the value. -func DecodeConditionsByKeyValue(raw []byte) (ConditionsByKeyValue, error) { +// DecodeConditionsByKeyValue reads one value of the state conditions under the form "" as another part wrote it: a field ConditionsByKeyValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConditionsByKeyValue(raw []byte) (ConditionsByKeyValue, int, error) { var v ConditionsByKeyValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // FindingsByScopeIDKindKey is the key of one value of the state findings under the form "..". @@ -122,18 +126,13 @@ func ParseFindingsByScopeIDKindKey(key string) (string, string, string, bool) { return v0, v2, v4, true } -// DecodeFindingsByScopeIDKindValue reads one value of the state findings under the form "..", refusing a field FindingsByScopeIDKindValue does not know and any text after the value. -func DecodeFindingsByScopeIDKindValue(raw []byte) (FindingsByScopeIDKindValue, error) { +// DecodeFindingsByScopeIDKindValue reads one value of the state findings under the form ".." as another part wrote it: a field FindingsByScopeIDKindValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFindingsByScopeIDKindValue(raw []byte) (FindingsByScopeIDKindValue, int, error) { var v FindingsByScopeIDKindValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // FindingsViewsByObserverNodeKey is the key of one value of the state findings-views under the form ".". @@ -158,18 +157,13 @@ func ParseFindingsViewsByObserverNodeKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeFindingsViewsByObserverNodeValue reads one value of the state findings-views under the form ".", refusing a field FindingsViewsByObserverNodeValue does not know and any text after the value. -func DecodeFindingsViewsByObserverNodeValue(raw []byte) (FindingsViewsByObserverNodeValue, error) { +// DecodeFindingsViewsByObserverNodeValue reads one value of the state findings-views under the form "." as another part wrote it: a field FindingsViewsByObserverNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFindingsViewsByObserverNodeValue(raw []byte) (FindingsViewsByObserverNodeValue, int, error) { var v FindingsViewsByObserverNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // Action is one answer the operator may give from a notification. @@ -220,11 +214,13 @@ type ConditionEvent struct { Epoch int64 `json:"epoch,omitempty"` Event string `json:"event"` // newest first, at most 10 - Evidence []Evidence `json:"evidence,omitempty"` - Explanation string `json:"explanation,omitempty"` - First *time.Time `json:"first,omitempty"` - Gaps []ConditionEventGapsItem `json:"gaps,omitempty"` - Headline string `json:"headline,omitempty"` + Evidence []Evidence `json:"evidence,omitempty"` + Explanation string `json:"explanation,omitempty"` + First *time.Time `json:"first,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Gaps []ConditionEventGapsItem `json:"gaps,omitempty"` + Headline string `json:"headline,omitempty"` // scope.id.token Key string `json:"key"` Kind string `json:"kind,omitempty"` @@ -298,7 +294,9 @@ type Finding struct { // newest first, at most 10 Evidence []Evidence `json:"evidence,omitempty"` Explanation string `json:"explanation,omitempty"` - Headline string `json:"headline,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Headline string `json:"headline,omitempty"` // the key's second part ID string `json:"id"` Kind string `json:"kind"` @@ -430,6 +428,8 @@ type FindingsAskedEvent struct { At time.Time `json:"at"` // who asked: the keeper, or the person or session that called resync By string `json:"by"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // to ask one observer; none asks all Module string `json:"module,omitempty"` } @@ -462,11 +462,13 @@ type ConditionsByKeyValue struct { Count int64 `json:"count,omitempty"` Epoch int64 `json:"epoch,omitempty"` // newest first, at most 10 - Evidence []Evidence `json:"evidence,omitempty"` - Explanation string `json:"explanation,omitempty"` - First *time.Time `json:"first,omitempty"` - Gaps []ConditionsByKeyValueGapsItem `json:"gaps,omitempty"` - Headline string `json:"headline,omitempty"` + Evidence []Evidence `json:"evidence,omitempty"` + Explanation string `json:"explanation,omitempty"` + First *time.Time `json:"first,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Gaps []ConditionsByKeyValueGapsItem `json:"gaps,omitempty"` + Headline string `json:"headline,omitempty"` // scope.id.token Key string `json:"key"` Kind string `json:"kind"` @@ -510,12 +512,88 @@ type FindingsViewsByObserverNodeValueStated struct { // FindingsViewsByObserverNodeValue is one value of the state findings-views under the key .. type FindingsViewsByObserverNodeValue struct { // the open asks - Asks []string `json:"asks,omitempty"` - Node string `json:"node"` - Observer string `json:"observer"` + Asks []string `json:"asks,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Node string `json:"node"` + Observer string `json:"observer"` // the keys it cannot judge yet Pending []string `json:"pending,omitempty"` // the last findings-stated set Stated *FindingsViewsByObserverNodeValueStated `json:"stated,omitempty"` V int64 `json:"v"` } + +// DecodeConditionsAnswer reads a ConditionsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConditionsAnswer(raw []byte) (ConditionsAnswer, int, error) { + var v ConditionsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSilenceAnswer reads a SilenceAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSilenceAnswer(raw []byte) (SilenceAnswer, int, error) { + var v SilenceAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeResyncAnswer reads a ResyncAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeResyncAnswer(raw []byte) (ResyncAnswer, int, error) { + var v ResyncAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeConditionRaisedEvent reads a ConditionRaisedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConditionRaisedEvent(raw []byte) (ConditionRaisedEvent, int, error) { + var v ConditionRaisedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeConditionChangedEvent reads a ConditionChangedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConditionChangedEvent(raw []byte) (ConditionChangedEvent, int, error) { + var v ConditionChangedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeConditionClearedEvent reads a ConditionClearedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConditionClearedEvent(raw []byte) (ConditionClearedEvent, int, error) { + var v ConditionClearedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeFindingsAskedEvent reads a FindingsAskedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFindingsAskedEvent(raw []byte) (FindingsAskedEvent, int, error) { + var v FindingsAskedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/health-and-repair/go/seats/meshhandacts/contract.go b/health-and-repair/go/seats/meshhandacts/contract.go index 12c84db..1fda71f 100644 --- a/health-and-repair/go/seats/meshhandacts/contract.go +++ b/health-and-repair/go/seats/meshhandacts/contract.go @@ -4,9 +4,7 @@ package meshhandacts import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "mesh-hand-acts" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "12775f35116965a7ab99b6b2617020889cab452598c2f51883247d05cf99a9ea" +) + const ( VerbHandAct = "hand-act" VerbHandActs = "hand-acts" @@ -65,18 +74,13 @@ func ParseActsByIDKey(key string) (string, bool) { return v0, true } -// DecodeActsByIDValue reads one value of the state acts under the form "", refusing a field ActsByIDValue does not know and any text after the value. -func DecodeActsByIDValue(raw []byte) (ActsByIDValue, error) { +// DecodeActsByIDValue reads one value of the state acts under the form "" as another part wrote it: a field ActsByIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeActsByIDValue(raw []byte) (ActsByIDValue, int, error) { var v ActsByIDValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // WarrantsByAskerAskKey is the key of one value of the state warrants under the form ".". @@ -101,18 +105,13 @@ func ParseWarrantsByAskerAskKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeWarrantsByAskerAskValue reads one value of the state warrants under the form ".", refusing a field WarrantsByAskerAskValue does not know and any text after the value. -func DecodeWarrantsByAskerAskValue(raw []byte) (WarrantsByAskerAskValue, error) { +// DecodeWarrantsByAskerAskValue reads one value of the state warrants under the form "." as another part wrote it: a field WarrantsByAskerAskValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWarrantsByAskerAskValue(raw []byte) (WarrantsByAskerAskValue, int, error) { var v WarrantsByAskerAskValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // Act is one act done by hand. @@ -125,7 +124,9 @@ type Act struct { Carried []string `json:"carried,omitempty"` Cause string `json:"cause"` Condition string `json:"condition,omitempty"` - ID string `json:"id"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + ID string `json:"id"` // what the act was read to be from what it did Kind string `json:"kind,omitempty"` // which log holds it, set when it is read @@ -200,7 +201,9 @@ type ActsByIDValue struct { Carried []string `json:"carried,omitempty"` Cause string `json:"cause"` Condition string `json:"condition,omitempty"` - ID string `json:"id"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + ID string `json:"id"` // what the act was read to be from what it did Kind string `json:"kind,omitempty"` // which log holds it, set when it is read @@ -215,9 +218,58 @@ type ActsByIDValue struct { // WarrantsByAskerAskValue is one value of the state warrants under the key .. type WarrantsByAskerAskValue struct { - Ask string `json:"ask"` - Asker string `json:"asker"` - At *time.Time `json:"at,omitempty"` - By string `json:"by,omitempty"` - Option string `json:"option,omitempty"` + Ask string `json:"ask"` + Asker string `json:"asker"` + At *time.Time `json:"at,omitempty"` + By string `json:"by,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Option string `json:"option,omitempty"` +} + +// DecodeHandActAnswer reads a HandActAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHandActAnswer(raw []byte) (HandActAnswer, int, error) { + var v HandActAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeHandActsAnswer reads a HandActsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHandActsAnswer(raw []byte) (HandActsAnswer, int, error) { + var v HandActsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeWarrantedAnswer reads a WarrantedAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWarrantedAnswer(raw []byte) (WarrantedAnswer, int, error) { + var v WarrantedAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeActRecordedEvent reads a ActRecordedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeActRecordedEvent(raw []byte) (ActRecordedEvent, int, error) { + var v ActRecordedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form } diff --git a/health-and-repair/go/seats/meshhealers/contract.go b/health-and-repair/go/seats/meshhealers/contract.go index 33b70ee..4cf05a1 100644 --- a/health-and-repair/go/seats/meshhealers/contract.go +++ b/health-and-repair/go/seats/meshhealers/contract.go @@ -4,15 +4,24 @@ package meshhealers import ( - "bytes" "encoding/json" - "errors" "time" ) // Seat is the seat's name. const Seat = "mesh-healers" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "4970dc97cfa905889a3c496c5bcb539306ce1900fa4ac19d6010954051f7901a" +) + const ( VerbHealers = "healers" VerbHeal = "heal" @@ -76,18 +85,13 @@ func ParseAttemptsByAttemptKey(key string) (string, bool) { return v0, true } -// DecodeAttemptsByAttemptValue reads one value of the state attempts under the form "", refusing a field AttemptsByAttemptValue does not know and any text after the value. -func DecodeAttemptsByAttemptValue(raw []byte) (AttemptsByAttemptValue, error) { +// DecodeAttemptsByAttemptValue reads one value of the state attempts under the form "" as another part wrote it: a field AttemptsByAttemptValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAttemptsByAttemptValue(raw []byte) (AttemptsByAttemptValue, int, error) { var v AttemptsByAttemptValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // WouldByWouldKey is the key of one value of the state would under the form "". @@ -107,18 +111,13 @@ func ParseWouldByWouldKey(key string) (string, bool) { return v0, true } -// DecodeWouldByWouldValue reads one value of the state would under the form "", refusing a field WouldByWouldValue does not know and any text after the value. -func DecodeWouldByWouldValue(raw []byte) (WouldByWouldValue, error) { +// DecodeWouldByWouldValue reads one value of the state would under the form "" as another part wrote it: a field WouldByWouldValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWouldByWouldValue(raw []byte) (WouldByWouldValue, int, error) { var v WouldByWouldValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // HealersInput is what healers takes. @@ -162,11 +161,13 @@ type HealerActedEvent struct { By string `json:"by,omitempty"` Condition string `json:"condition"` Event string `json:"event"` - Healer string `json:"healer"` - Kind string `json:"kind,omitempty"` - Outcome string `json:"outcome"` - Said string `json:"said,omitempty"` - Show string `json:"show,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Healer string `json:"healer"` + Kind string `json:"kind,omitempty"` + Outcome string `json:"outcome"` + Said string `json:"said,omitempty"` + Show string `json:"show,omitempty"` } // The values of HealerActedEvent's outcome. @@ -185,9 +186,11 @@ type AttemptChangedEvent struct { BudgetKey string `json:"budget-key,omitempty"` Condition string `json:"condition,omitempty"` Finished *time.Time `json:"finished,omitempty"` - Healer string `json:"healer,omitempty"` - Kind string `json:"kind,omitempty"` - Outcome string `json:"outcome,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Healer string `json:"healer,omitempty"` + Kind string `json:"kind,omitempty"` + Outcome string `json:"outcome,omitempty"` // true when the healer ends the attempt Removed bool `json:"removed,omitempty"` Said string `json:"said,omitempty"` @@ -211,10 +214,12 @@ type AttemptsByAttemptValue struct { BudgetKey string `json:"budget-key"` Condition string `json:"condition"` Finished *time.Time `json:"finished,omitempty"` - Healer string `json:"healer"` - Kind string `json:"kind"` - Outcome string `json:"outcome"` - Said string `json:"said,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Healer string `json:"healer"` + Kind string `json:"kind"` + Outcome string `json:"outcome"` + Said string `json:"said,omitempty"` } // The values of AttemptsByAttemptValue's outcome. @@ -230,7 +235,65 @@ type WouldByWouldValue struct { Act string `json:"act"` At time.Time `json:"at"` Condition string `json:"condition"` - Healer string `json:"healer"` - Kind string `json:"kind,omitempty"` - Why string `json:"why,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Healer string `json:"healer"` + Kind string `json:"kind,omitempty"` + Why string `json:"why,omitempty"` +} + +// DecodeHealersAnswer reads a HealersAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHealersAnswer(raw []byte) (HealersAnswer, int, error) { + var v HealersAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeHealAnswer reads a HealAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHealAnswer(raw []byte) (HealAnswer, int, error) { + var v HealAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDrillAnswer reads a DrillAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDrillAnswer(raw []byte) (DrillAnswer, int, error) { + var v DrillAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeHealerActedEvent reads a HealerActedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHealerActedEvent(raw []byte) (HealerActedEvent, int, error) { + var v HealerActedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAttemptChangedEvent reads a AttemptChangedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAttemptChangedEvent(raw []byte) (AttemptChangedEvent, int, error) { + var v AttemptChangedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form } diff --git a/health-and-repair/go/seats/meshselfcheck/contract.go b/health-and-repair/go/seats/meshselfcheck/contract.go index ad3b5cb..1506c87 100644 --- a/health-and-repair/go/seats/meshselfcheck/contract.go +++ b/health-and-repair/go/seats/meshselfcheck/contract.go @@ -3,11 +3,25 @@ // Package meshselfcheck is the contract of the seat "mesh-self-check", defined whole (seats/mesh-self-check/seat.json): The mesh checking itself (ADR 0564): probes run every five minutes, each failure a finding the seat's conditions raise. package meshselfcheck -import "time" +import ( + "encoding/json" + "time" +) // Seat is the seat's name. const Seat = "mesh-self-check" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "5f1c3026e243ab14d7005851c952f42cfb40cfa79e22cea8f3c2f94a59e65f7f" +) + const ( VerbDoctor = "doctor" VerbProbes = "probes" @@ -90,14 +104,54 @@ type CheckedEventCounts struct { // CheckedEvent is the body of the event checked. type CheckedEvent struct { - At time.Time `json:"at"` - Controller string `json:"controller,omitempty"` - Counts *CheckedEventCounts `json:"counts,omitempty"` - IntervalSeconds int64 `json:"interval-seconds,omitempty"` - Probes []ProbeVerdict `json:"probes"` - Run string `json:"run"` - Started *time.Time `json:"started,omitempty"` - Took string `json:"took,omitempty"` - Unsaid int64 `json:"unsaid,omitempty"` - Why string `json:"why,omitempty"` + At time.Time `json:"at"` + Controller string `json:"controller,omitempty"` + Counts *CheckedEventCounts `json:"counts,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + IntervalSeconds int64 `json:"interval-seconds,omitempty"` + Probes []ProbeVerdict `json:"probes"` + Run string `json:"run"` + Started *time.Time `json:"started,omitempty"` + Took string `json:"took,omitempty"` + Unsaid int64 `json:"unsaid,omitempty"` + Why string `json:"why,omitempty"` +} + +// DecodeDoctorAnswer reads a DoctorAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDoctorAnswer(raw []byte) (DoctorAnswer, int, error) { + var v DoctorAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeProbesAnswer reads a ProbesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProbesAnswer(raw []byte) (ProbesAnswer, int, error) { + var v ProbesAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeCheckedEvent reads a CheckedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeCheckedEvent(raw []byte) (CheckedEvent, int, error) { + var v CheckedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form } diff --git a/health-and-repair/go/seats/meshwatchdogs/contract.go b/health-and-repair/go/seats/meshwatchdogs/contract.go index 91207e1..e38100c 100644 --- a/health-and-repair/go/seats/meshwatchdogs/contract.go +++ b/health-and-repair/go/seats/meshwatchdogs/contract.go @@ -4,9 +4,7 @@ package meshwatchdogs import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "mesh-watchdogs" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "aacf27b959d307b4603d4a4909f324b82430c882bfbeff86941dfa0143a53854" +) + const ( VerbSignals = "signals" VerbStuck = "stuck" @@ -88,18 +97,13 @@ func ParsePresenceByNodeKey(key string) (string, bool) { return v0, true } -// DecodePresenceByNodeValue reads one value of the state presence under the form "", refusing a field PresenceByNodeValue does not know and any text after the value. -func DecodePresenceByNodeValue(raw []byte) (PresenceByNodeValue, error) { +// DecodePresenceByNodeValue reads one value of the state presence under the form "" as another part wrote it: a field PresenceByNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePresenceByNodeValue(raw []byte) (PresenceByNodeValue, int, error) { var v PresenceByNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // PresenceByPartPartInstanceKey is the key of one value of the state presence under the form "part..". @@ -130,18 +134,13 @@ func ParsePresenceByPartPartInstanceKey(key string) (string, string, bool) { return v1, v3, true } -// DecodePresenceByPartPartInstanceValue reads one value of the state presence under the form "part..", refusing a field PresenceByPartPartInstanceValue does not know and any text after the value. -func DecodePresenceByPartPartInstanceValue(raw []byte) (PresenceByPartPartInstanceValue, error) { +// DecodePresenceByPartPartInstanceValue reads one value of the state presence under the form "part.." as another part wrote it: a field PresenceByPartPartInstanceValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePresenceByPartPartInstanceValue(raw []byte) (PresenceByPartPartInstanceValue, int, error) { var v PresenceByPartPartInstanceValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // PulseByBucketKeyKey is the key of one value of the state pulse under the form ".". @@ -166,18 +165,13 @@ func ParsePulseByBucketKeyKey(key string) (string, string, bool) { return v0, v2, true } -// DecodePulseByBucketKeyValue reads one value of the state pulse under the form ".", refusing a field PulseByBucketKeyValue does not know and any text after the value. -func DecodePulseByBucketKeyValue(raw []byte) (PulseByBucketKeyValue, error) { +// DecodePulseByBucketKeyValue reads one value of the state pulse under the form "." as another part wrote it: a field PulseByBucketKeyValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePulseByBucketKeyValue(raw []byte) (PulseByBucketKeyValue, int, error) { var v PulseByBucketKeyValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // StuckByBucketKeyKey is the key of one value of the state stuck under the form ".". @@ -202,18 +196,13 @@ func ParseStuckByBucketKeyKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeStuckByBucketKeyValue reads one value of the state stuck under the form ".", refusing a field StuckByBucketKeyValue does not know and any text after the value. -func DecodeStuckByBucketKeyValue(raw []byte) (StuckByBucketKeyValue, error) { +// DecodeStuckByBucketKeyValue reads one value of the state stuck under the form "." as another part wrote it: a field StuckByBucketKeyValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeStuckByBucketKeyValue(raw []byte) (StuckByBucketKeyValue, int, error) { var v StuckByBucketKeyValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // SignalsInput is what signals takes. @@ -252,6 +241,8 @@ type PresenceAnswerKeysItem struct { // PresenceAnswer is what presence answers. type PresenceAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // without machine: how many keys the state holds Holds int64 `json:"holds,omitempty"` // without machine: each key of the state presence, or part.., with its value @@ -297,6 +288,8 @@ type ResyncAnswer = map[string]any // MachineAwayEvent is the body of the event machine-away. type MachineAwayEvent struct { At time.Time `json:"at"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // when the machine was last heard LastHeard time.Time `json:"last-heard"` // the machine whose presence changed @@ -308,6 +301,8 @@ type MachineAwayEvent struct { // MachineBackEvent is the body of the event machine-back. type MachineBackEvent struct { At time.Time `json:"at"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // when the machine was last heard LastHeard time.Time `json:"last-heard"` // the machine whose presence changed @@ -318,19 +313,25 @@ type MachineBackEvent struct { // PresenceByNodeValue is one value of the state presence under the key . type PresenceByNodeValue struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Online bool `json:"online"` V int64 `json:"v,omitempty"` } // PresenceByPartPartInstanceValue is one value of the state presence under the key part... type PresenceByPartPartInstanceValue struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Online bool `json:"online"` V int64 `json:"v,omitempty"` } // PulseByBucketKeyValue is one value of the state pulse under the key .. type PulseByBucketKeyValue struct { - Bucket string `json:"bucket"` + Bucket string `json:"bucket"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Key string `json:"key"` Owes string `json:"owes,omitempty"` Revision int64 `json:"revision"` @@ -340,7 +341,9 @@ type PulseByBucketKeyValue struct { // StuckByBucketKeyValue is one value of the state stuck under the key .. type StuckByBucketKeyValue struct { Bucket string `json:"bucket"` - Key string `json:"key"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Key string `json:"key"` // it has moved again Moved bool `json:"moved,omitempty"` Since time.Time `json:"since"` @@ -348,3 +351,77 @@ type StuckByBucketKeyValue struct { // what it waited for, in words Waited string `json:"waited,omitempty"` } + +// DecodeSignalsAnswer reads a SignalsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSignalsAnswer(raw []byte) (SignalsAnswer, int, error) { + var v SignalsAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeStuckAnswer reads a StuckAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeStuckAnswer(raw []byte) (StuckAnswer, int, error) { + var v StuckAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodePresenceAnswer reads a PresenceAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePresenceAnswer(raw []byte) (PresenceAnswer, int, error) { + var v PresenceAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDeadLettersAnswer reads a DeadLettersAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDeadLettersAnswer(raw []byte) (DeadLettersAnswer, int, error) { + var v DeadLettersAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeResyncAnswer reads a ResyncAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeResyncAnswer(raw []byte) (ResyncAnswer, int, error) { + var v ResyncAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeMachineAwayEvent reads a MachineAwayEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeMachineAwayEvent(raw []byte) (MachineAwayEvent, int, error) { + var v MachineAwayEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeMachineBackEvent reads a MachineBackEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeMachineBackEvent(raw []byte) (MachineBackEvent, int, error) { + var v MachineBackEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/health-and-repair/ts/seats/meshconditions/index.d.ts b/health-and-repair/ts/seats/meshconditions/index.d.ts index 3deca6b..687b265 100644 --- a/health-and-repair/ts/seats/meshconditions/index.d.ts +++ b/health-and-repair/ts/seats/meshconditions/index.d.ts @@ -95,6 +95,8 @@ export interface ConditionEvent { "evidence"?: Evidence[]; "explanation"?: string; "first"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "gaps"?: ConditionEventGapsItem[]; "headline"?: string; /** scope.id.token */ @@ -151,6 +153,8 @@ export interface Finding { /** newest first, at most 10 */ "evidence"?: Evidence[]; "explanation"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "headline"?: string; /** the key's second part */ "id": string; @@ -269,6 +273,8 @@ export interface FindingsAskedEvent { "at": string; /** who asked: the keeper, or the person or session that called resync */ "by": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** to ask one observer; none asks all */ "module"?: string; } @@ -301,6 +307,8 @@ export interface ConditionsByKeyValue { "evidence"?: Evidence[]; "explanation"?: string; "first"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "gaps"?: ConditionsByKeyValueGapsItem[]; "headline"?: string; /** scope.id.token */ @@ -341,6 +349,8 @@ export interface FindingsViewsByObserverNodeValueStated { export interface FindingsViewsByObserverNodeValue { /** the open asks */ "asks"?: string[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "node": string; "observer": string; /** the keys it cannot judge yet */ diff --git a/health-and-repair/ts/seats/meshhandacts/index.d.ts b/health-and-repair/ts/seats/meshhandacts/index.d.ts index 02f6433..f29e319 100644 --- a/health-and-repair/ts/seats/meshhandacts/index.d.ts +++ b/health-and-repair/ts/seats/meshhandacts/index.d.ts @@ -45,6 +45,8 @@ export interface Act { "carried"?: string[]; "cause": string; "condition"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "id": string; /** what the act was read to be from what it did */ "kind"?: string; @@ -114,6 +116,8 @@ export interface ActsByIDValue { "carried"?: string[]; "cause": string; "condition"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "id": string; /** what the act was read to be from what it did */ "kind"?: string; @@ -133,6 +137,8 @@ export interface WarrantsByAskerAskValue { "asker": string; "at"?: string; "by"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "option"?: string; } diff --git a/health-and-repair/ts/seats/meshhealers/index.d.ts b/health-and-repair/ts/seats/meshhealers/index.d.ts index 25f8e11..d913c33 100644 --- a/health-and-repair/ts/seats/meshhealers/index.d.ts +++ b/health-and-repair/ts/seats/meshhealers/index.d.ts @@ -83,6 +83,8 @@ export interface HealerActedEvent { "by"?: string; "condition": string; "event": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "healer": string; "kind"?: string; "outcome": "acting" | "acted" | "failed" | "escalated"; @@ -98,6 +100,8 @@ export interface AttemptChangedEvent { "budget-key"?: string; "condition"?: string; "finished"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "healer"?: string; "kind"?: string; "outcome"?: "acting" | "acted" | "failed" | "escalated"; @@ -116,6 +120,8 @@ export interface AttemptsByAttemptValue { "budget-key": string; "condition": string; "finished"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "healer": string; "kind": string; "outcome": "acting" | "acted" | "failed" | "escalated"; @@ -127,6 +133,8 @@ export interface WouldByWouldValue { "act": string; "at": string; "condition": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "healer": string; "kind"?: string; "why"?: string; diff --git a/health-and-repair/ts/seats/meshselfcheck/index.d.ts b/health-and-repair/ts/seats/meshselfcheck/index.d.ts index 256f61b..769ee7c 100644 --- a/health-and-repair/ts/seats/meshselfcheck/index.d.ts +++ b/health-and-repair/ts/seats/meshselfcheck/index.d.ts @@ -59,6 +59,8 @@ export interface CheckedEvent { "at": string; "controller"?: string; "counts"?: CheckedEventCounts; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "interval-seconds"?: number; "probes": ProbeVerdict[]; "run": string; diff --git a/health-and-repair/ts/seats/meshwatchdogs/index.d.ts b/health-and-repair/ts/seats/meshwatchdogs/index.d.ts index ebe31a0..ebf0244 100644 --- a/health-and-repair/ts/seats/meshwatchdogs/index.d.ts +++ b/health-and-repair/ts/seats/meshwatchdogs/index.d.ts @@ -96,6 +96,8 @@ export interface PresenceAnswerKeysItem { /** is what presence answers. */ export interface PresenceAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** without machine: how many keys the state holds */ "holds"?: number; /** without machine: each key of the state presence, or part.., with its value */ @@ -141,6 +143,8 @@ export type ResyncAnswer = Record; /** is the body of the event machine-away. */ export interface MachineAwayEvent { "at": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** when the machine was last heard */ "last-heard": string; /** the machine whose presence changed */ @@ -152,6 +156,8 @@ export interface MachineAwayEvent { /** is the body of the event machine-back. */ export interface MachineBackEvent { "at": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** when the machine was last heard */ "last-heard": string; /** the machine whose presence changed */ @@ -162,12 +168,16 @@ export interface MachineBackEvent { /** is one value of the state presence under the key . */ export interface PresenceByNodeValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "online": boolean; "v"?: number; } /** is one value of the state presence under the key part... */ export interface PresenceByPartPartInstanceValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "online": boolean; "v"?: number; } @@ -175,6 +185,8 @@ export interface PresenceByPartPartInstanceValue { /** is one value of the state pulse under the key .. */ export interface PulseByBucketKeyValue { "bucket": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "key": string; "owes"?: string; "revision": number; @@ -184,6 +196,8 @@ export interface PulseByBucketKeyValue { /** is one value of the state stuck under the key .. */ export interface StuckByBucketKeyValue { "bucket": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "key": string; /** it has moved again */ "moved"?: boolean; diff --git a/identity-and-access/go/clients/meshvaultclient/nodelogins.go b/identity-and-access/go/clients/meshvaultclient/nodelogins.go index 314af7f..5b8113f 100644 --- a/identity-and-access/go/clients/meshvaultclient/nodelogins.go +++ b/identity-and-access/go/clients/meshvaultclient/nodelogins.go @@ -113,7 +113,7 @@ func DecodeNodeLogin(data []byte) (seat.NodeLoginsByNodeValue, error) { if probe.V == nil || *probe.V != Version { return seat.NodeLoginsByNodeValue{}, fmt.Errorf("%w: this reader reads %d", ErrUnknownVersion, Version) } - l, err := seat.DecodeNodeLoginsByNodeValue(data) + l, _, err := seat.DecodeNodeLoginsByNodeValue(data) if err != nil { return l, fmt.Errorf("meshvaultclient: value does not fit its shape: %w", err) } diff --git a/identity-and-access/go/clients/meshvaultclient/signers.go b/identity-and-access/go/clients/meshvaultclient/signers.go index 476b4e6..feda8a5 100644 --- a/identity-and-access/go/clients/meshvaultclient/signers.go +++ b/identity-and-access/go/clients/meshvaultclient/signers.go @@ -104,7 +104,7 @@ func SignerPublicKey(k seat.SignersByKeyValue) (ed25519.PublicKey, error) { // DecodeSignerKey reads the key `key` of `signers`, refused when it does not check. func DecodeSignerKey(raw []byte) (seat.SignersByKeyValue, error) { - k, err := seat.DecodeSignersByKeyValue(raw) + k, _, err := seat.DecodeSignersByKeyValue(raw) if err != nil { return k, fmt.Errorf("meshvaultclient: signers %s: %w", "key", err) } @@ -117,7 +117,7 @@ func DecodeSignerKey(raw []byte) (seat.SignersByKeyValue, error) { // DecodeSignerAuthority reads the key `authority` of `signers`: one authority certificate (a CA that signs leaves // alone) whose fingerprint is the one named. func DecodeSignerAuthority(raw []byte) (seat.SignersByAuthorityValue, error) { - a, err := seat.DecodeSignersByAuthorityValue(raw) + a, _, err := seat.DecodeSignersByAuthorityValue(raw) if err != nil { return a, fmt.Errorf("meshvaultclient: signers %s: %w", "authority", err) } diff --git a/identity-and-access/go/seats/meshgrants/contract.go b/identity-and-access/go/seats/meshgrants/contract.go index 6d40945..f12663d 100644 --- a/identity-and-access/go/seats/meshgrants/contract.go +++ b/identity-and-access/go/seats/meshgrants/contract.go @@ -3,11 +3,25 @@ // Package meshgrants is the contract of the seat "mesh-grants", defined whole (seats/mesh-grants/seat.json): Who may say what on the bus: the grants part composes each module's membership, its buckets, logs and streams, the bus's user list and grants (design 47 'The grants part'). An acting part of the step grant (ADR 0656 1): an entry whose grant waits for its new version is held on its running build within the bound, said by wait-held and wait-ended; a store passing 80 % of its cap is said by filling, and back below 70 % by room; grants-for answers the grants a candidate would compose (design 47 G 331, 441). package meshgrants -import "time" +import ( + "encoding/json" + "time" +) // Seat is the seat's name. const Seat = "mesh-grants" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "b2f4006c04a64376f684122491eac6e2bccab805b53cb2fc34ea05db6f2ab965" +) + const ( VerbGrantsFor = "grants-for" VerbWithheld = "withheld" @@ -54,6 +68,8 @@ type Fill struct { Bytes int64 `json:"bytes"` // bytes Cap int64 `json:"cap"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the store Store string `json:"store"` } @@ -76,7 +92,9 @@ type GrantsForModulesItem struct { // GrantsFor is the grants a candidate would compose, per module, added and removed against the branch's newest. type GrantsFor struct { // why it could not be answered: the catalog half of the candidate is not held - Error string `json:"error,omitempty"` + Error string `json:"error,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Modules []GrantsForModulesItem `json:"modules,omitempty"` } @@ -88,6 +106,8 @@ type Wait struct { By string `json:"by,omitempty"` // when the new version's build was done, as the builder's build.ended says; the bound's clock starts there (design 47 G 266) ClockFrom time.Time `json:"clock-from"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the entry's fingerprint, whose grant waits Fp string `json:"fp,omitempty"` // on wait-ended: ran or released @@ -122,6 +142,8 @@ type WithheldModulesItem struct { // Withheld is a node's withheld subjects, by module. type Withheld struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Modules []WithheldModulesItem `json:"modules"` Node string `json:"node"` } @@ -165,3 +187,68 @@ type FillingEvent = Fill // RoomEvent is the body of the event room. type RoomEvent = Fill + +// DecodeGrantsForAnswer reads a GrantsForAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeGrantsForAnswer(raw []byte) (GrantsForAnswer, int, error) { + var v GrantsForAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeWithheldAnswer reads a WithheldAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWithheldAnswer(raw []byte) (WithheldAnswer, int, error) { + var v WithheldAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeWaitHeldEvent reads a WaitHeldEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWaitHeldEvent(raw []byte) (WaitHeldEvent, int, error) { + var v WaitHeldEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeWaitEndedEvent reads a WaitEndedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeWaitEndedEvent(raw []byte) (WaitEndedEvent, int, error) { + var v WaitEndedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeFillingEvent reads a FillingEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeFillingEvent(raw []byte) (FillingEvent, int, error) { + var v FillingEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRoomEvent reads a RoomEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRoomEvent(raw []byte) (RoomEvent, int, error) { + var v RoomEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/identity-and-access/go/seats/meshnodeenroller/contract.go b/identity-and-access/go/seats/meshnodeenroller/contract.go index fc7f677..20e4a68 100644 --- a/identity-and-access/go/seats/meshnodeenroller/contract.go +++ b/identity-and-access/go/seats/meshnodeenroller/contract.go @@ -4,9 +4,7 @@ package meshnodeenroller import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "mesh-node-enroller" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "a6eedea7a2806712696e7b491a8a643a1dc054ab6ab1d97dce0de7f015c92243" +) + const ( VerbIssue = "issue" VerbRedeem = "redeem" @@ -87,18 +96,13 @@ func ParseEnrolmentsByNodeNodeKey(key string) (string, bool) { return v1, true } -// DecodeEnrolmentsByNodeNodeValue reads one value of the state enrolments under the form "node.", refusing a field EnrolmentsByNodeNodeValue does not know and any text after the value. -func DecodeEnrolmentsByNodeNodeValue(raw []byte) (EnrolmentsByNodeNodeValue, error) { +// DecodeEnrolmentsByNodeNodeValue reads one value of the state enrolments under the form "node." as another part wrote it: a field EnrolmentsByNodeNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEnrolmentsByNodeNodeValue(raw []byte) (EnrolmentsByNodeNodeValue, int, error) { var v EnrolmentsByNodeNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // EnrolmentsByAddressAddressKey is the key of one value of the state enrolments under the form "address.
". @@ -122,26 +126,23 @@ func ParseEnrolmentsByAddressAddressKey(key string) (string, bool) { return v1, true } -// DecodeEnrolmentsByAddressAddressValue reads one value of the state enrolments under the form "address.
", refusing a field EnrolmentsByAddressAddressValue does not know and any text after the value. -func DecodeEnrolmentsByAddressAddressValue(raw []byte) (EnrolmentsByAddressAddressValue, error) { +// DecodeEnrolmentsByAddressAddressValue reads one value of the state enrolments under the form "address.
" as another part wrote it: a field EnrolmentsByAddressAddressValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEnrolmentsByAddressAddressValue(raw []byte) (EnrolmentsByAddressAddressValue, int, error) { var v EnrolmentsByAddressAddressValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // Enrolment is one open enrolment. type Enrolment struct { - Address string `json:"address"` - Ask string `json:"ask,omitempty"` - Caller string `json:"caller,omitempty"` - Expires *time.Time `json:"expires,omitempty"` + Address string `json:"address"` + Ask string `json:"ask,omitempty"` + Caller string `json:"caller,omitempty"` + Expires *time.Time `json:"expires,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Issued *time.Time `json:"issued,omitempty"` KeysDigest string `json:"keys-digest,omitempty"` Node string `json:"node"` @@ -193,6 +194,8 @@ type RedeemAnswer struct { Account string `json:"account"` // its certificate, PEM Certificate string `json:"certificate"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the login it dials as next Login string `json:"login"` // the node @@ -267,8 +270,120 @@ type EnrolmentsByNodeNodeValue = Enrolment // EnrolmentsByAddressAddressValue is one value of the state enrolments under the key address.
. type EnrolmentsByAddressAddressValue struct { - Ask string `json:"ask,omitempty"` + Ask string `json:"ask,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Issued *time.Time `json:"issued,omitempty"` Node string `json:"node"` V int64 `json:"v,omitempty"` } + +// DecodeIssueAnswer reads a IssueAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeIssueAnswer(raw []byte) (IssueAnswer, int, error) { + var v IssueAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRedeemAnswer reads a RedeemAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRedeemAnswer(raw []byte) (RedeemAnswer, int, error) { + var v RedeemAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeConfirmAnswer reads a ConfirmAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeConfirmAnswer(raw []byte) (ConfirmAnswer, int, error) { + var v ConfirmAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRevokeAnswer reads a RevokeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRevokeAnswer(raw []byte) (RevokeAnswer, int, error) { + var v RevokeAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeTokensAnswer reads a TokensAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeTokensAnswer(raw []byte) (TokensAnswer, int, error) { + var v TokensAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAgainAnswer reads a AgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAgainAnswer(raw []byte) (AgainAnswer, int, error) { + var v AgainAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeEnrolmentIssuedEvent reads a EnrolmentIssuedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEnrolmentIssuedEvent(raw []byte) (EnrolmentIssuedEvent, int, error) { + var v EnrolmentIssuedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeNodeEnrolledEvent reads a NodeEnrolledEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeNodeEnrolledEvent(raw []byte) (NodeEnrolledEvent, int, error) { + var v NodeEnrolledEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeEnrolmentRefusedEvent reads a EnrolmentRefusedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEnrolmentRefusedEvent(raw []byte) (EnrolmentRefusedEvent, int, error) { + var v EnrolmentRefusedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeEnrolmentRevokedEvent reads a EnrolmentRevokedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEnrolmentRevokedEvent(raw []byte) (EnrolmentRevokedEvent, int, error) { + var v EnrolmentRevokedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeEnrolmentExpiredEvent reads a EnrolmentExpiredEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEnrolmentExpiredEvent(raw []byte) (EnrolmentExpiredEvent, int, error) { + var v EnrolmentExpiredEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/identity-and-access/go/seats/meshvault/contract.go b/identity-and-access/go/seats/meshvault/contract.go index 8529393..5323691 100644 --- a/identity-and-access/go/seats/meshvault/contract.go +++ b/identity-and-access/go/seats/meshvault/contract.go @@ -4,9 +4,7 @@ package meshvault import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "mesh-vault" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "1b55f695820faf0b8d358617daeba7d5c8ed27ac41b7e9d024c83f28201ad0d0" +) + const ( VerbGet = "get" VerbSecretAsk = "secret-ask" @@ -126,18 +135,13 @@ func ParseSignersByKeyKey(key string) bool { return true } -// DecodeSignersByKeyValue reads one value of the state signers under the form "key", refusing a field SignersByKeyValue does not know and any text after the value. -func DecodeSignersByKeyValue(raw []byte) (SignersByKeyValue, error) { +// DecodeSignersByKeyValue reads one value of the state signers under the form "key" as another part wrote it: a field SignersByKeyValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSignersByKeyValue(raw []byte) (SignersByKeyValue, int, error) { var v SignersByKeyValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // SignersByAuthorityKey is the key of one value of the state signers under the form "authority". @@ -156,18 +160,13 @@ func ParseSignersByAuthorityKey(key string) bool { return true } -// DecodeSignersByAuthorityValue reads one value of the state signers under the form "authority", refusing a field SignersByAuthorityValue does not know and any text after the value. -func DecodeSignersByAuthorityValue(raw []byte) (SignersByAuthorityValue, error) { +// DecodeSignersByAuthorityValue reads one value of the state signers under the form "authority" as another part wrote it: a field SignersByAuthorityValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSignersByAuthorityValue(raw []byte) (SignersByAuthorityValue, int, error) { var v SignersByAuthorityValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // NodeLoginsByNodeKey is the key of one value of the state node-logins under the form "". @@ -187,18 +186,13 @@ func ParseNodeLoginsByNodeKey(key string) (string, bool) { return v0, true } -// DecodeNodeLoginsByNodeValue reads one value of the state node-logins under the form "", refusing a field NodeLoginsByNodeValue does not know and any text after the value. -func DecodeNodeLoginsByNodeValue(raw []byte) (NodeLoginsByNodeValue, error) { +// DecodeNodeLoginsByNodeValue reads one value of the state node-logins under the form "" as another part wrote it: a field NodeLoginsByNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeNodeLoginsByNodeValue(raw []byte) (NodeLoginsByNodeValue, int, error) { var v NodeLoginsByNodeValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // GetInput is what get takes. @@ -363,6 +357,8 @@ type SignAnswer struct { Certificate string `json:"certificate,omitempty"` // sha256: of the bytes signed Digest string `json:"digest"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // node-certificate or enrolment, as asked Kind string `json:"kind"` // the machine, for a node certificate @@ -421,6 +417,8 @@ type EnrolmentTokenAnswer struct { Dropped bool `json:"dropped,omitempty"` // the fingerprint of the bus's certificate Fingerprint string `json:"fingerprint,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the node the token is for Node string `json:"node"` // the token sealed to the operator key, when asked sealed, relayed as it is @@ -451,6 +449,8 @@ const ( type NodeAccountAnswer struct { // the account sealed to the node's sealing key, in base64 Account string `json:"account,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the login minted Login string `json:"login,omitempty"` // the joining node @@ -504,6 +504,8 @@ type RetireInput struct { // RetireAnswer is what retire answers. type RetireAnswer struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the secret is gone Retired bool `json:"retired"` } @@ -546,6 +548,8 @@ type SignedHolderEvent struct { Caller string `json:"caller"` // sha256: of the bytes signed Digest string `json:"digest"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // node-certificate or enrolment Kind string `json:"kind"` // the machine, for a node certificate @@ -560,6 +564,8 @@ type OwnRetiredHolderEvent struct { Ask string `json:"ask,omitempty"` // the caller the vault proved Caller string `json:"caller"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the module Module string `json:"module"` // the secret's name @@ -571,6 +577,8 @@ type OwnRetiredHolderEvent struct { // SignersByKeyValue is one value of the state signers under the key key. type SignersByKeyValue struct { Fingerprint string `json:"fingerprint"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the signing key's public half, standard base64 Key string `json:"key"` Made time.Time `json:"made"` @@ -580,15 +588,19 @@ type SignersByKeyValue struct { // SignersByAuthorityValue is one value of the state signers under the key authority. type SignersByAuthorityValue struct { // the authority certificate, PEM - Certificate string `json:"certificate"` - Fingerprint string `json:"fingerprint"` - Made time.Time `json:"made"` - V int64 `json:"v,omitempty"` + Certificate string `json:"certificate"` + Fingerprint string `json:"fingerprint"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Made time.Time `json:"made"` + V int64 `json:"v,omitempty"` } // NodeLoginsByNodeValue is one value of the state node-logins under the key . type NodeLoginsByNodeValue struct { Acts []string `json:"acts,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // the user list's revision that held both logins, from ready on ListRevision int64 `json:"list-revision,omitempty"` // the login in use @@ -601,3 +613,185 @@ type NodeLoginsByNodeValue struct { Stage string `json:"stage,omitempty"` V int64 `json:"v,omitempty"` } + +// DecodeGetAnswer reads a GetAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeGetAnswer(raw []byte) (GetAnswer, int, error) { + var v GetAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSecretAskAnswer reads a SecretAskAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSecretAskAnswer(raw []byte) (SecretAskAnswer, int, error) { + var v SecretAskAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeIssuedAnswer reads a IssuedAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeIssuedAnswer(raw []byte) (IssuedAnswer, int, error) { + var v IssuedAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRotateAnswer reads a RotateAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRotateAnswer(raw []byte) (RotateAnswer, int, error) { + var v RotateAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeMoveInAnswer reads a MoveInAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeMoveInAnswer(raw []byte) (MoveInAnswer, int, error) { + var v MoveInAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeNodeKeyAnswer reads a NodeKeyAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeNodeKeyAnswer(raw []byte) (NodeKeyAnswer, int, error) { + var v NodeKeyAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeOwnAnswer reads a OwnAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeOwnAnswer(raw []byte) (OwnAnswer, int, error) { + var v OwnAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeIssueAccountAnswer reads a IssueAccountAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeIssueAccountAnswer(raw []byte) (IssueAccountAnswer, int, error) { + var v IssueAccountAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSignAnswer reads a SignAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSignAnswer(raw []byte) (SignAnswer, int, error) { + var v SignAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeEnrolmentTokenAnswer reads a EnrolmentTokenAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeEnrolmentTokenAnswer(raw []byte) (EnrolmentTokenAnswer, int, error) { + var v EnrolmentTokenAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeNodeAccountAnswer reads a NodeAccountAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeNodeAccountAnswer(raw []byte) (NodeAccountAnswer, int, error) { + var v NodeAccountAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRotateNodeAnswer reads a RotateNodeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRotateNodeAnswer(raw []byte) (RotateNodeAnswer, int, error) { + var v RotateNodeAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeNodeAccountConfirmAnswer reads a NodeAccountConfirmAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeNodeAccountConfirmAnswer(raw []byte) (NodeAccountConfirmAnswer, int, error) { + var v NodeAccountConfirmAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAbandonAnswer reads a AbandonAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAbandonAnswer(raw []byte) (AbandonAnswer, int, error) { + var v AbandonAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeRetireAnswer reads a RetireAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeRetireAnswer(raw []byte) (RetireAnswer, int, error) { + var v RetireAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeLicencePutAnswer reads a LicencePutAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeLicencePutAnswer(raw []byte) (LicencePutAnswer, int, error) { + var v LicencePutAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeOwnPutAnswer reads a OwnPutAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeOwnPutAnswer(raw []byte) (OwnPutAnswer, int, error) { + var v OwnPutAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeSignedHolderEvent reads a SignedHolderEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeSignedHolderEvent(raw []byte) (SignedHolderEvent, int, error) { + var v SignedHolderEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeOwnRetiredHolderEvent reads a OwnRetiredHolderEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeOwnRetiredHolderEvent(raw []byte) (OwnRetiredHolderEvent, int, error) { + var v OwnRetiredHolderEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/identity-and-access/ts/seats/meshgrants/index.d.ts b/identity-and-access/ts/seats/meshgrants/index.d.ts index 899e889..ef9ee7a 100644 --- a/identity-and-access/ts/seats/meshgrants/index.d.ts +++ b/identity-and-access/ts/seats/meshgrants/index.d.ts @@ -32,6 +32,8 @@ export interface Fill { "bytes": number; /** bytes */ "cap": number; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the store */ "store": string; } @@ -53,6 +55,8 @@ export interface GrantsForModulesItem { export interface GrantsFor { /** why it could not be answered: the catalog half of the candidate is not held */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "modules"?: GrantsForModulesItem[]; } @@ -64,6 +68,8 @@ export interface Wait { "by"?: string; /** when the new version's build was done, as the builder's build.ended says; the bound's clock starts there (design 47 G 266) */ "clock-from": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the entry's fingerprint, whose grant waits */ "fp"?: string; /** on wait-ended: ran or released */ @@ -86,6 +92,8 @@ export interface WithheldModulesItem { /** a node's withheld subjects, by module */ export interface Withheld { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "modules": WithheldModulesItem[]; "node": string; } diff --git a/identity-and-access/ts/seats/meshnodeenroller/index.d.ts b/identity-and-access/ts/seats/meshnodeenroller/index.d.ts index 2314949..d68a18e 100644 --- a/identity-and-access/ts/seats/meshnodeenroller/index.d.ts +++ b/identity-and-access/ts/seats/meshnodeenroller/index.d.ts @@ -55,6 +55,8 @@ export interface Enrolment { "ask"?: string; "caller"?: string; "expires"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "issued"?: string; "keys-digest"?: string; "node": string; @@ -106,6 +108,8 @@ export interface RedeemAnswer { "account": string; /** its certificate, PEM */ "certificate": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the login it dials as next */ "login": string; /** the node */ @@ -175,6 +179,8 @@ export type EnrolmentsByNodeNodeValue = Enrolment; /** is one value of the state enrolments under the key address.
. */ export interface EnrolmentsByAddressAddressValue { "ask"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "issued"?: string; "node": string; "v"?: number; diff --git a/identity-and-access/ts/seats/meshvault/index.d.ts b/identity-and-access/ts/seats/meshvault/index.d.ts index 6485559..1dc2081 100644 --- a/identity-and-access/ts/seats/meshvault/index.d.ts +++ b/identity-and-access/ts/seats/meshvault/index.d.ts @@ -244,6 +244,8 @@ export interface SignAnswer { "certificate"?: string; /** sha256: of the bytes signed */ "digest": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** node-certificate or enrolment, as asked */ "kind": string; /** the machine, for a node certificate */ @@ -290,6 +292,8 @@ export interface EnrolmentTokenAnswer { "dropped"?: boolean; /** the fingerprint of the bus's certificate */ "fingerprint"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node the token is for */ "node": string; /** the token sealed to the operator key, when asked sealed, relayed as it is */ @@ -314,6 +318,8 @@ export interface NodeAccountInput { export interface NodeAccountAnswer { /** the account sealed to the node's sealing key, in base64 */ "account"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the login minted */ "login"?: string; /** the joining node */ @@ -367,6 +373,8 @@ export interface RetireInput { /** is what retire answers. */ export interface RetireAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the secret is gone */ "retired": boolean; } @@ -409,6 +417,8 @@ export interface SignedHolderEvent { "caller": string; /** sha256: of the bytes signed */ "digest": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** node-certificate or enrolment */ "kind": string; /** the machine, for a node certificate */ @@ -423,6 +433,8 @@ export interface OwnRetiredHolderEvent { "ask"?: string; /** the caller the vault proved */ "caller": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the module */ "module": string; /** the secret's name */ @@ -434,6 +446,8 @@ export interface OwnRetiredHolderEvent { /** is one value of the state signers under the key key. */ export interface SignersByKeyValue { "fingerprint": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the signing key's public half, standard base64 */ "key": string; "made": string; @@ -445,6 +459,8 @@ export interface SignersByAuthorityValue { /** the authority certificate, PEM */ "certificate": string; "fingerprint": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "made": string; "v"?: number; } @@ -452,6 +468,8 @@ export interface SignersByAuthorityValue { /** is one value of the state node-logins under the key . */ export interface NodeLoginsByNodeValue { "acts"?: string[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the user list's revision that held both logins, from ready on */ "list-revision"?: number; /** the login in use */ diff --git a/operator-and-conversation/go/seats/operatorchannel/contract.go b/operator-and-conversation/go/seats/operatorchannel/contract.go index 5a47633..fa5faca 100644 --- a/operator-and-conversation/go/seats/operatorchannel/contract.go +++ b/operator-and-conversation/go/seats/operatorchannel/contract.go @@ -4,9 +4,7 @@ package operatorchannel import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "operator-channel" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "5447f2572c926558eb1532038108cddeded16377f9d1dee5c0f1aafb856b3ce2" +) + const ( VerbOpen = "open" VerbHistory = "history" @@ -108,18 +117,13 @@ func ParseAsksByAskerIDKey(key string) (string, string, bool) { return v0, v2, true } -// DecodeAsksByAskerIDValue reads one value of the state asks under the form ".", refusing a field AsksByAskerIDValue does not know and any text after the value. -func DecodeAsksByAskerIDValue(raw []byte) (AsksByAskerIDValue, error) { +// DecodeAsksByAskerIDValue reads one value of the state asks under the form "." as another part wrote it: a field AsksByAskerIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAsksByAskerIDValue(raw []byte) (AsksByAskerIDValue, int, error) { var v AsksByAskerIDValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // Ask is a type of the contract. @@ -346,6 +350,8 @@ type Warrant struct { By *Person `json:"by,omitempty"` // the module it came through Channel string `json:"channel,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // its label Label string `json:"label,omitempty"` // its level @@ -453,6 +459,8 @@ type AsksAnswer struct { Asks []AsksAnswerAsksItem `json:"asks"` // what the bound cut, and how to ask for more; empty when nothing was cut Cut string `json:"cut,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // how many asks the arguments matched Matched int64 `json:"matched,omitempty"` } @@ -478,6 +486,8 @@ type OfferedHolderEvent struct { Asker string `json:"asker"` // the channels it was offered on Channels []string `json:"channels,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // its headline Headline string `json:"headline,omitempty"` // the ask's id @@ -488,7 +498,9 @@ type OfferedHolderEvent struct { type ClosedHolderEvent struct { // its asker Asker string `json:"asker"` - How string `json:"how"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + How string `json:"how"` // the ask's id ID string `json:"id"` } @@ -514,6 +526,8 @@ type AsksByAskerIDValue struct { At string `json:"at,omitempty"` // when it ends unanswered, RFC 3339 Expires string `json:"expires"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` // its headline Headline string `json:"headline"` // . @@ -526,3 +540,86 @@ type AsksByAskerIDValue struct { State string `json:"state"` Warrant *Warrant `json:"warrant,omitempty"` } + +// DecodeOpenAnswer reads a OpenAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeOpenAnswer(raw []byte) (OpenAnswer, int, error) { + var v OpenAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeHistoryAnswer reads a HistoryAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeHistoryAnswer(raw []byte) (HistoryAnswer, int, error) { + var v HistoryAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeNotifyAnswer reads a NotifyAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeNotifyAnswer(raw []byte) (NotifyAnswer, int, error) { + var v NotifyAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeTellAnswer reads a TellAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeTellAnswer(raw []byte) (TellAnswer, int, error) { + var v TellAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeAsksAnswer reads a AsksAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeAsksAnswer(raw []byte) (AsksAnswer, int, error) { + var v AsksAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeDecidedEvent reads a DecidedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeDecidedEvent(raw []byte) (DecidedEvent, int, error) { + var v DecidedEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeOfferedHolderEvent reads a OfferedHolderEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeOfferedHolderEvent(raw []byte) (OfferedHolderEvent, int, error) { + var v OfferedHolderEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// DecodeClosedHolderEvent reads a ClosedHolderEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeClosedHolderEvent(raw []byte) (ClosedHolderEvent, int, error) { + var v ClosedHolderEvent + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/operator-and-conversation/ts/seats/operatorchannel/index.d.ts b/operator-and-conversation/ts/seats/operatorchannel/index.d.ts index 7e79cf5..6bd9a09 100644 --- a/operator-and-conversation/ts/seats/operatorchannel/index.d.ts +++ b/operator-and-conversation/ts/seats/operatorchannel/index.d.ts @@ -271,6 +271,8 @@ export interface Warrant { "by"?: Person; /** the module it came through */ "channel"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** its label */ "label"?: string; /** its level */ @@ -362,6 +364,8 @@ export interface AsksAnswer { "asks": AsksAnswerAsksItem[]; /** what the bound cut, and how to ask for more; empty when nothing was cut */ "cut"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** how many asks the arguments matched */ "matched"?: number; } @@ -387,6 +391,8 @@ export interface OfferedHolderEvent { "asker": string; /** the channels it was offered on */ "channels"?: string[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** its headline */ "headline"?: string; /** the ask's id */ @@ -397,6 +403,8 @@ export interface OfferedHolderEvent { export interface ClosedHolderEvent { /** its asker */ "asker": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "how": "answered" | "expired" | "cancelled" | "replaced" | "unlinked"; /** the ask's id */ "id": string; @@ -414,6 +422,8 @@ export interface AsksByAskerIDValue { "at"?: string; /** when it ends unanswered, RFC 3339 */ "expires": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** its headline */ "headline": string; /** . */ diff --git a/provisioning/go/seats/meshprovisioner/contract.go b/provisioning/go/seats/meshprovisioner/contract.go index 7e2325e..2e39b79 100644 --- a/provisioning/go/seats/meshprovisioner/contract.go +++ b/provisioning/go/seats/meshprovisioner/contract.go @@ -4,9 +4,7 @@ package meshprovisioner import ( - "bytes" "encoding/json" - "errors" "strings" "time" ) @@ -14,6 +12,17 @@ import ( // Seat is the seat's name. const Seat = "mesh-provisioner" +// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): +// a reader of a value of another form says "form N, this reader knows M". +const Form = 1 + +// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition +// whose fields changed while its forms did not (design 47 H2 §780). +const ( + generatedForms = "1" + generatedFieldsDigest = "878e1ffd0497bd99a1544b43596e8317c72417540badaef82999fe69e55202b6" +) + const ( VerbProvisioning = "provisioning" ) @@ -50,18 +59,13 @@ func ParsePlansByNodeModuleKey(key string) (string, string, bool) { return v0, v2, true } -// DecodePlansByNodeModuleValue reads one value of the state plans under the form ".", refusing a field PlansByNodeModuleValue does not know and any text after the value. -func DecodePlansByNodeModuleValue(raw []byte) (PlansByNodeModuleValue, error) { +// DecodePlansByNodeModuleValue reads one value of the state plans under the form "." as another part wrote it: a field PlansByNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodePlansByNodeModuleValue(raw []byte) (PlansByNodeModuleValue, int, error) { var v PlansByNodeModuleValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // ProvisionsByNodeConsumerProvisionKey is the key of one value of the state provisions under the form "..". @@ -93,18 +97,13 @@ func ParseProvisionsByNodeConsumerProvisionKey(key string) (string, string, stri return v0, v2, v4, true } -// DecodeProvisionsByNodeConsumerProvisionValue reads one value of the state provisions under the form "..", refusing a field ProvisionsByNodeConsumerProvisionValue does not know and any text after the value. -func DecodeProvisionsByNodeConsumerProvisionValue(raw []byte) (ProvisionsByNodeConsumerProvisionValue, error) { +// DecodeProvisionsByNodeConsumerProvisionValue reads one value of the state provisions under the form ".." as another part wrote it: a field ProvisionsByNodeConsumerProvisionValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProvisionsByNodeConsumerProvisionValue(raw []byte) (ProvisionsByNodeConsumerProvisionValue, int, error) { var v ProvisionsByNodeConsumerProvisionValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // ProvisionsByNodeConsumerProvisionLocalKey is the key of one value of the state provisions under the form "...". @@ -141,18 +140,13 @@ func ParseProvisionsByNodeConsumerProvisionLocalKey(key string) (string, string, return v0, v2, v4, v6, true } -// DecodeProvisionsByNodeConsumerProvisionLocalValue reads one value of the state provisions under the form "...", refusing a field ProvisionsByNodeConsumerProvisionLocalValue does not know and any text after the value. -func DecodeProvisionsByNodeConsumerProvisionLocalValue(raw []byte) (ProvisionsByNodeConsumerProvisionLocalValue, error) { +// DecodeProvisionsByNodeConsumerProvisionLocalValue reads one value of the state provisions under the form "..." as another part wrote it: a field ProvisionsByNodeConsumerProvisionLocalValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProvisionsByNodeConsumerProvisionLocalValue(raw []byte) (ProvisionsByNodeConsumerProvisionLocalValue, int, error) { var v ProvisionsByNodeConsumerProvisionLocalValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil + return v, formRead(raw), nil } // ProvisioningInput is what provisioning takes. @@ -172,6 +166,8 @@ type ProvisioningAnswer = map[string]any // PlansByNodeModuleValue is one value of the state plans under the key .. type PlansByNodeModuleValue struct { + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` Module string `json:"module"` Node string `json:"node"` // the module's plan @@ -230,7 +226,9 @@ type ProvisionsByNodeConsumerProvisionValue struct { At time.Time `json:"at"` Consumer ProvisionsByNodeConsumerProvisionValueConsumer `json:"consumer"` DependsOn []string `json:"depends-on,omitempty"` - Local string `json:"local,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Local string `json:"local,omitempty"` // the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126) Plan *ProvisionsByNodeConsumerProvisionValuePlan `json:"plan,omitempty"` Provider ProvisionsByNodeConsumerProvisionValueProvider `json:"provider"` @@ -302,7 +300,9 @@ type ProvisionsByNodeConsumerProvisionLocalValue struct { At time.Time `json:"at"` Consumer ProvisionsByNodeConsumerProvisionLocalValueConsumer `json:"consumer"` DependsOn []string `json:"depends-on,omitempty"` - Local string `json:"local,omitempty"` + // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). + Form int64 `json:"form,omitempty"` + Local string `json:"local,omitempty"` // the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126) Plan *ProvisionsByNodeConsumerProvisionLocalValuePlan `json:"plan,omitempty"` Provider ProvisionsByNodeConsumerProvisionLocalValueProvider `json:"provider"` @@ -322,3 +322,23 @@ const ( ProvisionsByNodeConsumerProvisionLocalValueStateFailed = "failed" ProvisionsByNodeConsumerProvisionLocalValueStateRetiring = "retiring" ) + +// DecodeProvisioningAnswer reads a ProvisioningAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780). +func DecodeProvisioningAnswer(raw []byte) (ProvisioningAnswer, int, error) { + var v ProvisioningAnswer + if err := json.Unmarshal(raw, &v); err != nil { + return v, 0, err + } + return v, formRead(raw), nil +} + +// formRead is the form a value says on the wire: 1 when it says none, or is no object. +func formRead(raw []byte) int { + var f struct { + Form int `json:"form"` + } + if json.Unmarshal(raw, &f) != nil || f.Form < 1 { + return 1 + } + return f.Form +} diff --git a/provisioning/ts/seats/meshprovisioner/index.d.ts b/provisioning/ts/seats/meshprovisioner/index.d.ts index f262167..b184c90 100644 --- a/provisioning/ts/seats/meshprovisioner/index.d.ts +++ b/provisioning/ts/seats/meshprovisioner/index.d.ts @@ -48,6 +48,8 @@ export type ProvisioningAnswer = Record; /** is one value of the state plans under the key .. */ export interface PlansByNodeModuleValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "module": string; "node": string; /** the module's plan */ @@ -102,6 +104,8 @@ export interface ProvisionsByNodeConsumerProvisionValue { "at": string; "consumer": ProvisionsByNodeConsumerProvisionValueConsumer; "depends-on"?: string[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "local"?: string; /** the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126) */ "plan"?: ProvisionsByNodeConsumerProvisionValuePlan; @@ -161,6 +165,8 @@ export interface ProvisionsByNodeConsumerProvisionLocalValue { "at": string; "consumer": ProvisionsByNodeConsumerProvisionLocalValueConsumer; "depends-on"?: string[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "local"?: string; /** the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126) */ "plan"?: ProvisionsByNodeConsumerProvisionLocalValuePlan; diff --git a/ts/seats/meshbroker/index.d.ts b/ts/seats/meshbroker/index.d.ts index 5edf309..1e104f3 100644 --- a/ts/seats/meshbroker/index.d.ts +++ b/ts/seats/meshbroker/index.d.ts @@ -122,6 +122,8 @@ export interface Held { /** its own configuration, where no template fits */ "configuration"?: Record; "fill"?: Fill; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** its local name in the module's manifest */ "local-name": string; /** the module asking it */ @@ -157,6 +159,8 @@ export interface Said { /** its own configuration, where no template fits */ "configuration"?: Record; "fill"?: Fill; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the settings held */ "held"?: Record; /** its local name in the module's manifest */ @@ -207,6 +211,8 @@ export interface ListAnswer { "caps"?: ListAnswerCaps; /** every entry */ "entries": Held[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what show takes. */ @@ -238,6 +244,8 @@ export interface CheckAnswerDifferencesItem { export interface CheckAnswer { /** every difference */ "differences": CheckAnswerDifferencesItem[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what orphans takes. */ @@ -248,6 +256,8 @@ export interface OrphansInput { export interface OrphansAnswer { /** every orphan */ "entries": Held[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what create takes. */ @@ -275,6 +285,8 @@ export type DropInput = Warranted; export interface DropAnswer { /** it is gone */ "dropped": boolean; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the snapshot taken first */ "snapshot"?: string; } @@ -297,6 +309,8 @@ export interface SnapshotGetAnswer { "digest"?: string; /** why not: snapshot damaged, snapshot missing, snapshot protected or snapshot taken before milestone G; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the entry's local name */ "local"?: string; "module"?: string; @@ -324,6 +338,8 @@ export interface SnapshotRestoreAnswer { "busy"?: string; /** why not; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what snapshot-restore-cancel takes. */ @@ -342,6 +358,8 @@ export interface SnapshotRestoreCancelAnswer { "busy"?: string; /** why not; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what snapshot-remove takes. */ @@ -362,6 +380,8 @@ export interface SnapshotRemoveAnswer { "busy"?: string; /** why not; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is the body of the event created. */ @@ -396,6 +416,8 @@ export interface SnapshotRestoredEvent { "act": string; /** when failed */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "outcome": "done" | "failed"; "request": string; } diff --git a/ts/seats/meshconfig/index.d.ts b/ts/seats/meshconfig/index.d.ts index 5f94352..c84fa1e 100644 --- a/ts/seats/meshconfig/index.d.ts +++ b/ts/seats/meshconfig/index.d.ts @@ -78,6 +78,8 @@ export interface RenamesAnswerRenamesItem { /** is what renames answers. */ export interface RenamesAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** every open rename */ "renames": RenamesAnswerRenamesItem[]; } @@ -86,6 +88,8 @@ export interface RenamesAnswer { export interface RenamedHolderEvent { /** when, RFC 3339 */ "at": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the old name */ "from": string; /** the module */ @@ -98,6 +102,8 @@ export interface RenamedHolderEvent { export interface RetiringHolderEvent { /** the ask's id */ "ask"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the value's or secret's name */ "key": string; "kind": "value" | "secret"; @@ -111,6 +117,8 @@ export interface RetiringHolderEvent { export interface RetiredHolderEvent { /** the ask's id */ "ask"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the module */ "module": string; /** the name */ @@ -121,6 +129,8 @@ export interface RetiredHolderEvent { /** is one value of the state resolved under the key ... */ export interface ResolvedByNodeModuleKeyValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "key": string; "module": string; "node": string; diff --git a/ts/seats/meshmoduleassigner/index.d.ts b/ts/seats/meshmoduleassigner/index.d.ts index 0246651..dfde0ae 100644 --- a/ts/seats/meshmoduleassigner/index.d.ts +++ b/ts/seats/meshmoduleassigner/index.d.ts @@ -117,6 +117,8 @@ export interface AssignmentsEventWarrant { export interface AssignmentsEvent { /** for assignments-withdrawn, why it ended */ "ended"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** for assignments-changed, by node the revisions before and after and the modules added, removed or changed */ "nodes"?: Record[]; "proposal": Proposal; @@ -212,6 +214,8 @@ export interface Proposal { "by": string; "changes": ProposalChange[]; "export-digest"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "hand-back"?: boolean; "id": string; "must"?: string[]; @@ -280,6 +284,8 @@ export interface SeatHoldersHoldersItem { /** one key of seat-holders */ export interface SeatHolders { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "holders": SeatHoldersHoldersItem[]; "node"?: string; /** the claim names no seat of the seat list */ @@ -378,6 +384,8 @@ export interface PlacementInput { /** is what placement answers. */ export interface PlacementAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** one per branch and build, the nodes that run the module from it */ "placements": ModulePlacement[]; } @@ -403,6 +411,8 @@ export interface AssignmentsByNodeNodeValueModulesItem { /** is one value of the state assignments under the key .node. */ export interface AssignmentsByNodeNodeValue { "decided": NodeDecided; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "holds"?: Holding[]; /** the modules placed, in the order the composition reads them */ "modules": AssignmentsByNodeNodeValueModulesItem[]; @@ -413,6 +423,8 @@ export interface AssignmentsByNodeNodeValue { /** is one value of the state assignments under the key .. */ export interface AssignmentsByNodeModuleValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "node": string; "placed": PlacedModule; /** the value it replaces while a write is under way */ @@ -429,6 +441,8 @@ export interface CandidatesByProposalNodeValue { "added"?: Record; /** the node's assignments with the proposal laid over it; absent when the proposal takes its key away */ "assignments"?: Assignments; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "proposal": string; /** the proposal changes this node's composition through another's key */ "reached"?: boolean; @@ -437,11 +451,15 @@ export interface CandidatesByProposalNodeValue { /** is one value of the state pulses under the key answer... */ export interface PulsesByAnswerProposalNodeValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "v"?: number; } /** is one value of the state pulses under the key ask.. */ export interface PulsesByAskProposalValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "v"?: number; } diff --git a/ts/seats/meshrecovery/index.d.ts b/ts/seats/meshrecovery/index.d.ts index a7b4310..611b9f0 100644 --- a/ts/seats/meshrecovery/index.d.ts +++ b/ts/seats/meshrecovery/index.d.ts @@ -155,6 +155,8 @@ export interface SnapshotKeptAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what restore-kept takes. */ @@ -183,6 +185,8 @@ export interface RestoreKeptAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what kept-points takes. */ @@ -196,6 +200,8 @@ export interface KeptPointsInput { /** is what kept-points answers. */ export interface KeptPointsAnswer { "asides": Aside[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "points": Point[]; "running"?: Running; /** the asides whose record ended at removed that no running act holds: the live data of those names is gone and only the aside holds it; the module's health check fails while one is listed (design 47 G 554, 657, A-129) */ @@ -224,6 +230,8 @@ export interface RestoreAsideAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what cancel takes. */ @@ -244,6 +252,8 @@ export interface CancelAnswer { "busy"?: string; /** why not, naming the step an act has begun; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what take takes. */ @@ -268,6 +278,8 @@ export interface TakeAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what restore takes. */ @@ -296,6 +308,8 @@ export interface RestoreAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what retry takes. */ @@ -318,6 +332,8 @@ export interface RetryAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what aside takes. */ @@ -340,6 +356,8 @@ export interface AsideAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what discard-aside takes. */ @@ -364,6 +382,8 @@ export interface DiscardAsideAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is what expire-points takes. */ @@ -382,6 +402,8 @@ export interface ExpirePointsAnswer { "busy"?: string; /** why it was not taken; set alone */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; } /** is the body of the event ended. */ @@ -447,6 +469,8 @@ export interface SetAsideEvent { "act": string; /** when it was said, RFC 3339 */ "at": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "id": string; /** the bus names it was live under, one per bus object */ "names": string[]; @@ -459,6 +483,8 @@ export interface AsideDiscardedEvent { "act": string; /** when it was said, RFC 3339 */ "at": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "id": string; /** the bus names it was live under, one per bus object */ "names": string[]; @@ -484,6 +510,8 @@ export interface ExpiryEndedEvent { "act": string; /** when it was said, RFC 3339 */ "at": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the number of points the run removed, 0 included */ "removed": number; } diff --git a/ts/seats/nodeengine/index.d.ts b/ts/seats/nodeengine/index.d.ts index 6858c26..d57e7eb 100644 --- a/ts/seats/nodeengine/index.d.ts +++ b/ts/seats/nodeengine/index.d.ts @@ -193,6 +193,8 @@ export interface ActSaid { "ask"?: string; /** the caller as the runtime proved it */ "caller": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node whose engine says it */ "node": string; /** what the engine said of it */ @@ -207,6 +209,8 @@ export interface ActSaid { export interface Acts { /** the acts, newest first */ "acts": Act[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node */ "node": string; } @@ -223,6 +227,8 @@ export interface Adoption { export interface Asked { /** the ask's id: acts shows where it stands */ "asked": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node */ "node": string; /** what happens next, in words */ @@ -297,6 +303,8 @@ export interface Composed { "digest": string; /** the fingerprint of the want composed */ "fingerprint": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the module */ "module": string; /** the node */ @@ -408,6 +416,8 @@ export type ManifestReadWord = "want:version"; export interface ManifestReadsChanged { /** when it says it, RFC 3339 */ "at": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** what its engine states it reads now */ "manifest-reads"?: string[]; /** the node */ @@ -552,6 +562,8 @@ export interface ProcessBuild { export interface ProcessBuilds { /** why they could not be read */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node */ "node": string; /** every process the node-engine started, by module */ @@ -618,6 +630,8 @@ export interface Running { "at": string; /** the fingerprint of the build it runs; none with stopped */ "fingerprint"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the health of the build that runs, as the node-engine's have holds it from the module's declared check (ADR 0240); a running with none, said by a node-engine of before design 47 G, reads as healthy (design 47 G 520). SeatsToPassOn reads none of it: an unhealthy holder still holds its seat */ "healthy"?: boolean | null; /** the digest of that build's manifest, the indexer's manifest of it, read by digest from the catalog half */ @@ -634,6 +648,8 @@ export interface Running { /** the answer of a read-only judgement */ export interface Said { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node */ "node": string; /** the engine's judgement or search, one line per directory or program */ @@ -665,6 +681,8 @@ export interface SeatListStatus { export interface SeatList { /** why the read failed, for seat-list-again */ "error"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the one line the engine says of it; empty when nothing waits */ "health": string; "status": SeatListStatus; @@ -718,6 +736,8 @@ export interface Wait { "bound"?: string; /** the time the bound counts from (design 47 G 266, 269, 498) */ "clock-from"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node waited on: the build node for a kept build; the subject's is the node that says it */ "node"?: string; /** what it waits on */ @@ -779,6 +799,8 @@ export interface RootFreeInput { /** is what root-free answers. */ export interface RootFreeAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** this machine's verdict */ "machines": RootVerdict[]; } @@ -819,6 +841,8 @@ export interface PackagesAnswerKey { /** is what packages answers. */ export interface PackagesAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the node's key as the bus holds it; absent when the engine wrote none */ "key"?: PackagesAnswerKey; /** why the key could not be read */ @@ -958,6 +982,8 @@ export interface CompositionAnswer { "composition": Revision; /** every resource that differs from what runs, when asked */ "diff"?: Record[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** what the module's have key says now; absent when it says nothing */ "have"?: CompositionAnswerHave; /** the move from what runs to the composition read */ @@ -996,6 +1022,8 @@ export interface CompositionDiffInput { /** is what composition-diff answers. */ export interface CompositionDiffAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the module */ "module": string; /** the node */ @@ -1031,6 +1059,8 @@ export interface ComposeAnswerPass { /** is what compose answers. */ export interface ComposeAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** how the pass went */ "pass": ComposeAnswerPass; /** the module whose apply was tried again */ @@ -1053,6 +1083,8 @@ export interface ComposeCandidateAnswer { "candidate": string; /** when asked with input and a call token: how many chunks of at most 512 KiB carry the composition input, sent on the chunk subject of the call, each acknowledged by the caller (design 47 G A-237b) */ "chunks"?: number; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** when asked without a call token: the composition input it composed from, inline, up to what one answer carries (the checker's form, kept until G removes the checker, G-6 section 321) */ "input"?: Record; /** every module placed on the node, sorted by name */ @@ -1076,6 +1108,8 @@ export interface ManifestReadsInput { /** is what manifest-reads answers. */ export interface ManifestReadsAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the reader capabilities its engine states: the manifest words, forms and seat names it reads; empty for an engine built before it said them, read as the baseline */ "manifest-reads"?: string[]; /** the node */ @@ -1107,6 +1141,8 @@ export interface ApplyOrderAnswerOrderItem { /** is what apply-order answers. */ export interface ApplyOrderAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** one row per unapplied changed want, in the order it will be applied */ "order": ApplyOrderAnswerOrderItem[]; } @@ -1153,6 +1189,8 @@ export interface FirstViewsAnswer { "entries": FirstViewsAnswerEntriesItem[]; /** one status per owner and state followed, as mesh-sdk's views runtime keeps it */ "first-views": Record[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the wants the node-engine keeps (design 47 G 683, 698) */ "wants": FirstViewsAnswerWantsItem[]; } @@ -1187,6 +1225,8 @@ export interface FirstViewAgainAnswerAsked { export interface FirstViewAgainAnswer { /** the hand ask written */ "asked": FirstViewAgainAnswerAsked; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the verb that reads the status, first-views */ "read": string; } @@ -1217,6 +1257,8 @@ export interface EntryAgainAnswerAsked { export interface EntryAgainAnswer { /** the hand ask written */ "asked": EntryAgainAnswerAsked; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the verb that reads the status, first-views */ "read": string; } @@ -1236,6 +1278,8 @@ export interface ConvergedInput { /** is what converged answers. */ export interface ConvergedAnswer { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the kind of the firewall found, for an adopted node */ "found"?: string; /** the links of this node that face outside, as the engine classifies them for its filter render (ADR 0140); an allowance with no interface never opens one */ @@ -1280,6 +1324,8 @@ export interface HaveByNodeModuleValue { /** the digest of the composition the node runs */ "composed"?: string; "detail"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; /** the fingerprint held */ "fp"?: string; "handed"?: AccountsHanded; @@ -1314,6 +1360,8 @@ export interface HaveByNodeNodeValue { "composes"?: string; "composes-why"?: string; "filters"?: Record[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "profile"?: Record; "record"?: NodeRecord; "sealed"?: string[]; @@ -1329,6 +1377,8 @@ export interface ComposedByNodeModuleFingerprintValue { "data"?: boolean; /** the files the provisioner fills */ "filled_files"?: string[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "fp": string; "module": string; "node": string; @@ -1349,6 +1399,8 @@ export interface ComposedByNodeNodeValue { "data"?: boolean; /** the files the provisioner fills */ "filled_files"?: string[]; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "node": string; "own"?: NodeOwn; /** the declaration resources, each saying its module */ @@ -1359,6 +1411,8 @@ export interface ComposedByNodeNodeValue { /** is one value of the state data under the key .. */ export interface DataByNodeModuleValue { "digest": string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "items": PlacedDataItem[]; "module": string; "node": string; @@ -1373,6 +1427,8 @@ export interface PackagesByNodeValuePackagesItem { /** is one value of the state packages under the key . */ export interface PackagesByNodeValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "node": string; "packages": PackagesByNodeValuePackagesItem[]; } @@ -1383,6 +1439,8 @@ export interface HealthByNodeValue { "at": string; "contract"?: number; "fallback"?: LoginFallback; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "found"?: NodeDirectory[]; "network"?: NetworkHealth; "node": string; @@ -1400,6 +1458,8 @@ export interface FindingsByKeyValue { /** newest first, at most 10 */ "evidence"?: FindingEvidence[]; "explanation"?: string; + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "headline"?: string; /** scope.id.token */ "key": string; @@ -1426,6 +1486,8 @@ export interface FindingsByKeyValue { /** is one value of the state bounds under the key .. */ export interface BoundsByWhatIDValue { + /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ + "form"?: number; "module"?: string; /** when the wait began, RFC 3339 */ "since": string; -- 2.54.0 From f070c8defa7ecd8bd4b10e0b66a3c954f4dae72d Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 00:15:31 +0100 Subject: [PATCH 4/8] H2 K: the node-engine's have carries the run a module was applied from MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine kept the composition run each module was applied from in its memory only, so a restarted engine applied an older run's want again. The have value, the record of what the engine applied, gains run, and the seat's form rises to 2. Packages generated again by mesh-delivery's seatgen (feat/47-H2 1f5b0f81, whose fields digest is per type: the other four packages' digest lines follow); seatgen -check clean. Builds: design 47 H2 §813 (1); H-A-352 (2), H-A-384 (2), H-A-388 (1) --- go/seats/meshbroker/contract.go | 2 +- go/seats/meshconfig/contract.go | 2 +- go/seats/meshmoduleassigner/contract.go | 2 +- go/seats/meshrecovery/contract.go | 2 +- go/seats/nodeengine/contract.go | 8 +++++--- go/seats/nodeengine/contract_test.go | 2 ++ seats/node-engine/fixtures/states.json | 11 +++++++++++ seats/node-engine/seat.json | 5 +++++ ts/seats/nodeengine/index.d.ts | 2 ++ 9 files changed, 29 insertions(+), 7 deletions(-) diff --git a/go/seats/meshbroker/contract.go b/go/seats/meshbroker/contract.go index 42a0752..f48b11d 100644 --- a/go/seats/meshbroker/contract.go +++ b/go/seats/meshbroker/contract.go @@ -19,7 +19,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "ddc1534e14865923e0c10a7670539ae3f11349c8f6282f31992d2b337d39c498" + generatedFieldsDigest = "ApplyAnswer=8dffab3194de Binding=cd356ee9a962 CheckAnswer=519b8ee727a7 CheckAnswerDifferencesItem=f1214fe7f583 CreateAnswer=8dffab3194de CreatedEvent=f590024f1e91 DriftClearedEvent=f590024f1e91 DriftedEvent=f590024f1e91 DropAnswer=11b840cfab23 DroppedEvent=f590024f1e91 Fill=936e8f87f007 FullClearedEvent=f590024f1e91 FullEvent=f590024f1e91 Held=aa3cc3256a35 ListAnswer=55c8f4280f36 ListAnswerCaps=3336d759c697 OrphanedEvent=f590024f1e91 OrphansAnswer=e07d84f80b9b RecreateAnswer=8dffab3194de RecreatedEvent=f590024f1e91 RefusedEvent=f590024f1e91 Said=36d398a25c4b ShowAnswer=8dffab3194de SnapshotGetAnswer=26aa379b4d18 SnapshotRemoveAnswer=535c7bf01ae7 SnapshotRestoreAnswer=535c7bf01ae7 SnapshotRestoreCancelAnswer=535c7bf01ae7 SnapshotRestoredEvent=36e3aab90c82" ) const ( diff --git a/go/seats/meshconfig/contract.go b/go/seats/meshconfig/contract.go index 7ea02fe..a6b2af2 100644 --- a/go/seats/meshconfig/contract.go +++ b/go/seats/meshconfig/contract.go @@ -19,7 +19,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "bb4b161b9473b00406c9f007cac28b4631fb96c4c1b16609f97b269d3e0cdae1" + generatedFieldsDigest = "ConfigAnswer=7538f2f5e68e RenamedHolderEvent=2f967997d9d0 RenamesAnswer=a8330ea7ee28 RenamesAnswerRenamesItem=7aa33a125ed8 ResolvedByNodeModuleKeyValue=6543f47665e3 RetiredHolderEvent=55e7aa07f9f5 RetiringHolderEvent=82baafab643b" ) const ( diff --git a/go/seats/meshmoduleassigner/contract.go b/go/seats/meshmoduleassigner/contract.go index 1860da1..98c3efd 100644 --- a/go/seats/meshmoduleassigner/contract.go +++ b/go/seats/meshmoduleassigner/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "f21389d1d8b60132bbc05b35395261c01260b7f09f20428722ecb6f888875640" + generatedFieldsDigest = "AddedModule=86d996df19e5 AgainAnswer=7538f2f5e68e Assignments=35d7df192c2c AssignmentsAnswer=7538f2f5e68e AssignmentsByNodeModuleValue=d1cd12b2f2c1 AssignmentsByNodeNodeValue=db6ec13499b1 AssignmentsByNodeNodeValueModulesItem=ff109e5089e1 AssignmentsChangedEvent=cba8c7b1146b AssignmentsEvent=dd2f1e6e7554 AssignmentsEventWarrant=d3a0ac80d144 AssignmentsJudgedEvent=cba8c7b1146b AssignmentsProposedEvent=cba8c7b1146b AssignmentsWithdrawnEvent=cba8c7b1146b CandidatesByProposalNodeValue=e9101198663c FoundTunnel=59407b3b9e91 FoundTunnelPeer=e2c1bf409d9b Holding=83dfb6708156 ModulePlacement=de58899ce871 NodeDecided=b11afd08e31b PlacedModule=8028d613f043 PlacementAnswer=dc2681a31254 Proposal=22b1f754d84c ProposalChange=061c4d347de3 ProposalChangeKeys=5509aa3ebbbf ProposalsAnswer=7538f2f5e68e ProposalsByProposalValue=adf5f375b486 ProposeAnswer=7538f2f5e68e Provider=04872f6afbfa PulsesByAnswerProposalNodeValue=70085a06db0a PulsesByAskProposalValue=70085a06db0a SeatHolders=75c827768704 SeatHoldersBySeatNodeValue=a22be181bc1e SeatHoldersBySeatValue=a22be181bc1e SeatHoldersHoldersItem=04872f6afbfa Verdict=17b6e2d41196 Warrant=df8d847f9c5e WithdrawAnswer=7538f2f5e68e" ) const ( diff --git a/go/seats/meshrecovery/contract.go b/go/seats/meshrecovery/contract.go index f7ad0b1..9d211c4 100644 --- a/go/seats/meshrecovery/contract.go +++ b/go/seats/meshrecovery/contract.go @@ -19,7 +19,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "855ed5958d0dac251a91148faf0c58ad9dbfa3e86d86aef6c847b8c5de001e81" + generatedFieldsDigest = "Aside=eb9c3fd78fc5 AsideAnswer=535c7bf01ae7 AsideDiscardedEvent=5871c0d7b2cb CancelAnswer=535c7bf01ae7 CatchUp=8b9ebde56157 Consumer=0058e0ee3ac1 Digest=51e1c2d4fe38 DiscardAsideAnswer=535c7bf01ae7 EndedEvent=28018dc26cb2 ExpirePointsAnswer=535c7bf01ae7 ExpiryEndedEvent=22741c962c8b KeptPointsAnswer=17156623b320 Point=a365daf3118a PointRemovedEvent=233e3030a016 RestoreAnswer=535c7bf01ae7 RestoreAsideAnswer=535c7bf01ae7 RestoreKeptAnswer=535c7bf01ae7 RestoreStartedEvent=233e3030a016 RestoredEvent=b7b5e65d4597 RetryAnswer=535c7bf01ae7 Running=6392cdf4bf77 SetAsideEvent=5871c0d7b2cb SnapshotKeptAnswer=535c7bf01ae7 TakeAnswer=535c7bf01ae7" ) const ( diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index c853eec..bf5f026 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -14,13 +14,13 @@ const Seat = "node-engine" // Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): // a reader of a value of another form says "form N, this reader knows M". -const Form = 1 +const Form = 2 // The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition // whose fields changed while its forms did not (design 47 H2 §780). const ( - generatedForms = "1" - generatedFieldsDigest = "7aedbf50b5318425acb9a4ff0bcb65ab61b3e9276585934936cd2498a7117107" + generatedForms = "2" + generatedFieldsDigest = "AccessActAnswer=aba938323932 AccountsHanded=01f7505e0e41 Act=e6b24e6abd5f ActSaid=2bbc5ba1bb68 Acts=0f9a96c475ff ActsAnswer=ba7fb8de22ff Adoption=12d04d378fef ApplyOrderAnswer=24e631ec9059 ApplyOrderAnswerOrderItem=6cbde55cd9a7 Asked=9dc3b3e17562 AskedEvent=0e155c7e6cc6 AttachedNetwork=eb233c4eb030 BoundsByWhatIDValue=8fc4fb4c306c CandidateAdded=8a47761c2b87 CandidateAnswer=c4f359547d7c CandidateBodies=3212f3397a2f CandidateDiffers=eb09cbc3ccbd CandidateRefusal=e909c9f6cd19 ComposeAnswer=dc1b3a485ad8 ComposeAnswerPass=82e6b2612862 ComposeCandidateAnswer=dfbbe49d1170 Composed=a0496a1b4293 ComposedByNodeModuleFingerprintValue=c5232f26d312 ComposedByNodeNodeValue=92ce08a2aa61 ComposedEvent=c9a05c369a2d CompositionAnswer=455cbb2576bc CompositionAnswerAttempt=38f25294eb7f CompositionAnswerHave=2b07bbb37a49 CompositionAnswerJudged=ad566939781a CompositionAnswerOwn=a8154421db58 CompositionAnswerRuns=3a70c8e06e7e CompositionAnswerWant=aefc6253201d CompositionAnswerWithheldItem=28eae88e46de CompositionAnswerWithheldPartsItem=79f37133d5be CompositionDiffAnswer=b922d22f9cee CompositionDiffEntry=ac7c1fd3ea62 CompositionDiffResource=e31a58d6b2b5 ConvergedAnswer=378c6aea0436 DataByNodeModuleValue=155c8dd0a6e5 DeclaredGroup=22c955571ed0 DeclaredIdentity=442e5ea22995 DeclaredLibrary=234c8b6973d8 DoneEvent=0e155c7e6cc6 EntryAgainAnswer=1f1a24957164 EntryAgainAnswerAsked=bec32f015550 FailedUnit=4b7afe8c0f84 FindingAction=2bab6a7c8d3f FindingEvidence=f65231e1f862 FindingSubject=11e82b0a77d6 FindingsByKeyValue=41e93a483c67 FirstViewAgainAnswer=22627a4a4678 FirstViewAgainAnswerAsked=0fa827c2bc13 FirstViewsAnswer=3a1fe57c7be6 FirstViewsAnswerEntriesItem=8b117619ca3f FirstViewsAnswerWantsItem=d8cb80636647 HandOverAnswer=aba938323932 HaveByNodeModuleValue=256422cac3ca HaveByNodeNodeValue=9296a55d7aa6 HealthByNodeValue=03bfa8c83d5b JudgeDirectoriesAnswer=f590024f1e91 LoginFallback=78e280ece645 ManifestReadsAnswer=44ff978272b4 ManifestReadsChanged=fac832ea55d0 ManifestReadsChangedEvent=88e4af52759d Module=e604719b1fb3 NetworkHealth=3af75f8af8d7 NetworkPart=502939443fb6 NodeAccount=1faabd57fa41 NodeDirectory=12b7f58b657c NodeOwn=4fecee42b3c0 NodeRecord=961492151d72 PackagesAnswer=e4128836129d PackagesAnswerKey=60572f6eefc3 PackagesAnswerKeyPackagesItem=955a58e4952f PackagesByNodeValue=4cdc8f8bdc58 PackagesByNodeValuePackagesItem=955a58e4952f PeerSeen=43e6f359f1aa PlacedDataItem=82d650fb9d31 ProcessBuild=133a0f6e81cf ProcessBuilds=32cfa418abfd ProcessBuildsAnswer=4ac4ce32fbeb PullWait=99288cc066ec RefusedEvent=0e155c7e6cc6 Revision=165e37beccf5 RootAccountVerdict=7a8c0d2e5b9a RootFreeAnswer=c83678c70792 RootVerdict=0855e131d15c Running=8a19fd7f6446 RunningEvent=f3d8fedcfd51 Said=634cca3367f2 SealedBox=2c687c69b978 SeatList=248a1dc3029b SeatListAgainAnswer=8eb7fbcb7018 SeatListAnswer=8eb7fbcb7018 SeatListHeld=6b5c0f8ddcc2 SeatListStatus=bfbb572c49dd SetuidSearchAnswer=f590024f1e91 UnitsHealth=0d9cf7be9bc7 UserListWritten=caae94077890 Wait=fc85cf95ac27 WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0" ) const ( @@ -1701,6 +1701,8 @@ type HaveByNodeModuleValue struct { // how far it has come Phase string `json:"phase"` PullWait *PullWait `json:"pull-wait,omitempty"` + // the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again + Run string `json:"run,omitempty"` // each value sealed to the node's key Sealed []string `json:"sealed,omitempty"` // the sealed values by slot diff --git a/go/seats/nodeengine/contract_test.go b/go/seats/nodeengine/contract_test.go index 0e1072c..6299318 100644 --- a/go/seats/nodeengine/contract_test.go +++ b/go/seats/nodeengine/contract_test.go @@ -83,6 +83,8 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "a move waiting for a person's yes", subject: "", given: "{\"build-alone\":true,\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"judgement\":\"recreates\",\"kept\":[\"tool runner not declared\"],\"phase\":\"waiting-yes\",\"v\":1,\"waits\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"}", wire: "{\"build-alone\":true,\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"judgement\":\"recreates\",\"kept\":[\"tool runner not declared\"],\"phase\":\"waiting-yes\",\"v\":1,\"waits\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"}", decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "a module applied from a composition run names the run (design 47 H2 §813 (1), H-A-388)", subject: "", given: "{\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"phase\":\"running\",\"run\":\"178\",\"v\":1}", wire: "{\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"phase\":\"running\",\"run\":\"178\",\"v\":1}", + decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "the bus module's have carries the user list written (typed from the engine's values)", subject: "", given: "{\"health\":\"ok\",\"phase\":\"running\",\"user-list\":{\"at\":\"2026-11-05T12:00:00Z\",\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"follows\":\"grants\",\"handed\":{\"at\":\"2026-11-05T12:00:00Z\",\"box\":{\"ct\":\"c\",\"eph\":\"e\",\"iv\":\"i\",\"tag\":\"t\",\"v\":1},\"from\":\"ace\",\"to\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"users\":3},\"key\":\"-----BEGIN PUBLIC KEY-----\",\"revision\":7,\"source\":\"user-list\",\"users\":3,\"wanted\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"v\":1}", wire: "{\"health\":\"ok\",\"phase\":\"running\",\"user-list\":{\"at\":\"2026-11-05T12:00:00Z\",\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"follows\":\"grants\",\"handed\":{\"at\":\"2026-11-05T12:00:00Z\",\"box\":{\"ct\":\"c\",\"eph\":\"e\",\"iv\":\"i\",\"tag\":\"t\",\"v\":1},\"from\":\"ace\",\"to\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"users\":3},\"key\":\"-----BEGIN PUBLIC KEY-----\",\"revision\":7,\"source\":\"user-list\",\"users\":3,\"wanted\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"v\":1}", decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "a node's own facts with its record and an answer to a candidate (typed from the engine's values)", subject: "", given: "{\"candidates\":{\"p1\":{\"added\":[{\"module\":\"db\",\"unissued\":[\"db.secret\"]}],\"differs\":[{\"bodies\":[{\"id\":\"api.cfg\",\"paths\":[\"/etc/api.conf\"],\"why\":\"content\"}],\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"api\",\"running\":\"sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\"why\":\"a file differs\"}],\"proposal\":\"p1\",\"refusals\":[{\"module\":\"mail\",\"today\":\"runs\",\"why\":\"a value is missing\"}],\"removed\":[\"old\"],\"revision\":4,\"same\":[\"web\"],\"verdict\":\"differs\"}},\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"composes\":\"own\",\"record\":{\"capabilities\":[\"approval-mark/1\",\"docker\"],\"contract\":3,\"networks\":[{\"link\":\"eth0\",\"network\":\"192.0.2.0/24\"}],\"networks-said\":true,\"node\":\"ace\",\"runner-capabilities\":[\"approval-mark/1\"],\"runner-fingerprint\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tunnel-key\":\"k\",\"v\":1},\"v\":1}", wire: "{\"candidates\":{\"p1\":{\"added\":[{\"module\":\"db\",\"unissued\":[\"db.secret\"]}],\"differs\":[{\"bodies\":[{\"id\":\"api.cfg\",\"paths\":[\"/etc/api.conf\"],\"why\":\"content\"}],\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"api\",\"running\":\"sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\"why\":\"a file differs\"}],\"proposal\":\"p1\",\"refusals\":[{\"module\":\"mail\",\"today\":\"runs\",\"why\":\"a value is missing\"}],\"removed\":[\"old\"],\"revision\":4,\"same\":[\"web\"],\"verdict\":\"differs\"}},\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"composes\":\"own\",\"record\":{\"capabilities\":[\"approval-mark/1\",\"docker\"],\"contract\":3,\"networks\":[{\"link\":\"eth0\",\"network\":\"192.0.2.0/24\"}],\"networks-said\":true,\"node\":\"ace\",\"runner-capabilities\":[\"approval-mark/1\"],\"runner-fingerprint\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tunnel-key\":\"k\",\"v\":1},\"v\":1}", diff --git a/seats/node-engine/fixtures/states.json b/seats/node-engine/fixtures/states.json index f9b2f5b..7b9ffc1 100644 --- a/seats/node-engine/fixtures/states.json +++ b/seats/node-engine/fixtures/states.json @@ -345,6 +345,17 @@ ] } }, + { + "name": "a module applied from a composition run names the run (design 47 H2 §813 (1), H-A-388)", + "of": "state:have/.", + "given": { + "v": 1, + "fp": "src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275", + "phase": "running", + "health": "ok", + "run": "178" + } + }, { "name": "the bus module's have carries the user list written (typed from the engine's values)", "of": "state:have/.", diff --git a/seats/node-engine/seat.json b/seats/node-engine/seat.json index cb12b6f..10d9251 100644 --- a/seats/node-engine/seat.json +++ b/seats/node-engine/seat.json @@ -1,5 +1,6 @@ { "format": 1, + "form": 2, "seat": "node-engine", "scope": "node", "grain": "whole", @@ -1329,6 +1330,10 @@ "type": "boolean", "description": "the move changes the build alone" }, + "run": { + "type": "string", + "description": "the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again" + }, "kept": { "type": "array", "items": { diff --git a/ts/seats/nodeengine/index.d.ts b/ts/seats/nodeengine/index.d.ts index d57e7eb..531a442 100644 --- a/ts/seats/nodeengine/index.d.ts +++ b/ts/seats/nodeengine/index.d.ts @@ -1338,6 +1338,8 @@ export interface HaveByNodeModuleValue { /** how far it has come */ "phase": "backing-up" | "applying" | "checking" | "running" | "failed" | "removed" | "held" | "waiting-yes"; "pull-wait"?: PullWait; + /** the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again */ + "run"?: string; /** each value sealed to the node's key */ "sealed"?: string[]; /** the sealed values by slot */ -- 2.54.0 From e6ed560e48216024a0ab6851074c134e69a9bc2b Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 01:14:49 +0100 Subject: [PATCH 5/8] H2 K: the node record states the declaration Version its engine reads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The composer writes a node's declaration at the lower of its own Version and the one the node's engine reads, so an older engine never meets a Version it refuses; the node record gains declaration-reads, and the seat's form rises to 3. Generated with mesh-delivery's seatgen (feat/47-H2 1f5b0f81); seatgen -check clean. Builds: design 47 H2 §813 (12); H-A-416 (2), H-A-419 --- go/seats/nodeengine/contract.go | 26 ++++++++++++++------------ go/seats/nodeengine/contract_test.go | 2 +- seats/node-engine/fixtures/states.json | 1 + seats/node-engine/seat.json | 6 +++++- ts/seats/nodeengine/index.d.ts | 2 ++ 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index bf5f026..b8bfd9f 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -14,13 +14,13 @@ const Seat = "node-engine" // Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): // a reader of a value of another form says "form N, this reader knows M". -const Form = 2 +const Form = 3 // The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition // whose fields changed while its forms did not (design 47 H2 §780). const ( - generatedForms = "2" - generatedFieldsDigest = "AccessActAnswer=aba938323932 AccountsHanded=01f7505e0e41 Act=e6b24e6abd5f ActSaid=2bbc5ba1bb68 Acts=0f9a96c475ff ActsAnswer=ba7fb8de22ff Adoption=12d04d378fef ApplyOrderAnswer=24e631ec9059 ApplyOrderAnswerOrderItem=6cbde55cd9a7 Asked=9dc3b3e17562 AskedEvent=0e155c7e6cc6 AttachedNetwork=eb233c4eb030 BoundsByWhatIDValue=8fc4fb4c306c CandidateAdded=8a47761c2b87 CandidateAnswer=c4f359547d7c CandidateBodies=3212f3397a2f CandidateDiffers=eb09cbc3ccbd CandidateRefusal=e909c9f6cd19 ComposeAnswer=dc1b3a485ad8 ComposeAnswerPass=82e6b2612862 ComposeCandidateAnswer=dfbbe49d1170 Composed=a0496a1b4293 ComposedByNodeModuleFingerprintValue=c5232f26d312 ComposedByNodeNodeValue=92ce08a2aa61 ComposedEvent=c9a05c369a2d CompositionAnswer=455cbb2576bc CompositionAnswerAttempt=38f25294eb7f CompositionAnswerHave=2b07bbb37a49 CompositionAnswerJudged=ad566939781a CompositionAnswerOwn=a8154421db58 CompositionAnswerRuns=3a70c8e06e7e CompositionAnswerWant=aefc6253201d CompositionAnswerWithheldItem=28eae88e46de CompositionAnswerWithheldPartsItem=79f37133d5be CompositionDiffAnswer=b922d22f9cee CompositionDiffEntry=ac7c1fd3ea62 CompositionDiffResource=e31a58d6b2b5 ConvergedAnswer=378c6aea0436 DataByNodeModuleValue=155c8dd0a6e5 DeclaredGroup=22c955571ed0 DeclaredIdentity=442e5ea22995 DeclaredLibrary=234c8b6973d8 DoneEvent=0e155c7e6cc6 EntryAgainAnswer=1f1a24957164 EntryAgainAnswerAsked=bec32f015550 FailedUnit=4b7afe8c0f84 FindingAction=2bab6a7c8d3f FindingEvidence=f65231e1f862 FindingSubject=11e82b0a77d6 FindingsByKeyValue=41e93a483c67 FirstViewAgainAnswer=22627a4a4678 FirstViewAgainAnswerAsked=0fa827c2bc13 FirstViewsAnswer=3a1fe57c7be6 FirstViewsAnswerEntriesItem=8b117619ca3f FirstViewsAnswerWantsItem=d8cb80636647 HandOverAnswer=aba938323932 HaveByNodeModuleValue=256422cac3ca HaveByNodeNodeValue=9296a55d7aa6 HealthByNodeValue=03bfa8c83d5b JudgeDirectoriesAnswer=f590024f1e91 LoginFallback=78e280ece645 ManifestReadsAnswer=44ff978272b4 ManifestReadsChanged=fac832ea55d0 ManifestReadsChangedEvent=88e4af52759d Module=e604719b1fb3 NetworkHealth=3af75f8af8d7 NetworkPart=502939443fb6 NodeAccount=1faabd57fa41 NodeDirectory=12b7f58b657c NodeOwn=4fecee42b3c0 NodeRecord=961492151d72 PackagesAnswer=e4128836129d PackagesAnswerKey=60572f6eefc3 PackagesAnswerKeyPackagesItem=955a58e4952f PackagesByNodeValue=4cdc8f8bdc58 PackagesByNodeValuePackagesItem=955a58e4952f PeerSeen=43e6f359f1aa PlacedDataItem=82d650fb9d31 ProcessBuild=133a0f6e81cf ProcessBuilds=32cfa418abfd ProcessBuildsAnswer=4ac4ce32fbeb PullWait=99288cc066ec RefusedEvent=0e155c7e6cc6 Revision=165e37beccf5 RootAccountVerdict=7a8c0d2e5b9a RootFreeAnswer=c83678c70792 RootVerdict=0855e131d15c Running=8a19fd7f6446 RunningEvent=f3d8fedcfd51 Said=634cca3367f2 SealedBox=2c687c69b978 SeatList=248a1dc3029b SeatListAgainAnswer=8eb7fbcb7018 SeatListAnswer=8eb7fbcb7018 SeatListHeld=6b5c0f8ddcc2 SeatListStatus=bfbb572c49dd SetuidSearchAnswer=f590024f1e91 UnitsHealth=0d9cf7be9bc7 UserListWritten=caae94077890 Wait=fc85cf95ac27 WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0" + generatedForms = "3" + generatedFieldsDigest = "AccessActAnswer=aba938323932 AccountsHanded=01f7505e0e41 Act=e6b24e6abd5f ActSaid=2bbc5ba1bb68 Acts=0f9a96c475ff ActsAnswer=ba7fb8de22ff Adoption=12d04d378fef ApplyOrderAnswer=24e631ec9059 ApplyOrderAnswerOrderItem=6cbde55cd9a7 Asked=9dc3b3e17562 AskedEvent=0e155c7e6cc6 AttachedNetwork=eb233c4eb030 BoundsByWhatIDValue=8fc4fb4c306c CandidateAdded=8a47761c2b87 CandidateAnswer=c4f359547d7c CandidateBodies=3212f3397a2f CandidateDiffers=eb09cbc3ccbd CandidateRefusal=e909c9f6cd19 ComposeAnswer=dc1b3a485ad8 ComposeAnswerPass=82e6b2612862 ComposeCandidateAnswer=dfbbe49d1170 Composed=a0496a1b4293 ComposedByNodeModuleFingerprintValue=c5232f26d312 ComposedByNodeNodeValue=92ce08a2aa61 ComposedEvent=c9a05c369a2d CompositionAnswer=455cbb2576bc CompositionAnswerAttempt=38f25294eb7f CompositionAnswerHave=2b07bbb37a49 CompositionAnswerJudged=ad566939781a CompositionAnswerOwn=a8154421db58 CompositionAnswerRuns=3a70c8e06e7e CompositionAnswerWant=aefc6253201d CompositionAnswerWithheldItem=28eae88e46de CompositionAnswerWithheldPartsItem=79f37133d5be CompositionDiffAnswer=b922d22f9cee CompositionDiffEntry=ac7c1fd3ea62 CompositionDiffResource=e31a58d6b2b5 ConvergedAnswer=378c6aea0436 DataByNodeModuleValue=155c8dd0a6e5 DeclaredGroup=22c955571ed0 DeclaredIdentity=442e5ea22995 DeclaredLibrary=234c8b6973d8 DoneEvent=0e155c7e6cc6 EntryAgainAnswer=1f1a24957164 EntryAgainAnswerAsked=bec32f015550 FailedUnit=4b7afe8c0f84 FindingAction=2bab6a7c8d3f FindingEvidence=f65231e1f862 FindingSubject=11e82b0a77d6 FindingsByKeyValue=41e93a483c67 FirstViewAgainAnswer=22627a4a4678 FirstViewAgainAnswerAsked=0fa827c2bc13 FirstViewsAnswer=3a1fe57c7be6 FirstViewsAnswerEntriesItem=8b117619ca3f FirstViewsAnswerWantsItem=d8cb80636647 HandOverAnswer=aba938323932 HaveByNodeModuleValue=256422cac3ca HaveByNodeNodeValue=9296a55d7aa6 HealthByNodeValue=03bfa8c83d5b JudgeDirectoriesAnswer=f590024f1e91 LoginFallback=78e280ece645 ManifestReadsAnswer=44ff978272b4 ManifestReadsChanged=fac832ea55d0 ManifestReadsChangedEvent=88e4af52759d Module=e604719b1fb3 NetworkHealth=3af75f8af8d7 NetworkPart=502939443fb6 NodeAccount=1faabd57fa41 NodeDirectory=12b7f58b657c NodeOwn=4fecee42b3c0 NodeRecord=13f2a683c1bf PackagesAnswer=e4128836129d PackagesAnswerKey=60572f6eefc3 PackagesAnswerKeyPackagesItem=955a58e4952f PackagesByNodeValue=4cdc8f8bdc58 PackagesByNodeValuePackagesItem=955a58e4952f PeerSeen=43e6f359f1aa PlacedDataItem=82d650fb9d31 ProcessBuild=133a0f6e81cf ProcessBuilds=32cfa418abfd ProcessBuildsAnswer=4ac4ce32fbeb PullWait=99288cc066ec RefusedEvent=0e155c7e6cc6 Revision=165e37beccf5 RootAccountVerdict=7a8c0d2e5b9a RootFreeAnswer=c83678c70792 RootVerdict=0855e131d15c Running=8a19fd7f6446 RunningEvent=f3d8fedcfd51 Said=634cca3367f2 SealedBox=2c687c69b978 SeatList=248a1dc3029b SeatListAgainAnswer=8eb7fbcb7018 SeatListAnswer=8eb7fbcb7018 SeatListHeld=6b5c0f8ddcc2 SeatListStatus=bfbb572c49dd SetuidSearchAnswer=f590024f1e91 UnitsHealth=0d9cf7be9bc7 UserListWritten=caae94077890 Wait=fc85cf95ac27 WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0" ) const ( @@ -809,15 +809,17 @@ type NodeOwn struct { // NodeRecord is what the machine observes of itself, for every node and composing part to read. type NodeRecord struct { - Authority string `json:"authority,omitempty"` - Capabilities []string `json:"capabilities,omitempty"` - Certificate string `json:"certificate,omitempty"` - Contract int64 `json:"contract,omitempty"` - ManifestReads []string `json:"manifest-reads,omitempty"` - Networks []AttachedNetwork `json:"networks,omitempty"` - NetworksSaid bool `json:"networks-said,omitempty"` - Node string `json:"node"` - OutwardLinks []string `json:"outward-links,omitempty"` + Authority string `json:"authority,omitempty"` + Capabilities []string `json:"capabilities,omitempty"` + Certificate string `json:"certificate,omitempty"` + Contract int64 `json:"contract,omitempty"` + // the declaration Version its engine reads (design 47 H2 §813 (12), H-A-416 (2), H-A-419): the composer writes this node's declaration at the lower of its own Version and this one, 1 when none is stated + DeclarationReads int64 `json:"declaration-reads,omitempty"` + ManifestReads []string `json:"manifest-reads,omitempty"` + Networks []AttachedNetwork `json:"networks,omitempty"` + NetworksSaid bool `json:"networks-said,omitempty"` + Node string `json:"node"` + OutwardLinks []string `json:"outward-links,omitempty"` // the capabilities this node's tool runner states of the calls it answers, as its announcement carries them (design 46 approval mark 6) RunnerCapabilities []string `json:"runner-capabilities,omitempty"` // the fingerprint of the tool runner that stated runner-capabilities, as its announcement carries it; empty when it stated none diff --git a/go/seats/nodeengine/contract_test.go b/go/seats/nodeengine/contract_test.go index 6299318..aaed871 100644 --- a/go/seats/nodeengine/contract_test.go +++ b/go/seats/nodeengine/contract_test.go @@ -87,7 +87,7 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "the bus module's have carries the user list written (typed from the engine's values)", subject: "", given: "{\"health\":\"ok\",\"phase\":\"running\",\"user-list\":{\"at\":\"2026-11-05T12:00:00Z\",\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"follows\":\"grants\",\"handed\":{\"at\":\"2026-11-05T12:00:00Z\",\"box\":{\"ct\":\"c\",\"eph\":\"e\",\"iv\":\"i\",\"tag\":\"t\",\"v\":1},\"from\":\"ace\",\"to\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"users\":3},\"key\":\"-----BEGIN PUBLIC KEY-----\",\"revision\":7,\"source\":\"user-list\",\"users\":3,\"wanted\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"v\":1}", wire: "{\"health\":\"ok\",\"phase\":\"running\",\"user-list\":{\"at\":\"2026-11-05T12:00:00Z\",\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"follows\":\"grants\",\"handed\":{\"at\":\"2026-11-05T12:00:00Z\",\"box\":{\"ct\":\"c\",\"eph\":\"e\",\"iv\":\"i\",\"tag\":\"t\",\"v\":1},\"from\":\"ace\",\"to\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"users\":3},\"key\":\"-----BEGIN PUBLIC KEY-----\",\"revision\":7,\"source\":\"user-list\",\"users\":3,\"wanted\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"v\":1}", decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, - {name: "a node's own facts with its record and an answer to a candidate (typed from the engine's values)", subject: "", given: "{\"candidates\":{\"p1\":{\"added\":[{\"module\":\"db\",\"unissued\":[\"db.secret\"]}],\"differs\":[{\"bodies\":[{\"id\":\"api.cfg\",\"paths\":[\"/etc/api.conf\"],\"why\":\"content\"}],\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"api\",\"running\":\"sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\"why\":\"a file differs\"}],\"proposal\":\"p1\",\"refusals\":[{\"module\":\"mail\",\"today\":\"runs\",\"why\":\"a value is missing\"}],\"removed\":[\"old\"],\"revision\":4,\"same\":[\"web\"],\"verdict\":\"differs\"}},\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"composes\":\"own\",\"record\":{\"capabilities\":[\"approval-mark/1\",\"docker\"],\"contract\":3,\"networks\":[{\"link\":\"eth0\",\"network\":\"192.0.2.0/24\"}],\"networks-said\":true,\"node\":\"ace\",\"runner-capabilities\":[\"approval-mark/1\"],\"runner-fingerprint\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tunnel-key\":\"k\",\"v\":1},\"v\":1}", wire: "{\"candidates\":{\"p1\":{\"added\":[{\"module\":\"db\",\"unissued\":[\"db.secret\"]}],\"differs\":[{\"bodies\":[{\"id\":\"api.cfg\",\"paths\":[\"/etc/api.conf\"],\"why\":\"content\"}],\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"api\",\"running\":\"sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\"why\":\"a file differs\"}],\"proposal\":\"p1\",\"refusals\":[{\"module\":\"mail\",\"today\":\"runs\",\"why\":\"a value is missing\"}],\"removed\":[\"old\"],\"revision\":4,\"same\":[\"web\"],\"verdict\":\"differs\"}},\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"composes\":\"own\",\"record\":{\"capabilities\":[\"approval-mark/1\",\"docker\"],\"contract\":3,\"networks\":[{\"link\":\"eth0\",\"network\":\"192.0.2.0/24\"}],\"networks-said\":true,\"node\":\"ace\",\"runner-capabilities\":[\"approval-mark/1\"],\"runner-fingerprint\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tunnel-key\":\"k\",\"v\":1},\"v\":1}", + {name: "a node's own facts with its record and an answer to a candidate (typed from the engine's values)", subject: "", given: "{\"candidates\":{\"p1\":{\"added\":[{\"module\":\"db\",\"unissued\":[\"db.secret\"]}],\"differs\":[{\"bodies\":[{\"id\":\"api.cfg\",\"paths\":[\"/etc/api.conf\"],\"why\":\"content\"}],\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"api\",\"running\":\"sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\"why\":\"a file differs\"}],\"proposal\":\"p1\",\"refusals\":[{\"module\":\"mail\",\"today\":\"runs\",\"why\":\"a value is missing\"}],\"removed\":[\"old\"],\"revision\":4,\"same\":[\"web\"],\"verdict\":\"differs\"}},\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"composes\":\"own\",\"record\":{\"capabilities\":[\"approval-mark/1\",\"docker\"],\"contract\":3,\"declaration-reads\":2,\"networks\":[{\"link\":\"eth0\",\"network\":\"192.0.2.0/24\"}],\"networks-said\":true,\"node\":\"ace\",\"runner-capabilities\":[\"approval-mark/1\"],\"runner-fingerprint\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tunnel-key\":\"k\",\"v\":1},\"v\":1}", wire: "{\"candidates\":{\"p1\":{\"added\":[{\"module\":\"db\",\"unissued\":[\"db.secret\"]}],\"differs\":[{\"bodies\":[{\"id\":\"api.cfg\",\"paths\":[\"/etc/api.conf\"],\"why\":\"content\"}],\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"api\",\"running\":\"sha256:dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\",\"why\":\"a file differs\"}],\"proposal\":\"p1\",\"refusals\":[{\"module\":\"mail\",\"today\":\"runs\",\"why\":\"a value is missing\"}],\"removed\":[\"old\"],\"revision\":4,\"same\":[\"web\"],\"verdict\":\"differs\"}},\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"composes\":\"own\",\"record\":{\"capabilities\":[\"approval-mark/1\",\"docker\"],\"contract\":3,\"declaration-reads\":2,\"networks\":[{\"link\":\"eth0\",\"network\":\"192.0.2.0/24\"}],\"networks-said\":true,\"node\":\"ace\",\"runner-capabilities\":[\"approval-mark/1\"],\"runner-fingerprint\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"tunnel-key\":\"k\",\"v\":1},\"v\":1}", decode: func(b []byte) (any, error) { var v HaveByNodeNodeValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "a module's data items on a node (typed from the engine's values)", subject: "", given: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"items\":[{\"class\":\"database\",\"covered_by\":\"/var/lib/postgres\",\"item\":\"cluster\",\"measure\":\"dataset\",\"module\":\"postgres\",\"path\":\"/var/lib/postgres\",\"protection\":\"backup\"}],\"module\":\"postgres\",\"node\":\"ace\",\"v\":1}", wire: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"items\":[{\"class\":\"database\",\"covered_by\":\"/var/lib/postgres\",\"item\":\"cluster\",\"measure\":\"dataset\",\"module\":\"postgres\",\"path\":\"/var/lib/postgres\",\"protection\":\"backup\"}],\"module\":\"postgres\",\"node\":\"ace\",\"v\":1}", decode: func(b []byte) (any, error) { var v DataByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, diff --git a/seats/node-engine/fixtures/states.json b/seats/node-engine/fixtures/states.json index 7b9ffc1..7b99d04 100644 --- a/seats/node-engine/fixtures/states.json +++ b/seats/node-engine/fixtures/states.json @@ -410,6 +410,7 @@ ], "networks-said": true, "contract": 3, + "declaration-reads": 2, "runner-capabilities": [ "approval-mark/1" ], diff --git a/seats/node-engine/seat.json b/seats/node-engine/seat.json index 10d9251..a5aac3a 100644 --- a/seats/node-engine/seat.json +++ b/seats/node-engine/seat.json @@ -1,6 +1,6 @@ { "format": 1, - "form": 2, + "form": 3, "seat": "node-engine", "scope": "node", "grain": "whole", @@ -2580,6 +2580,10 @@ "type": "string" } }, + "declaration-reads": { + "type": "integer", + "description": "the declaration Version its engine reads (design 47 H2 §813 (12), H-A-416 (2), H-A-419): the composer writes this node's declaration at the lower of its own Version and this one, 1 when none is stated" + }, "runner-capabilities": { "type": "array", "items": { diff --git a/ts/seats/nodeengine/index.d.ts b/ts/seats/nodeengine/index.d.ts index 531a442..24d9192 100644 --- a/ts/seats/nodeengine/index.d.ts +++ b/ts/seats/nodeengine/index.d.ts @@ -504,6 +504,8 @@ export interface NodeRecord { "capabilities"?: string[]; "certificate"?: string; "contract"?: number; + /** the declaration Version its engine reads (design 47 H2 §813 (12), H-A-416 (2), H-A-419): the composer writes this node's declaration at the lower of its own Version and this one, 1 when none is stated */ + "declaration-reads"?: number; "manifest-reads"?: string[]; "networks"?: AttachedNetwork[]; "networks-said"?: boolean; -- 2.54.0 From 2dfdcc331682b445f8d2af66e1c120d764f69bb7 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 02:36:36 +0100 Subject: [PATCH 6/8] H2: every seat contract says each verb's description A tools program that serves a seat's verbs as tools reads a verb's description from the generated contract, one copy taken from seat.json, instead of writing it again. Generated again in all five folders by mesh-delivery's seatgen (feat/47-H2 b65b6173), which now writes VerbDescription; seatgen -check clean, every package's vet and tests green. Builds: design 47 H2 H-A-449 --- go/seats/meshbroker/contract.go | 32 +++++++++++++ go/seats/meshconfig/contract.go | 12 +++++ go/seats/meshmoduleassigner/contract.go | 20 ++++++++ go/seats/meshrecovery/contract.go | 30 ++++++++++++ go/seats/nodeengine/contract.go | 48 +++++++++++++++++++ .../go/seats/meshconditions/contract.go | 16 ++++++- .../go/seats/meshhandacts/contract.go | 16 ++++++- .../go/seats/meshhealers/contract.go | 16 ++++++- .../go/seats/meshselfcheck/contract.go | 14 +++++- .../go/seats/meshwatchdogs/contract.go | 20 +++++++- .../go/seats/meshgrants/contract.go | 14 +++++- .../go/seats/meshnodeenroller/contract.go | 22 ++++++++- .../go/seats/meshvault/contract.go | 44 ++++++++++++++++- .../go/seats/operatorchannel/contract.go | 20 +++++++- .../go/seats/meshprovisioner/contract.go | 12 ++++- 15 files changed, 326 insertions(+), 10 deletions(-) diff --git a/go/seats/meshbroker/contract.go b/go/seats/meshbroker/contract.go index f48b11d..ba0714a 100644 --- a/go/seats/meshbroker/contract.go +++ b/go/seats/meshbroker/contract.go @@ -55,6 +55,38 @@ func Verbs() []string { return []string{VerbList, VerbShow, VerbCheck, VerbOrphans, VerbCreate, VerbApply, VerbRecreate, VerbDrop, VerbSnapshotGet, VerbSnapshotRestore, VerbSnapshotRestoreCancel, VerbSnapshotRemove} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbList: + return "Every entry the bus module created, its template, its settings and its fill against its cap." + case VerbShow: + return "One entry, its template, settings and fill." + case VerbCheck: + return "Compare what the bus holds with what was asked, entry by entry; a difference that only grows is said as such." + case VerbOrphans: + return "Entries the bus holds that no manifest asks for; never one whose manifest the judge refused or outgrew, nor one of the foundation's old sections." + case VerbCreate: + return "Create one entry now." + case VerbApply: + return "Apply a difference that only grows: a larger cap, a longer age." + case VerbRecreate: + return "Rebuild an entry whose settings differ in a way that cannot grow, from its data where the storage type allows, after a stream snapshot." + case VerbDrop: + return "Remove one orphan, after a stream snapshot." + case VerbSnapshotGet: + return "Send the stream snapshot the bus module took before a drop or recreate: its fields, then the file in chunks of at most 512 KiB on the chunk subject of the call, each acknowledged by the caller on the ack subject within 30 seconds. A caller granted no chunk subjects is answered the fields alone, with chunks 0. Refuses snapshot damaged, snapshot missing, snapshot protected and snapshot taken before milestone G (design 47 G 681)." + case VerbSnapshotRestore: + return "Restore in place the snapshot of a protected stream the bus module took before a drop or recreate, under the stream's own name: with verify true it only checks the file against its recorded digest and restores nothing; it refuses names live while a live object of the stream's name exists. Answers accepted, busy or error at once; the outcome comes on the event snapshot-restored (design 47 G 681)." + case VerbSnapshotRestoreCancel: + return "Cancel a running restore: it removes the keeper's own partial stream, says snapshot-restored with outcome failed under that act and answers accepted, or answers error when that act has ended (design 47 G 681)." + case VerbSnapshotRemove: + return "Remove one snapshot and its record now, or every expired one, written in the hand-act log first; a snapshot of before milestone G only by request. Answers accepted, busy or error (design 47 G 681), A-44." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventCreated, EventRefused, EventDrifted, EventDriftCleared, EventFull, EventFullCleared, EventOrphaned, EventRecreated, EventDropped, EventSnapshotRestored} diff --git a/go/seats/meshconfig/contract.go b/go/seats/meshconfig/contract.go index a6b2af2..b75db56 100644 --- a/go/seats/meshconfig/contract.go +++ b/go/seats/meshconfig/contract.go @@ -32,6 +32,18 @@ func Verbs() []string { return []string{VerbConfig, VerbRenames} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbConfig: + return "Set, clear, list or read the history of config values: mesh config or node config for a predefined key, or a module's own value on one node, each set with why, validated, and naming each module on each node whose value moves." + case VerbRenames: + return "The open renames of config values (design 32 *A config value renamed*): per rename the module, the old and new name, when it moved, and the nodes still holding the old name open." + } + return "" +} + // The holder's own events, listed beside the seat and published under the holder's subjects (ADR 0620 §2). const ( HolderEventConfigChanged = "config-changed" diff --git a/go/seats/meshmoduleassigner/contract.go b/go/seats/meshmoduleassigner/contract.go index 98c3efd..a4639a9 100644 --- a/go/seats/meshmoduleassigner/contract.go +++ b/go/seats/meshmoduleassigner/contract.go @@ -44,6 +44,26 @@ func Verbs() []string { return []string{VerbAssignments, VerbProposals, VerbPropose, VerbWithdraw, VerbAgain, VerbPlacement} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbAssignments: + return "Read the assignments: one node's key, the nodes one module is placed on, or every key, each with its revision, and how full the state is against its cap. With history, one node's or one module's changes in order: a revision the state keeps whole, an older one as the proposal's changes from its assignments-changed event." + case VerbProposals: + return "Every open proposal of assignments: its changes, the revision of each key it was laid over, its candidates, every node's answer, the differences computed and answered, its verdict and its ask. Narrowed to one by id." + case VerbPropose: + return "Propose a change of assignments, with why: laid over the current keys and refused at once, naming every finding, when the result cannot be placed (two modules on one host port, a provider not placed, a seat held once held twice, two nodes with one address, two hubs, a module the indexer does not hold, a node with no record). Otherwise the nodes it touches compose it in shadow and answer, and on a passing verdict the operator is asked to approve it. Who proposes is the caller, as the runtime proves it. An add-node from mesh-enrolment, whose warrant names its node and address, is written with no ask of its own: its Approve is the enrolment's (ADR 0587 §7)." + case VerbWithdraw: + return "Withdraw an open proposal: its key and its candidates are deleted and assignments-withdrawn carries it whole. With why." + case VerbAgain: + return "Judge an open proposal now with the answers that stand, and raise its ask again when its verdict passes and the operator's channel does not hold the ask. Nothing more: the recovery of a proposal whose judgement or ask was lost." + case VerbPlacement: + return "Read the placements of one module as the assignments rows hold them: for each watched branch a node runs it from, the nodes that run it from there." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventAssignmentsProposed, EventAssignmentsWithdrawn, EventAssignmentsJudged, EventAssignmentsChanged} diff --git a/go/seats/meshrecovery/contract.go b/go/seats/meshrecovery/contract.go index 9d211c4..3cf3277 100644 --- a/go/seats/meshrecovery/contract.go +++ b/go/seats/meshrecovery/contract.go @@ -51,6 +51,36 @@ func Verbs() []string { return []string{VerbSnapshotKept, VerbRestoreKept, VerbKeptPoints, VerbRestoreAside, VerbCancel, VerbTake, VerbRestore, VerbRetry, VerbAside, VerbDiscardAside, VerbExpirePoints} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbSnapshotKept: + return "Take the restore point of one module's kept data on the bus before it moves across a form change: the data whole and the position of each durable consumer. Answers accepted, busy or error at once; the point comes on the event ended (design 47 G 516, 554, 560)." + case VerbRestoreKept: + return "Restore one module's kept data from its restore point, the live data set aside first and never over it. Answers accepted, busy or error at once; the result comes on the event restored. It refuses aside-only and discard-aside: those are hand acts alone (design 47 G 516, 554, 560)." + case VerbKeptPoints: + return "Every restore point and aside the recovery module holds, with its module, kept data, form, fingerprint, size and when, and the act that runs, with since when and what it waits on (design 47 G 517, 554)." + case VerbRestoreAside: + return "Restore an aside under the live names it was taken from, for an aside whose record ends at removed that no running act holds; it refuses while live objects of those names exist. Ends with restored (design 47 G 566)." + case VerbCancel: + return "End an accepted act that has not begun its work, with its ending event, outcome failed and error cancelled; it refuses an act that has begun, naming its step (design 47 G 566)." + case VerbTake: + return "Hand act: take a point of one module's kept data at that fingerprint's form, as snapshot-kept does with no catch-up. Answers accepted, busy or error at once; the point comes on the event ended (design 47 G 682, 554)." + case VerbRestore: + return "Hand act: restore one module's kept data as restore-kept does, from a point by its name or from a keeper's snapshot by its request; exactly one of snapshot and request, and from-backup only with snapshot (design 47 G 682, 681). Answers accepted, busy or error at once; the result comes on the event restored." + case VerbRetry: + return "Hand act: ask again the last failed act of that module and kept data, with its fields; the error nothing to retry when its last act did not fail. The result comes on that act's ending event (design 47 G 682)." + case VerbAside: + return "Hand act: set the live kept data aside without restoring (design 47 G 516, 682). Answers accepted, busy or error at once; the result comes on the event set-aside." + case VerbDiscardAside: + return "Hand act: remove one aside's directory (design 47 G 682). Answers accepted, busy or error at once; the result comes on the event aside-discarded." + case VerbExpirePoints: + return "Hand act: remove the points past their 90 days now, as the module does by itself (design 47 G 551, 682). Answers accepted, busy or error at once; the result comes on the event expiry-ended." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventEnded, EventRestoreStarted, EventRestored, EventSetAside, EventAsideDiscarded, EventPointRemoved, EventExpiryEnded} diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index b8bfd9f..36296cf 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -62,6 +62,54 @@ func Verbs() []string { return []string{VerbHandOver, VerbAccessAct, VerbJudgeDirectories, VerbSetuidSearch, VerbRootFree, VerbActs, VerbPackages, VerbComposition, VerbCompositionDiff, VerbCompose, VerbComposeCandidate, VerbManifestReads, VerbApplyOrder, VerbSeatList, VerbSeatListAgain, VerbFirstViews, VerbFirstViewAgain, VerbEntryAgain, VerbProcessBuilds, VerbConverged} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbHandOver: + return "Hand a directory this machine uses as found to the mesh (novox/hq ADR 0563 §3, §5): the engine judges the path as it does every hand-over (absolute, as it states it, used as found, reached through no link) and refuses in words, or asks the operator on their channel at the level approve, binding the owner, group and mode it will set. Nothing changes on the call: only the operator's yes hands it over. One ask is open per path; acts shows where it stands." + case VerbAccessAct: + return "Ask the operator for the take act on a library whose root holds data outside its group (novox/hq ADR 0328 §7, ADR 0563 §3, §4), on the library's home engine: the access as declared and its root as last declared, judged and refused in words or asked at the level approve. Only the operator's yes sets the library's group, group write and setgid under its root. One ask is open per access." + case VerbJudgeDirectories: + return "Which of this machine's declared directories the engine would refuse to make or keep, one line each (novox/hq ADR 0563 §2). Read-only: changes no owner or mode." + case VerbSetuidSearch: + return "Throw away the engine's last search for setuid programs and start a full one (novox/hq ADR 0563 §2); until it completes root-free answers that the machine is not judged yet. Refused while one runs, and when one was started within the hour, naming when the next may start." + case VerbRootFree: + return "Whether this machine is root-free (novox/hq ADR 0259 §8, ADR 0563 §6): free only on the engine's own verdict, at most fifteen minutes old, that the account agents run as cannot become root without a person, and the login shell's execute not served here. Anything else is no pass, and says why. Answered by this machine's engine alone." + case VerbActs: + return "Every act this machine's engine was asked through this seat (novox/hq ADR 0563 §9): each hand-over, access act and setuid search, open, done or refused, with who asked, the ask and the operator's warrant. Read-only." + case VerbPackages: + return "The packages this machine's compositions declare, present or absent, each with the modules that declare it, as the engine keeps them in its key of `packages`; until the controller hands its lease away, beside the controller's mirror for this machine and their difference. With write, the key written again from what the engine composed." + case VerbComposition: + return "One module's composition on this machine beside what runs of it, read-only: the composition its want's build has in the bucket composed- (the latest revision, or the one whose digest is given, from the revisions the bucket keeps), the digest of each kept revision, what runs (applied, its have, or the kept declaration), its want and have (phase running, failed, held or waiting-yes, and the digest that waits for a yes), and the move's judgement with its words: why a record module waits for a yes. With diff, every resource added, removed or changed, a provider's received file naming the consumers that join or leave." + case VerbCompositionDiff: + return "One module's composed values read by resource (design 47 H2 §813 (3), H-A-349 DQ-12b): given a module and a revision or a digest of its composition, the entries that differ between the composition that runs and that one, per resource, environment entries by name, a secret's value masked. Read-only. Answered by this machine's engine alone." + case VerbCompose: + return "Compose this machine's modules now and say how it went, so a composition that failed, or a module held, recovers without a restart: what the pass refused or held, each with why, and when the engine composes again on its own after a seat that did not answer (a deadline, no responders: retried with a growing wait; a refusal never). With module, that module's apply is also tried again. Changes only what a pass the engine makes on its own would change." + case VerbComposeCandidate: + return "Compose a check's candidate on this machine in shadow, with its own sealed values and the indexer's manifest verdicts, and say per module placed here whether it composes (with its digest and whether the candidate changes it), is refused by the candidate or is held without it, each with why, and the verdict of the machine's own composition (novox/hq ADR 0593 §7). Read-only: applies nothing and writes nothing. Answered by this machine's engine alone, within the asker's bound." + case VerbManifestReads: + return "The reader capabilities this machine's engine states (manifest words, forms and seat names it reads, novox/hq ADR 0618 §3) and when it last stated them. An engine built before it said them states none, which a reader takes as the baseline. Read-only. Answered by this machine's engine alone." + case VerbApplyOrder: + return "The order this machine's engine will apply its changed wants in, with why: one row per unapplied changed want, the bus module and the backup holder first, then each pipeline's wants by rank, then the rest by name, its own want last, a reverted module first (design 47 H 771, H-A-46). Read-only. Answered by this machine's engine alone." + case VerbSeatList: + return "The seat list this engine holds and what it waits for (novox/hq ADR 0636 §7): each seat's source (trunk or bootstrap) and digest, the seats held from the bootstrap alone, the definitions refused, the last error and whether the seat mesh-catalog has answered. Read-only." + case VerbSeatListAgain: + return "Make this engine read the seat list from the seat mesh-catalog now (novox/hq ADR 0636 §7), the recovery of a list unread; it answers what it holds afterwards, and the error when the read failed. A read that changed nothing still ends the engine's wait." + case VerbFirstViews: + return "The node-engine's first views of the owners' states it follows (design 47 G 422, 204): per owner and state, the tool it asks, the revision its picture holds and why it is behind, when it asked and was answered, how many asks and whether its condition is raised; served by mesh-sdk's runtime as the view's read tool; its entries and its kept wants beside (design 47 G 698)." + case VerbFirstViewAgain: + return "Ask the node-engine's first view of an owner's state again now, by hand (design 47 G 422, 204): a hand act, its caller and why kept in the status first-views reads; served by mesh-sdk's runtime as the view's again tool." + case VerbEntryAgain: + return "Ask the indexer's entry of a build again now, by hand (design 47 G 683, 698): a hand act, its caller and why kept; the answer says what was asked and the verb that reads it." + case VerbProcessBuilds: + return "The build each process on this node was started with (design 47 *The revision view*): per service and container the fingerprint the node-engine handed it in MESH_FINGERPRINT, or why it is unknown, and when it started. Narrowed by module. Reads only." + case VerbConverged: + return "The node's convergence state, which the node-engine keeps (ADR 0168, ADR 0683; design 33 control-verbs §10): adopted or converged, since when it became so, for an adopted node the kind of the firewall found, and the node's links as the engine classifies them: the tunnel's interface and the outward links (design 47 H-A-325). Read-only: the holder of node-packet-filter asks it at its start and at every allow and disallow, and refuses when it does not answer." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventAsked, EventDone, EventRefused, EventManifestReadsChanged, EventComposed, EventRunning, EventWaitHeld, EventWaitEnded} diff --git a/health-and-repair/go/seats/meshconditions/contract.go b/health-and-repair/go/seats/meshconditions/contract.go index 410ae9a..4696be6 100644 --- a/health-and-repair/go/seats/meshconditions/contract.go +++ b/health-and-repair/go/seats/meshconditions/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "836d2140ddb9934850b5ada7636fc2021b1071822179e9e1090c5d170e94db3a" + generatedFieldsDigest = "Action=2bab6a7c8d3f ConditionChangedEvent=53e8289a3c05 ConditionClearedEvent=53e8289a3c05 ConditionEvent=6c119ffcb41a ConditionEventGapsItem=445e336e9c2f ConditionEventSilenced=5283d9bd3ac3 ConditionEventTriedItem=682b4f81cc9f ConditionRaisedEvent=53e8289a3c05 ConditionsAnswer=7538f2f5e68e ConditionsByKeyValue=b92129af8096 ConditionsByKeyValueGapsItem=445e336e9c2f ConditionsByKeyValueSilenced=5283d9bd3ac3 ConditionsByKeyValueTriedItem=682b4f81cc9f Evidence=f65231e1f862 Finding=4c99dfc3bf5f FindingsAskedEvent=d9acb823a0b3 FindingsByScopeIDKindValue=8f969e06a146 FindingsViewsByObserverNodeValue=8975b486b408 FindingsViewsByObserverNodeValueStated=67549697c196 ResyncAnswer=7538f2f5e68e SilenceAnswer=7538f2f5e68e Subject=11e82b0a77d6" ) const ( @@ -41,6 +41,20 @@ func Verbs() []string { return []string{VerbConditions, VerbSilence, VerbResync} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbConditions: + return "What is wrong with the mesh now: every open condition, urgent first, then oldest, raised from the observers' findings (the watchman, the self-check, the healers, the assigner) and cleared when the finding goes, never by hand. Given a key, that one whole with its evidence; with history, every transition lately." + case VerbSilence: + return "Stop one condition's messages for a while, a hand act with why: it stays open and in status, and the silence is kept as its transition in history." + case VerbResync: + return "Ask the observers to state their findings again, every one or the one named, and raise and clear what differs from the open conditions: the recovery of a keeper that missed a change. Each call is written in the hand-act log of the seat mesh-hand-acts (design 47 G 390)." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventConditionRaised, EventConditionChanged, EventConditionCleared, EventFindingsAsked} diff --git a/health-and-repair/go/seats/meshhandacts/contract.go b/health-and-repair/go/seats/meshhandacts/contract.go index 1fda71f..adda17e 100644 --- a/health-and-repair/go/seats/meshhandacts/contract.go +++ b/health-and-repair/go/seats/meshhandacts/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "12775f35116965a7ab99b6b2617020889cab452598c2f51883247d05cf99a9ea" + generatedFieldsDigest = "Act=a4b999a0242d ActRecordedEvent=ae30b14a5dce ActsByIDValue=a4b999a0242d HandActAnswer=7538f2f5e68e HandActsAnswer=7538f2f5e68e WarrantedAnswer=7538f2f5e68e WarrantsByAskerAskValue=8a933b29dd52" ) const ( @@ -38,6 +38,20 @@ func Verbs() []string { return []string{VerbHandAct, VerbHandActs, VerbWarranted} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbHandAct: + return "Record one act done by hand: what, why, its cause in a word or a condition's kind (the word a second act for the same reason uses) and the condition it addresses. Who did it is the caller the runtime proves, never said by the caller. Said as act-recorded." + case VerbHandActs: + return "What was done by hand lately, over this log and the controller's: who, why and the cause of each, and the causes recorded twice within a fortnight (a healer is wanted)." + case VerbWarranted: + return "Record what a module did on the operator's warrant: who chose, through which channel, with which proofs and which answer read from the router's own record of that module's ask, never from the caller; once per ask. Refused for an ask still open, ended without a choice, or not that module's." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventActRecorded} diff --git a/health-and-repair/go/seats/meshhealers/contract.go b/health-and-repair/go/seats/meshhealers/contract.go index 4cf05a1..1254a20 100644 --- a/health-and-repair/go/seats/meshhealers/contract.go +++ b/health-and-repair/go/seats/meshhealers/contract.go @@ -19,7 +19,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "4970dc97cfa905889a3c496c5bcb539306ce1900fa4ac19d6010954051f7901a" + generatedFieldsDigest = "AttemptChangedEvent=d8511196f322 AttemptsByAttemptValue=95a88b9980f5 DrillAnswer=7538f2f5e68e HealAnswer=7538f2f5e68e HealerActedEvent=fed7669492b1 HealersAnswer=7538f2f5e68e WouldByWouldValue=a722913bac6b" ) const ( @@ -38,6 +38,20 @@ func Verbs() []string { return []string{VerbHealers, VerbHeal, VerbDrill} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbHealers: + return "The healers: each registered response to one kind of condition, its repair, its budget and what happens when it is spent; every act taken lately with its outcome, and the mesh-wide brake." + case VerbHeal: + return "Take one healer's act for one open condition now, within its budget and the brake." + case VerbDrill: + return "Record a drill: something broken on purpose to see the mesh raise and clear it, with what it tests. A drill is never a repair: no healer is wanted for it however often it is run." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventHealerActed, EventAttemptChanged} diff --git a/health-and-repair/go/seats/meshselfcheck/contract.go b/health-and-repair/go/seats/meshselfcheck/contract.go index 1506c87..7d6970c 100644 --- a/health-and-repair/go/seats/meshselfcheck/contract.go +++ b/health-and-repair/go/seats/meshselfcheck/contract.go @@ -19,7 +19,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "5f1c3026e243ab14d7005851c952f42cfb40cfa79e22cea8f3c2f94a59e65f7f" + generatedFieldsDigest = "CheckedEvent=7b5b94bab07c CheckedEventCounts=6ce772f26afd DoctorAnswer=7538f2f5e68e ProbeVerdict=0fe6766455a6 ProbesAnswer=7538f2f5e68e" ) const ( @@ -36,6 +36,18 @@ func Verbs() []string { return []string{VerbDoctor, VerbProbes} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbDoctor: + return "The self-check: the last run's verdict at once, each probe passed, failed, deferred (its facts not on the bus yet, named) or could not run, and how long ago. With run, a run now; with probe, one probe's verdict whole. Runs every five minutes on its own; each failure is a finding." + case VerbProbes: + return "The registry: what each probe asserts, where it reads its facts, and the finding it writes." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventChecked} diff --git a/health-and-repair/go/seats/meshwatchdogs/contract.go b/health-and-repair/go/seats/meshwatchdogs/contract.go index e38100c..1faa596 100644 --- a/health-and-repair/go/seats/meshwatchdogs/contract.go +++ b/health-and-repair/go/seats/meshwatchdogs/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "aacf27b959d307b4603d4a4909f324b82430c882bfbeff86941dfa0143a53854" + generatedFieldsDigest = "DeadLettersAnswer=7538f2f5e68e MachineAwayEvent=5f9f18c9abf0 MachineBackEvent=5f9f18c9abf0 PresenceAnswer=0563eea169de PresenceAnswerKeysItem=93b2bc481799 PresenceByNodeValue=282be16e23e1 PresenceByPartPartInstanceValue=282be16e23e1 PulseByBucketKeyValue=1a9e5adbba7f ResyncAnswer=7538f2f5e68e SignalsAnswer=7538f2f5e68e StuckAnswer=7538f2f5e68e StuckByBucketKeyValue=04c156256563" ) const ( @@ -41,6 +41,24 @@ func Verbs() []string { return []string{VerbSignals, VerbStuck, VerbPresence, VerbDeadLetters, VerbResync} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbSignals: + return "Every watchdog of the signals table the watchman keeps, each a key that expires unless its signal renews it: its row, what renews it, its bound, the age of its newest signal, and the finding its expiry wrote." + case VerbStuck: + return "Every want, build or step the watchman says stopped moving past its bound, with since when and the words of its finding." + case VerbPresence: + return "Every machine and tool runner the watchman sees connected, with its last word, and those it says silent; a machine that said it sleeps is shown as sleeping, not silent. With machine, that machine's presence alone: whether the watchman hears it and since when." + case VerbDeadLetters: + return "Every message a consumer on the bus gave up on, kept in DEAD_LETTERS: whose consumer, the subject, how often it was handed over and when it was given up, newest first. With id: that one whole. With deliver or drop, a hand act with why." + case VerbResync: + return "Rebuild presence from the bus's connections, and the pulses and findings from the keys the watchman watches, and take every dead-letter notice waiting: the recovery of a watchman that missed a change." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventMachineAway, EventMachineBack} diff --git a/identity-and-access/go/seats/meshgrants/contract.go b/identity-and-access/go/seats/meshgrants/contract.go index f12663d..080805b 100644 --- a/identity-and-access/go/seats/meshgrants/contract.go +++ b/identity-and-access/go/seats/meshgrants/contract.go @@ -19,7 +19,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "b2f4006c04a64376f684122491eac6e2bccab805b53cb2fc34ea05db6f2ab965" + generatedFieldsDigest = "Fill=7a76c9ceb157 FillingEvent=5bd4df78ed84 Grant=3c378b7ebccc GrantsFor=0c5063e738bb GrantsForAnswer=70ef8ec1b517 GrantsForModulesItem=ca63adbf5d73 RoomEvent=5bd4df78ed84 Wait=b67d8342ebbb WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0 Withheld=216d84b5c98f WithheldAnswer=40d99d181f26 WithheldModulesItem=59d0cf5d92c5 WithheldSubject=28eae88e46de" ) const ( @@ -39,6 +39,18 @@ func Verbs() []string { return []string{VerbGrantsFor, VerbWithheld} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbGrantsFor: + return "The grants a candidate would compose, per module: the grants it would add and remove against the branch's newest, each named by its subject and verb. The candidate's catalog half is taken by mesh-catalog's revision (design 47 G 441)." + case VerbWithheld: + return "The marked subjects withheld from each module a node's runtime carries, and why: where its tool runner does not state approval-mark/1, or its reading is not the running runner's (design 46 approval mark 6)." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventWaitHeld, EventWaitEnded, EventFilling, EventRoom} diff --git a/identity-and-access/go/seats/meshnodeenroller/contract.go b/identity-and-access/go/seats/meshnodeenroller/contract.go index 20e4a68..187f363 100644 --- a/identity-and-access/go/seats/meshnodeenroller/contract.go +++ b/identity-and-access/go/seats/meshnodeenroller/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "a6eedea7a2806712696e7b491a8a643a1dc054ab6ab1d97dce0de7f015c92243" + generatedFieldsDigest = "AgainAnswer=7538f2f5e68e ConfirmAnswer=7538f2f5e68e Enrolment=ce9d7d79b28a EnrolmentExpiredEvent=4dde8efb6998 EnrolmentIssuedEvent=4dde8efb6998 EnrolmentRefusedEvent=4dde8efb6998 EnrolmentRevokedEvent=4dde8efb6998 EnrolmentsByAddressAddressValue=524d3056537d EnrolmentsByNodeNodeValue=4dde8efb6998 IssueAnswer=7538f2f5e68e NodeEnrolledEvent=4dde8efb6998 RedeemAnswer=1aa043e59eac RevokeAnswer=7538f2f5e68e TokensAnswer=7538f2f5e68e" ) const ( @@ -45,6 +45,26 @@ func Verbs() []string { return []string{VerbIssue, VerbRedeem, VerbConfirm, VerbRevoke, VerbTokens, VerbAgain} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbIssue: + return "Issue a one-time token for a new machine, on the operator's Approve: refused at once, naming every finding, for a name that is not a node name or that a node record, a placement key or an open enrolment holds, and for every call before the controller's lease is handed away. Otherwise reserves the lowest free private-network address, asks the operator under the seat's own name and, on the warrant, adds the node to placement with its tunnel key, asks the vault for the token and says enrolment-issued. The token itself is read only through tokens." + case VerbRedeem: + return "Spend a token: asked by a joining node-engine dialled as enrol. alone, with the public halves of its keys and its identity key's proof over them. Spends the token, asks the vault for the node's account and certificate, writes the node into placement, and answers the account sealed to the node, its certificate and the vault's public half, signed by the vault. Asked again with the same keys it finishes what is not done and answers the same; with other keys it is refused." + case VerbConfirm: + return "Confirm an enrolment: asked by the node-engine dialled as its own node login alone, the runtime's proof of that caller being the confirmation. Says node-enrolled and ends the enrolment." + case VerbRevoke: + return "End an enrolment at any stage, with why, without an Approve: withdraws an open ask, deletes the node's key and its address, has the vault retire an account it already minted for it, records the act as a hand act and says enrolment-revoked." + case VerbTokens: + return "Read every open enrolment, or one: its stage, expiry, ask and revision, the bucket's fill against its cap. For a node at live, its token sealed to the operator key, asked of the vault at that moment and relayed as the vault sealed it. With history, the ended enrolments from the seat's events, as far back as the events are kept." + case VerbAgain: + return "Raise an issue's ask again when the operator's channel does not hold it, and nothing more." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventEnrolmentIssued, EventNodeEnrolled, EventEnrolmentRefused, EventEnrolmentRevoked, EventEnrolmentExpired} diff --git a/identity-and-access/go/seats/meshvault/contract.go b/identity-and-access/go/seats/meshvault/contract.go index 5323691..776434e 100644 --- a/identity-and-access/go/seats/meshvault/contract.go +++ b/identity-and-access/go/seats/meshvault/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "1b55f695820faf0b8d358617daeba7d5c8ed27ac41b7e9d024c83f28201ad0d0" + generatedFieldsDigest = "AbandonAnswer=7538f2f5e68e EnrolmentTokenAnswer=0f89acf73fc8 GetAnswer=7538f2f5e68e IssueAccountAnswer=7538f2f5e68e IssuedAnswer=7538f2f5e68e LicencePutAnswer=7538f2f5e68e MoveInAnswer=7538f2f5e68e NodeAccountAnswer=9ec3147f005d NodeAccountConfirmAnswer=7538f2f5e68e NodeKeyAnswer=7538f2f5e68e NodeLoginsByNodeValue=bed4bfc51301 OwnAnswer=7538f2f5e68e OwnPutAnswer=7538f2f5e68e OwnRetiredHolderEvent=f1c70d605240 RetireAnswer=1c304aee8e40 RotateAnswer=7538f2f5e68e RotateNodeAnswer=7538f2f5e68e SecretAskAnswer=7538f2f5e68e SignAnswer=42278012cf27 SignedHolderEvent=8cd7db5c5beb SignersByAuthorityValue=99c9737ce2dc SignersByKeyValue=d3729d33c825" ) const ( @@ -48,6 +48,48 @@ func Verbs() []string { return []string{VerbGet, VerbSecretAsk, VerbIssued, VerbRotate, VerbMoveIn, VerbNodeKey, VerbOwn, VerbIssueAccount, VerbSign, VerbEnrolmentToken, VerbNodeAccount, VerbRotateNode, VerbNodeAccountConfirm, VerbAbandon, VerbRetire, VerbLicencePut, VerbOwnPut} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbGet: + return "One secret, sealed to the public key the asker sends (the sealed box of ADR 0206), with its generation; answered only to an asker the vault allows, as the bus proved it, and a module's own secret put through own-put only to a process of the same module (design 47 H2 §822). Never the value in the clear, and never to a private key." + case VerbSecretAsk: + return "Ask the operator for a module's own secret at a desk, from the controller or a caller the vault's manifest names, named as the bus proved it (novox/hq ADR 0563 §8): the ask is recorded in the vault's store and bounded before the prompt opens, and what is typed is sealed to a key the vault made for the call and opens there alone." + case VerbIssued: + return "Take the credential a provider's software issued for a provision, from the controller alone, which asks the provider's tool with a key the vault made for the call; kept as the provision's one credential, or, when the tool answers a value per holder named, each as that holder's own; the same value again writes nothing." + case VerbRotate: + return "Make a secret anew. Refused for a value a provider's software issued and for an accepted credential. Never answers the value." + case VerbMoveIn: + return "Take one value of the controller's store in, as it is, from the node-engine of a machine it was sealed to and no other caller: name the row, its origin and generation and get a call and a key made for it, then send the call, the value sealed to that key and a key to read back to. Never replaces a value the vault holds; answers what it kept, read back sealed to that key." + case VerbNodeKey: + return "State this machine's sealing key to the vault, in its own name, from the node-engine of the machine alone: at its start and whenever the key changes. A first or changed key is recorded and the machine's core secrets are said changed; the same key again changes nothing." + case VerbOwn: + return "Answer the node-engine of one machine, about its own machine alone (as the bus proved the caller, never an argument), its modules' own secrets and the pair credentials it consumes or provides that it names, each sealed to the key it stated with node-key. A credential the vault does not hold is named missing; never a value in the clear." + case VerbIssueAccount: + return "Mint one bus account the grants part wants, now (novox/hq ADR 0561 §9): only while the controller's lease is handed away, never a node's account or the controller's, never anew for one the vault holds a value or an adopted hash for. Never the value." + case VerbSign: + return "Sign with the vault's key or authority (novox/hq ADR 0550 §2): kind node-certificate signs the certificate of a machine's internal name, asked by that machine's node-engine for the serving key its record states, built from bus state alone, or by mesh-node-enroller for a node it enrols, for the serving key the node presented at redeem (ADR 0587 §3); kind enrolment signs a redeem answer under its own context, for mesh-node-enroller alone. Answers the certificate or the signature and the signer's fingerprint, and says signed; never a key." + case VerbEnrolmentToken: + return "Make a one-time token for a node mesh-node-enroller issues on the operator's warrant: its secret kept with its copy sealed to the operator key and its hash written as the bus user enrol.. Answers only what the joining machine must trust (the bus's address, the bus certificate's fingerprint, the vault's public signing key), never the token; with sealed, the token sealed to the operator key, for tokens to relay; with drop, the token and its hash dropped, at the enrolment's end. Asked by mesh-node-enroller alone, only from the lease write. The token carries the first tunnel mesh-node-enroller built at issue (ADR 0587 §3, insight of 2026-11-02)." + case VerbNodeAccount: + return "Mint a joining node's bus account node., sealed to the sealing key it presented, and write its hash; asked again for the same node and keys, answers the account it already minted; with retire, the account it minted for a revoked enrolment retired. Writes the node's node-logins key naming node.. Asked by mesh-node-enroller alone. Never the value in the clear." + case VerbRotateNode: + return "Begin a node's account rotation to its other login: answered only for a call carrying a hand act recorded through mesh-hand-acts, which the vault reads back by its id. Makes the other login's value sealed to that node, writes it rotating in node-logins and says rotation-begun; says node-account-ready once the bus node's have shows a list holding both logins. One node at a time across the mesh, the bus node last: a call while a rotation runs waits until it is done." + case VerbNodeAccountConfirm: + return "Confirm a node's switch to its new login: asked by the node-engine dialled as that login, the runtime's proof of the caller being the confirmation. The old login's hash is then removed, and rotation-done said once the bus node's have shows the list without it." + case VerbAbandon: + return "Abandon a node's rotation before its old login is retired: the new login and its value dropped, the old one kept; a node that switched switches back first." + case VerbRetire: + return "Retire one module's own secret, by node, module and name, on the operator's warrant bound to exactly those three (design 32 *A value no longer read*). Emits own-retired." + case VerbLicencePut: + return "Hand the vault one of a licence's two secrets, its grant or its access token, from the licence manager, in two steps: name the licence by its key, the part and its generation and get a call and a key made for it; then send the call and the value sealed to that key. Keeps the newest generation and refuses an older one; says secret-changed with the secret's name and generation, never the value (novox/hq design 39 bus-and-switch §15)." + case VerbOwnPut: + return "Store a secret as the calling module's own, in two steps modelled on licence-put (design 47 H2 §822, H-A-345, H-A-349 DQ-7): name the secret and get a call and a key made for it (call, seal_to); then send the call and the value sealed to that key, and the vault keeps it under that name as the module's own, the module named by the caller's account as the bus proved it, never by an argument, keeping its newest generation only (name, generation). get answers it to a process of the same module, sealed to the process's key. The holder says each write in its journal without the value." + } + return "" +} + // The holder's own events, listed beside the seat and published under the holder's subjects (ADR 0620 §2). const ( HolderEventProvisioned = "provisioned" diff --git a/operator-and-conversation/go/seats/operatorchannel/contract.go b/operator-and-conversation/go/seats/operatorchannel/contract.go index fa5faca..0e38fec 100644 --- a/operator-and-conversation/go/seats/operatorchannel/contract.go +++ b/operator-and-conversation/go/seats/operatorchannel/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "5447f2572c926558eb1532038108cddeded16377f9d1dee5c0f1aafb856b3ce2" + generatedFieldsDigest = "Ask=76fc93d17ce4 AskAccept=0bb5682c7b3b AsksAnswer=4af6528ab26f AsksAnswerAsksItem=da43c71a4ea2 AsksByAskerIDValue=c1cecb5cf534 CancelAccept=22bae1bee7e0 ClosedHolderEvent=683915f8bbf1 Condition=8226bb684496 ConditionAccept=6fbe7a8df8e2 ConditionActionsItem=56146ecb5e2a ConditionSubject=9f1eabce9947 DecidedEvent=d6448373b56d HistoryAnswer=7538f2f5e68e NotifyAnswer=7538f2f5e68e OfferedHolderEvent=77a585d2d80a OpenAnswer=7538f2f5e68e Option=790a7e94a923 Person=6393980d1299 TellAnswer=7538f2f5e68e Warrant=b216f9adf8a1" ) const ( @@ -46,6 +46,24 @@ func Verbs() []string { return []string{VerbOpen, VerbHistory, VerbNotify, VerbTell, VerbAsks} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbOpen: + return "What is open now: every message the operator was sent about something still wrong, urgent first, oldest first." + case VerbHistory: + return "What was said to the operator lately, newest first, the refusals, and what waits to be sent on each channel." + case VerbNotify: + return "Tell the operator something, as a module that uses the seat: a key, urgent or warning, one line, and what it is about; clear says it is over." + case VerbTell: + return "Tell the operator a plain notice that needs no answer and opens no condition (ADR 0380)." + case VerbAsks: + return "The asks the router holds: open first, then the last month's, each with how it ended. With no argument only the open asks, within its default bound; key for one ask, state, since and bound narrow or widen it, and the answer says what it cut." + } + return "" +} + // Events is every event published on the seat's subject: a new copy each call. func Events() []string { return []string{EventDecided} diff --git a/provisioning/go/seats/meshprovisioner/contract.go b/provisioning/go/seats/meshprovisioner/contract.go index 2e39b79..63bffe9 100644 --- a/provisioning/go/seats/meshprovisioner/contract.go +++ b/provisioning/go/seats/meshprovisioner/contract.go @@ -20,7 +20,7 @@ const Form = 1 // whose fields changed while its forms did not (design 47 H2 §780). const ( generatedForms = "1" - generatedFieldsDigest = "878e1ffd0497bd99a1544b43596e8317c72417540badaef82999fe69e55202b6" + generatedFieldsDigest = "PlansByNodeModuleValue=e3b5d8ddd5a1 ProvisioningAnswer=7538f2f5e68e ProvisionsByNodeConsumerProvisionLocalValue=32b55a872069 ProvisionsByNodeConsumerProvisionLocalValueConsumer=920ee010c907 ProvisionsByNodeConsumerProvisionLocalValuePlan=71e13248b267 ProvisionsByNodeConsumerProvisionLocalValueProvider=920ee010c907 ProvisionsByNodeConsumerProvisionLocalValueReference=ce6c167e9bea ProvisionsByNodeConsumerProvisionLocalValueWarrant=245d42c27175 ProvisionsByNodeConsumerProvisionValue=1b9faba7e8e2 ProvisionsByNodeConsumerProvisionValueConsumer=920ee010c907 ProvisionsByNodeConsumerProvisionValuePlan=71e13248b267 ProvisionsByNodeConsumerProvisionValueProvider=920ee010c907 ProvisionsByNodeConsumerProvisionValueReference=ce6c167e9bea ProvisionsByNodeConsumerProvisionValueWarrant=245d42c27175" ) const ( @@ -32,6 +32,16 @@ func Verbs() []string { return []string{VerbProvisioning} } +// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or +// does not describe (design 47 H2 H-A-449). +func VerbDescription(verb string) string { + switch verb { + case VerbProvisioning: + return "Read what the provisioner keeps: the registry (which domain answers which kind of placeholder), the needs each module on each node recorded, what is applied where, or the items of every collection, narrowed by node and module. Reads only." + } + return "" +} + const ( StatePlans = "plans" StateProvisions = "provisions" -- 2.54.0 From 8f2bed18e5ae219489573984fdfddee2d9550288 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 02:55:51 +0100 Subject: [PATCH 7/8] H2 K: the have keeps its run's pipeline; the composition answer says drift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A want's run is ordered only within its pipeline, so the have, the record of what the engine applied, keeps the pipeline of the want it was applied from beside its run; and the composition answer's drift, the directory entries the mesh made whose owner or mode on disk differ, is the contract's own rather than the engine's private shape. Both land in one release, so the seat's form rises once, to 4. Generated with mesh-delivery's seatgen (built from b65b6173's source); seatgen -check clean in all five folders. Fixture rows: a have naming its run and pipeline, and a composition answer with drift. Builds: design 47 H2 §813 (1); H-A-429 (1), H-A-392 (b), H-A-458 (1), H-A-458 (2), H-A-458 addendum --- go/seats/nodeengine/contract.go | 22 ++++++++++++++---- go/seats/nodeengine/contract_test.go | 4 +++- seats/node-engine/fixtures/states.json | 5 ++-- seats/node-engine/fixtures/verbs.json | 24 +++++++++++++++++++ seats/node-engine/seat.json | 32 +++++++++++++++++++++++++- ts/seats/nodeengine/index.d.ts | 13 +++++++++++ 6 files changed, 92 insertions(+), 8 deletions(-) diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index 36296cf..95f3682 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -14,13 +14,13 @@ const Seat = "node-engine" // Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780): // a reader of a value of another form says "form N, this reader knows M". -const Form = 3 +const Form = 4 // The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition // whose fields changed while its forms did not (design 47 H2 §780). const ( - generatedForms = "3" - generatedFieldsDigest = "AccessActAnswer=aba938323932 AccountsHanded=01f7505e0e41 Act=e6b24e6abd5f ActSaid=2bbc5ba1bb68 Acts=0f9a96c475ff ActsAnswer=ba7fb8de22ff Adoption=12d04d378fef ApplyOrderAnswer=24e631ec9059 ApplyOrderAnswerOrderItem=6cbde55cd9a7 Asked=9dc3b3e17562 AskedEvent=0e155c7e6cc6 AttachedNetwork=eb233c4eb030 BoundsByWhatIDValue=8fc4fb4c306c CandidateAdded=8a47761c2b87 CandidateAnswer=c4f359547d7c CandidateBodies=3212f3397a2f CandidateDiffers=eb09cbc3ccbd CandidateRefusal=e909c9f6cd19 ComposeAnswer=dc1b3a485ad8 ComposeAnswerPass=82e6b2612862 ComposeCandidateAnswer=dfbbe49d1170 Composed=a0496a1b4293 ComposedByNodeModuleFingerprintValue=c5232f26d312 ComposedByNodeNodeValue=92ce08a2aa61 ComposedEvent=c9a05c369a2d CompositionAnswer=455cbb2576bc CompositionAnswerAttempt=38f25294eb7f CompositionAnswerHave=2b07bbb37a49 CompositionAnswerJudged=ad566939781a CompositionAnswerOwn=a8154421db58 CompositionAnswerRuns=3a70c8e06e7e CompositionAnswerWant=aefc6253201d CompositionAnswerWithheldItem=28eae88e46de CompositionAnswerWithheldPartsItem=79f37133d5be CompositionDiffAnswer=b922d22f9cee CompositionDiffEntry=ac7c1fd3ea62 CompositionDiffResource=e31a58d6b2b5 ConvergedAnswer=378c6aea0436 DataByNodeModuleValue=155c8dd0a6e5 DeclaredGroup=22c955571ed0 DeclaredIdentity=442e5ea22995 DeclaredLibrary=234c8b6973d8 DoneEvent=0e155c7e6cc6 EntryAgainAnswer=1f1a24957164 EntryAgainAnswerAsked=bec32f015550 FailedUnit=4b7afe8c0f84 FindingAction=2bab6a7c8d3f FindingEvidence=f65231e1f862 FindingSubject=11e82b0a77d6 FindingsByKeyValue=41e93a483c67 FirstViewAgainAnswer=22627a4a4678 FirstViewAgainAnswerAsked=0fa827c2bc13 FirstViewsAnswer=3a1fe57c7be6 FirstViewsAnswerEntriesItem=8b117619ca3f FirstViewsAnswerWantsItem=d8cb80636647 HandOverAnswer=aba938323932 HaveByNodeModuleValue=256422cac3ca HaveByNodeNodeValue=9296a55d7aa6 HealthByNodeValue=03bfa8c83d5b JudgeDirectoriesAnswer=f590024f1e91 LoginFallback=78e280ece645 ManifestReadsAnswer=44ff978272b4 ManifestReadsChanged=fac832ea55d0 ManifestReadsChangedEvent=88e4af52759d Module=e604719b1fb3 NetworkHealth=3af75f8af8d7 NetworkPart=502939443fb6 NodeAccount=1faabd57fa41 NodeDirectory=12b7f58b657c NodeOwn=4fecee42b3c0 NodeRecord=13f2a683c1bf PackagesAnswer=e4128836129d PackagesAnswerKey=60572f6eefc3 PackagesAnswerKeyPackagesItem=955a58e4952f PackagesByNodeValue=4cdc8f8bdc58 PackagesByNodeValuePackagesItem=955a58e4952f PeerSeen=43e6f359f1aa PlacedDataItem=82d650fb9d31 ProcessBuild=133a0f6e81cf ProcessBuilds=32cfa418abfd ProcessBuildsAnswer=4ac4ce32fbeb PullWait=99288cc066ec RefusedEvent=0e155c7e6cc6 Revision=165e37beccf5 RootAccountVerdict=7a8c0d2e5b9a RootFreeAnswer=c83678c70792 RootVerdict=0855e131d15c Running=8a19fd7f6446 RunningEvent=f3d8fedcfd51 Said=634cca3367f2 SealedBox=2c687c69b978 SeatList=248a1dc3029b SeatListAgainAnswer=8eb7fbcb7018 SeatListAnswer=8eb7fbcb7018 SeatListHeld=6b5c0f8ddcc2 SeatListStatus=bfbb572c49dd SetuidSearchAnswer=f590024f1e91 UnitsHealth=0d9cf7be9bc7 UserListWritten=caae94077890 Wait=fc85cf95ac27 WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0" + generatedForms = "4" + generatedFieldsDigest = "AccessActAnswer=aba938323932 AccountsHanded=01f7505e0e41 Act=e6b24e6abd5f ActSaid=2bbc5ba1bb68 Acts=0f9a96c475ff ActsAnswer=ba7fb8de22ff Adoption=12d04d378fef ApplyOrderAnswer=24e631ec9059 ApplyOrderAnswerOrderItem=6cbde55cd9a7 Asked=9dc3b3e17562 AskedEvent=0e155c7e6cc6 AttachedNetwork=eb233c4eb030 BoundsByWhatIDValue=8fc4fb4c306c CandidateAdded=8a47761c2b87 CandidateAnswer=c4f359547d7c CandidateBodies=3212f3397a2f CandidateDiffers=eb09cbc3ccbd CandidateRefusal=e909c9f6cd19 ComposeAnswer=dc1b3a485ad8 ComposeAnswerPass=82e6b2612862 ComposeCandidateAnswer=dfbbe49d1170 Composed=a0496a1b4293 ComposedByNodeModuleFingerprintValue=c5232f26d312 ComposedByNodeNodeValue=92ce08a2aa61 ComposedEvent=c9a05c369a2d CompositionAnswer=47116fe980f9 CompositionAnswerAttempt=38f25294eb7f CompositionAnswerDriftItem=09b7f8553918 CompositionAnswerHave=2b07bbb37a49 CompositionAnswerJudged=ad566939781a CompositionAnswerOwn=a8154421db58 CompositionAnswerRuns=3a70c8e06e7e CompositionAnswerWant=aefc6253201d CompositionAnswerWithheldItem=28eae88e46de CompositionAnswerWithheldPartsItem=79f37133d5be CompositionDiffAnswer=b922d22f9cee CompositionDiffEntry=ac7c1fd3ea62 CompositionDiffResource=e31a58d6b2b5 ConvergedAnswer=378c6aea0436 DataByNodeModuleValue=155c8dd0a6e5 DeclaredGroup=22c955571ed0 DeclaredIdentity=442e5ea22995 DeclaredLibrary=234c8b6973d8 DoneEvent=0e155c7e6cc6 EntryAgainAnswer=1f1a24957164 EntryAgainAnswerAsked=bec32f015550 FailedUnit=4b7afe8c0f84 FindingAction=2bab6a7c8d3f FindingEvidence=f65231e1f862 FindingSubject=11e82b0a77d6 FindingsByKeyValue=41e93a483c67 FirstViewAgainAnswer=22627a4a4678 FirstViewAgainAnswerAsked=0fa827c2bc13 FirstViewsAnswer=3a1fe57c7be6 FirstViewsAnswerEntriesItem=8b117619ca3f FirstViewsAnswerWantsItem=d8cb80636647 HandOverAnswer=aba938323932 HaveByNodeModuleValue=b499318c2374 HaveByNodeNodeValue=9296a55d7aa6 HealthByNodeValue=03bfa8c83d5b JudgeDirectoriesAnswer=f590024f1e91 LoginFallback=78e280ece645 ManifestReadsAnswer=44ff978272b4 ManifestReadsChanged=fac832ea55d0 ManifestReadsChangedEvent=88e4af52759d Module=e604719b1fb3 NetworkHealth=3af75f8af8d7 NetworkPart=502939443fb6 NodeAccount=1faabd57fa41 NodeDirectory=12b7f58b657c NodeOwn=4fecee42b3c0 NodeRecord=13f2a683c1bf PackagesAnswer=e4128836129d PackagesAnswerKey=60572f6eefc3 PackagesAnswerKeyPackagesItem=955a58e4952f PackagesByNodeValue=4cdc8f8bdc58 PackagesByNodeValuePackagesItem=955a58e4952f PeerSeen=43e6f359f1aa PlacedDataItem=82d650fb9d31 ProcessBuild=133a0f6e81cf ProcessBuilds=32cfa418abfd ProcessBuildsAnswer=4ac4ce32fbeb PullWait=99288cc066ec RefusedEvent=0e155c7e6cc6 Revision=165e37beccf5 RootAccountVerdict=7a8c0d2e5b9a RootFreeAnswer=c83678c70792 RootVerdict=0855e131d15c Running=8a19fd7f6446 RunningEvent=f3d8fedcfd51 Said=634cca3367f2 SealedBox=2c687c69b978 SeatList=248a1dc3029b SeatListAgainAnswer=8eb7fbcb7018 SeatListAnswer=8eb7fbcb7018 SeatListHeld=6b5c0f8ddcc2 SeatListStatus=bfbb572c49dd SetuidSearchAnswer=f590024f1e91 UnitsHealth=0d9cf7be9bc7 UserListWritten=caae94077890 Wait=fc85cf95ac27 WaitEndedEvent=2bf6d38041c0 WaitHeldEvent=2bf6d38041c0" ) const ( @@ -1272,6 +1272,16 @@ type CompositionAnswerAttempt struct { WantRevision int64 `json:"want_revision"` } +// CompositionAnswerDriftItem is a type of the contract. +type CompositionAnswerDriftItem struct { + // how its owner or mode on disk differ, in words + Drift string `json:"drift"` + // the directory entry's id in the composition + ID string `json:"id"` + // its path on the machine + Path string `json:"path"` +} + // CompositionAnswerHave is what the module's have key says now; absent when it says nothing. type CompositionAnswerHave struct { // digest @@ -1371,6 +1381,8 @@ type CompositionAnswer struct { Composition Revision `json:"composition"` // every resource that differs from what runs, when asked Diff []map[string]any `json:"diff,omitempty"` + // when the diff is asked, each directory entry of what runs that the mesh made, as its record holds, whose owner or mode on disk differ from it (H-A-392 (b), H-A-458 (2)): read-only; the engine sets it right at its next start or apply of the module + Drift []CompositionAnswerDriftItem `json:"drift,omitempty"` // is the form of what this value carries, left out while it is 1 (design 47 H2 §780). Form int64 `json:"form,omitempty"` // what the module's have key says now; absent when it says nothing @@ -1749,7 +1761,9 @@ type HaveByNodeModuleValue struct { // what the node keeps of the module as it runs Kept []string `json:"kept,omitempty"` // how far it has come - Phase string `json:"phase"` + Phase string `json:"phase"` + // the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want names the same; absent for a want in none + Pipeline string `json:"pipeline,omitempty"` PullWait *PullWait `json:"pull-wait,omitempty"` // the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again Run string `json:"run,omitempty"` diff --git a/go/seats/nodeengine/contract_test.go b/go/seats/nodeengine/contract_test.go index aaed871..a264779 100644 --- a/go/seats/nodeengine/contract_test.go +++ b/go/seats/nodeengine/contract_test.go @@ -83,7 +83,7 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "a move waiting for a person's yes", subject: "", given: "{\"build-alone\":true,\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"judgement\":\"recreates\",\"kept\":[\"tool runner not declared\"],\"phase\":\"waiting-yes\",\"v\":1,\"waits\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"}", wire: "{\"build-alone\":true,\"composed\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"judgement\":\"recreates\",\"kept\":[\"tool runner not declared\"],\"phase\":\"waiting-yes\",\"v\":1,\"waits\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"}", decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, - {name: "a module applied from a composition run names the run (design 47 H2 §813 (1), H-A-388)", subject: "", given: "{\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"phase\":\"running\",\"run\":\"178\",\"v\":1}", wire: "{\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"phase\":\"running\",\"run\":\"178\",\"v\":1}", + {name: "a module applied from a composition run names the run and its pipeline (design 47 H2 §813 (1), H-A-388, H-A-458 (1))", subject: "", given: "{\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"phase\":\"running\",\"pipeline\":\"main.mesh-host\",\"run\":\"178\",\"v\":1}", wire: "{\"fp\":\"src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275\",\"health\":\"ok\",\"phase\":\"running\",\"pipeline\":\"main.mesh-host\",\"run\":\"178\",\"v\":1}", decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "the bus module's have carries the user list written (typed from the engine's values)", subject: "", given: "{\"health\":\"ok\",\"phase\":\"running\",\"user-list\":{\"at\":\"2026-11-05T12:00:00Z\",\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"follows\":\"grants\",\"handed\":{\"at\":\"2026-11-05T12:00:00Z\",\"box\":{\"ct\":\"c\",\"eph\":\"e\",\"iv\":\"i\",\"tag\":\"t\",\"v\":1},\"from\":\"ace\",\"to\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"users\":3},\"key\":\"-----BEGIN PUBLIC KEY-----\",\"revision\":7,\"source\":\"user-list\",\"users\":3,\"wanted\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"v\":1}", wire: "{\"health\":\"ok\",\"phase\":\"running\",\"user-list\":{\"at\":\"2026-11-05T12:00:00Z\",\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"follows\":\"grants\",\"handed\":{\"at\":\"2026-11-05T12:00:00Z\",\"box\":{\"ct\":\"c\",\"eph\":\"e\",\"iv\":\"i\",\"tag\":\"t\",\"v\":1},\"from\":\"ace\",\"to\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"users\":3},\"key\":\"-----BEGIN PUBLIC KEY-----\",\"revision\":7,\"source\":\"user-list\",\"users\":3,\"wanted\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"v\":1}", decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, @@ -137,6 +137,8 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v ConvergedAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "composition names the filter part kept because allowed did not answer", subject: "", given: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}", wire: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}", decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, + {name: "composition with diff names a directory the mesh made whose mode drifted (H-A-392 (b), H-A-458 (2))", subject: "", given: "{\"composition\":{\"key\":\"\"},\"drift\":[{\"drift\":\"mode 0700, 0711 declared\",\"id\":\"postgres.data\",\"path\":\"/srv/db\"}],\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"postgres\",\"node\":\"desk\",\"started\":true}", wire: "{\"composition\":{\"key\":\"\"},\"drift\":[{\"drift\":\"mode 0700, 0711 declared\",\"id\":\"postgres.data\",\"path\":\"/srv/db\"}],\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"postgres\",\"node\":\"desk\",\"started\":true}", + decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "composition-diff asks a module against a digest", subject: "", given: "{\"digest\":\"sha256:aa\",\"module\":\"plex\"}", wire: "{\"digest\":\"sha256:aa\",\"module\":\"plex\"}", decode: func(b []byte) (any, error) { var v CompositionDiffInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "composition-diff answers the entries that differ per resource, a secret masked", subject: "", given: "{\"module\":\"plex\",\"node\":\"ace\",\"other\":{\"digest\":\"sha256:aa\",\"key\":\"plex\",\"revision\":12},\"resources\":[{\"entries\":[{\"name\":\"PLEX_LOG_LEVEL\",\"other\":\"debug\",\"running\":\"info\"},{\"masked\":true,\"name\":\"PLEX_TOKEN\"}],\"resource\":\"service:plex\"}],\"running\":\"sha256:bb\"}", wire: "{\"module\":\"plex\",\"node\":\"ace\",\"other\":{\"digest\":\"sha256:aa\",\"key\":\"plex\",\"revision\":12},\"resources\":[{\"entries\":[{\"name\":\"PLEX_LOG_LEVEL\",\"other\":\"debug\",\"running\":\"info\"},{\"masked\":true,\"name\":\"PLEX_TOKEN\"}],\"resource\":\"service:plex\"}],\"running\":\"sha256:bb\"}", diff --git a/seats/node-engine/fixtures/states.json b/seats/node-engine/fixtures/states.json index 7b99d04..b4a2f3f 100644 --- a/seats/node-engine/fixtures/states.json +++ b/seats/node-engine/fixtures/states.json @@ -346,14 +346,15 @@ } }, { - "name": "a module applied from a composition run names the run (design 47 H2 §813 (1), H-A-388)", + "name": "a module applied from a composition run names the run and its pipeline (design 47 H2 §813 (1), H-A-388, H-A-458 (1))", "of": "state:have/.", "given": { "v": 1, "fp": "src2:62756c6c6462756c6c6462756c6c6462756c6c6462756c6c6462756c6c646275", "phase": "running", "health": "ok", - "run": "178" + "run": "178", + "pipeline": "main.mesh-host" } }, { diff --git a/seats/node-engine/fixtures/verbs.json b/seats/node-engine/fixtures/verbs.json index 23dfb66..acf9e88 100644 --- a/seats/node-engine/fixtures/verbs.json +++ b/seats/node-engine/fixtures/verbs.json @@ -333,6 +333,30 @@ ] } }, + { + "name": "composition with diff names a directory the mesh made whose mode drifted (H-A-392 (b), H-A-458 (2))", + "of": "verb:composition.answer", + "given": { + "node": "desk", + "module": "postgres", + "started": true, + "composition": { + "key": "" + }, + "judged": { + "judgement": "", + "waits_for_yes": false, + "words": "" + }, + "drift": [ + { + "id": "postgres.data", + "path": "/srv/db", + "drift": "mode 0700, 0711 declared" + } + ] + } + }, { "name": "composition-diff asks a module against a digest", "of": "verb:composition-diff.input", diff --git a/seats/node-engine/seat.json b/seats/node-engine/seat.json index a5aac3a..4711ce8 100644 --- a/seats/node-engine/seat.json +++ b/seats/node-engine/seat.json @@ -1,6 +1,6 @@ { "format": 1, - "form": 3, + "form": 4, "seat": "node-engine", "scope": "node", "grain": "whole", @@ -456,6 +456,32 @@ }, "description": "every resource that differs from what runs, when asked" }, + "drift": { + "type": "array", + "description": "when the diff is asked, each directory entry of what runs that the mesh made, as its record holds, whose owner or mode on disk differ from it (H-A-392 (b), H-A-458 (2)): read-only; the engine sets it right at its next start or apply of the module", + "items": { + "type": "object", + "required": [ + "id", + "path", + "drift" + ], + "properties": { + "id": { + "type": "string", + "description": "the directory entry's id in the composition" + }, + "path": { + "type": "string", + "description": "its path on the machine" + }, + "drift": { + "type": "string", + "description": "how its owner or mode on disk differ, in words" + } + } + } + }, "own": { "type": "object", "properties": { @@ -1334,6 +1360,10 @@ "type": "string", "description": "the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again" }, + "pipeline": { + "type": "string", + "description": "the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want names the same; absent for a want in none" + }, "kept": { "type": "array", "items": { diff --git a/ts/seats/nodeengine/index.d.ts b/ts/seats/nodeengine/index.d.ts index 24d9192..debebf7 100644 --- a/ts/seats/nodeengine/index.d.ts +++ b/ts/seats/nodeengine/index.d.ts @@ -887,6 +887,15 @@ export interface CompositionAnswerAttempt { "want_revision": number; } +export interface CompositionAnswerDriftItem { + /** how its owner or mode on disk differ, in words */ + "drift": string; + /** the directory entry's id in the composition */ + "id": string; + /** its path on the machine */ + "path": string; +} + /** what the module's have key says now; absent when it says nothing */ export interface CompositionAnswerHave { /** digest */ @@ -984,6 +993,8 @@ export interface CompositionAnswer { "composition": Revision; /** every resource that differs from what runs, when asked */ "diff"?: Record[]; + /** when the diff is asked, each directory entry of what runs that the mesh made, as its record holds, whose owner or mode on disk differ from it (H-A-392 (b), H-A-458 (2)): read-only; the engine sets it right at its next start or apply of the module */ + "drift"?: CompositionAnswerDriftItem[]; /** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */ "form"?: number; /** what the module's have key says now; absent when it says nothing */ @@ -1339,6 +1350,8 @@ export interface HaveByNodeModuleValue { "kept"?: string[]; /** how far it has come */ "phase": "backing-up" | "applying" | "checking" | "running" | "failed" | "removed" | "held" | "waiting-yes"; + /** the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want names the same; absent for a want in none */ + "pipeline"?: string; "pull-wait"?: PullWait; /** the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again */ "run"?: string; -- 2.54.0 From ba5a253888ca0d7767b76ecb8b1ad7367c577662 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 03:13:15 +0100 Subject: [PATCH 8/8] H2 K: the have's pipeline is compared only when the want's branch is the same MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A pipeline's key is ., so the engine compares a want's run with the have's when the want's branch, the key without its last part, is the have's; the description said "the same" pipeline. Description only, no form change. Generated with mesh-delivery's seatgen (built from b65b6173's source); seatgen -check clean in all five folders. Review round 2, finding: the whole pipeline key compared instead of its branch. Builds: design 47 H2 §813 (1); H-A-429 (1), H-A-458 (1) --- go/seats/nodeengine/contract.go | 2 +- seats/node-engine/seat.json | 2 +- ts/seats/nodeengine/index.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go/seats/nodeengine/contract.go b/go/seats/nodeengine/contract.go index 95f3682..a1ea2f2 100644 --- a/go/seats/nodeengine/contract.go +++ b/go/seats/nodeengine/contract.go @@ -1762,7 +1762,7 @@ type HaveByNodeModuleValue struct { Kept []string `json:"kept,omitempty"` // how far it has come Phase string `json:"phase"` - // the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want names the same; absent for a want in none + // the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want's branch is the same, the key without its last .; absent for a want in none Pipeline string `json:"pipeline,omitempty"` PullWait *PullWait `json:"pull-wait,omitempty"` // the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again diff --git a/seats/node-engine/seat.json b/seats/node-engine/seat.json index 4711ce8..6214da6 100644 --- a/seats/node-engine/seat.json +++ b/seats/node-engine/seat.json @@ -1362,7 +1362,7 @@ }, "pipeline": { "type": "string", - "description": "the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want names the same; absent for a want in none" + "description": "the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want's branch is the same, the key without its last .; absent for a want in none" }, "kept": { "type": "array", diff --git a/ts/seats/nodeengine/index.d.ts b/ts/seats/nodeengine/index.d.ts index debebf7..05a956f 100644 --- a/ts/seats/nodeengine/index.d.ts +++ b/ts/seats/nodeengine/index.d.ts @@ -1350,7 +1350,7 @@ export interface HaveByNodeModuleValue { "kept"?: string[]; /** how far it has come */ "phase": "backing-up" | "applying" | "checking" | "running" | "failed" | "removed" | "held" | "waiting-yes"; - /** the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want names the same; absent for a want in none */ + /** the pipeline of the want the module was applied from, its key ., beside its run (H-A-429 (1), H-A-458 (1)): a want's run is compared with this run only when the want's branch is the same, the key without its last .; absent for a want in none */ "pipeline"?: string; "pull-wait"?: PullWait; /** the composition run's pipeline sequence, in decimal, the module was applied from (design 47 H2 §813 (1), H-A-388): a restarted engine applies no older run again */ -- 2.54.0