H2 composition-diff: the node-engine seat's read verb composition-diff

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
This commit is contained in:
2026-11-21 23:04:35 +01:00
parent 1b320b2312
commit 3fbe33612f
6 changed files with 247 additions and 1 deletions
+45 -1
View File
@@ -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)