The generated contracts write date-time as time.Time (seatgen of B5d); the conditions and vault clients follow (ADR 0634; issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 15:06:14 +01:00
parent 25da1f8879
commit 181441e91b
14 changed files with 194 additions and 173 deletions
+26 -25
View File
@@ -8,6 +8,7 @@ import (
"encoding/json"
"errors"
"strings"
"time"
)
// Seat is the seat's name.
@@ -348,7 +349,7 @@ func DecodeFindingsByKeyValue(raw []byte) (FindingsByKeyValue, error) {
// AccountsHanded is the hashes of the users of the list, sealed to the vault.
type AccountsHanded struct {
// when
At string `json:"at"`
At time.Time `json:"at"`
Box SealedBox `json:"box"`
From string `json:"from"`
// the fingerprint of the vault's key
@@ -557,8 +558,8 @@ type FailedUnit struct {
Result string `json:"result,omitempty"`
Scope string `json:"scope"`
// since when
Since string `json:"since"`
Unit string `json:"unit"`
Since time.Time `json:"since"`
Unit string `json:"unit"`
}
// FindingAction is one answer the operator may give from a notification.
@@ -579,8 +580,8 @@ const (
// FindingEvidence is one observation, as it was said.
type FindingEvidence struct {
At string `json:"at"`
Said string `json:"said"`
At time.Time `json:"at"`
Said string `json:"said"`
}
// FindingSubject is what the condition is about.
@@ -598,10 +599,10 @@ type FindingSubject struct {
// LoginFallback is a login that fell back to another node.
type LoginFallback struct {
// when
At string `json:"at"`
From string `json:"from"`
Node string `json:"node"`
Why string `json:"why"`
At time.Time `json:"at"`
From string `json:"from"`
Node string `json:"node"`
Why string `json:"why"`
}
// ManifestReadsChanged is what a node-engine says when what it reads changed or its node returned (ADR 0618 §4).
@@ -651,7 +652,7 @@ const (
type NetworkHealth struct {
Parts []NetworkPart `json:"parts"`
// since when
Since string `json:"since"`
Since time.Time `json:"since"`
// running, degraded or unknown
State string `json:"state"`
}
@@ -663,12 +664,12 @@ type NetworkPart struct {
Reason string `json:"reason,omitempty"`
Said string `json:"said,omitempty"`
// since when
Since string `json:"since"`
State string `json:"state"`
Streak int64 `json:"streak,omitempty"`
Targets []string `json:"targets,omitempty"`
Toward []string `json:"toward,omitempty"`
Writer string `json:"writer,omitempty"`
Since time.Time `json:"since"`
State string `json:"state"`
Streak int64 `json:"streak,omitempty"`
Targets []string `json:"targets,omitempty"`
Toward []string `json:"toward,omitempty"`
Writer string `json:"writer,omitempty"`
}
// NodeAccount is an account the node needs to log in again.
@@ -678,7 +679,7 @@ type NodeAccount struct {
Reason string `json:"reason"`
Resource string `json:"resource,omitempty"`
// since when
Since string `json:"since"`
Since time.Time `json:"since"`
}
// NodeDirectory is a directory found where the node expected none.
@@ -688,7 +689,7 @@ type NodeDirectory struct {
Reason string `json:"reason"`
Resource string `json:"resource"`
// since when
Since string `json:"since"`
Since time.Time `json:"since"`
}
// NodeOwn is what a node's own composition carries beside its resources.
@@ -744,14 +745,14 @@ type PlacedDataItem struct {
// PullWait is the pull from a store a failed apply waits on.
type PullWait struct {
// when the pull began
Began string `json:"began"`
Began time.Time `json:"began"`
// that seat's holder, whose settling the apply waits for
Holder string `json:"holder"`
Image string `json:"image"`
// what triggered the last try again, in words
Retried string `json:"retried,omitempty"`
// when the apply was last tried again
RetriedAt string `json:"retried-at,omitempty"`
RetriedAt *time.Time `json:"retried-at,omitempty"`
// the seat the pull came through
Seat string `json:"seat,omitempty"`
}
@@ -779,8 +780,8 @@ type RootAccountVerdict struct {
Reason string `json:"reason,omitempty"`
Resource string `json:"resource"`
// since when
Since string `json:"since"`
State string `json:"state"`
Since time.Time `json:"since"`
State string `json:"state"`
}
// RootVerdict is the engine's root-free verdict (ADR 0563 §6).
@@ -859,7 +860,7 @@ type UnitsHealth struct {
// UserListWritten is the bus's user list as the engine of the bus node wrote it to the bus module's file.
type UserListWritten struct {
// when
At string `json:"at"`
At time.Time `json:"at"`
// the digest of the file on the machine after the write
Digest string `json:"digest,omitempty"`
// why a write failed
@@ -1361,7 +1362,7 @@ type PackagesByNodeValue struct {
// HealthByNodeValue is one value of the state health under the key <node>.
type HealthByNodeValue struct {
// when
At string `json:"at"`
At time.Time `json:"at"`
Contract int64 `json:"contract,omitempty"`
Fallback *LoginFallback `json:"fallback,omitempty"`
Found []NodeDirectory `json:"found,omitempty"`
@@ -1377,7 +1378,7 @@ type HealthByNodeValue struct {
// FindingsByKeyValue is one value of the state findings under the key <key>.
type FindingsByKeyValue struct {
Actions []FindingAction `json:"actions,omitempty"`
At string `json:"at"`
At time.Time `json:"at"`
// newest first, at most 10
Evidence []FindingEvidence `json:"evidence,omitempty"`
Explanation string `json:"explanation,omitempty"`