Refresh the test copies of node-uplink, node-resolver and node-display-session to their whole definitions

mesh-sdk joins the sign-in-page milestone only to replace its seatlisttest copies with the three
seats' whole definitions, and to update the two tests that assert today's verbs; the seat-name
constants and the package's own code stay untouched (ADR 0613 §5: nothing seat-specific is added
to mesh-sdk).

Builds: design 08 sign-in-page §1, §2, §3, §4
This commit is contained in:
jochen
2026-11-24 21:13:21 +01:00
parent 0cc22bd7a4
commit 18c68fda5a
5 changed files with 762 additions and 22 deletions
+11 -4
View File
@@ -8,12 +8,14 @@ import (
// Defends novox/hq ADR 0208: the graphical session is one module per piece, on the mesh's seats.
// §2: the eleven roles are the mesh's own node seats, each with the verbs it starts with.
// §2: the eleven roles are the mesh's own node seats, each with the verbs it starts with. Defends design 08
// sign-in-page §3 (novox/hq ADR 0687 §4): the display session gains the required verb `open`, and its decision
// gains ADR 0687 and ADR 0613.
func TestTheGraphicalSessionsSeatsAreTheMeshsOwnWithTheirVerbs(t *testing.T) {
want := map[string][]string{
LoginManagerSeat: {"sessions"},
DisplayServerSeat: {"displays", "layout"},
DisplaySessionSeat: {"reload", "workspaces", "windows"},
DisplaySessionSeat: {"reload", "workspaces", "windows", "open"},
TerminalEmulatorSeat: {"open"},
LauncherSeat: {"menu", "secret"},
NotifierSeat: {"send", "history"},
@@ -23,14 +25,19 @@ func TestTheGraphicalSessionsSeatsAreTheMeshsOwnWithTheirVerbs(t *testing.T) {
CompositorSeat: nil,
SecretServiceSeat: nil,
}
decisions := map[string]string{DisplaySessionSeat: "novox/hq ADR 0208, ADR 0687, ADR 0613"}
for name, verbs := range want {
s, ok := SeatNamed(name)
if !ok {
t.Errorf("%s is not in the mesh's set", name)
continue
}
if s.Scope != ScopeNode || s.Decision != "novox/hq ADR 0208" {
t.Errorf("%s is %s-scoped under %q", name, s.Scope, s.Decision)
wantDecision := decisions[name]
if wantDecision == "" {
wantDecision = "novox/hq ADR 0208"
}
if s.Scope != ScopeNode || s.Decision != wantDecision {
t.Errorf("%s is %s-scoped under %q, want %q", name, s.Scope, s.Decision, wantDecision)
}
var got []string
for _, v := range s.Serves {
+14 -8
View File
@@ -7,16 +7,19 @@ import (
// Defends novox/hq ADR 0247: a machine's own resolver is a node seat, held only where something requires
// `split-dns`; where it is held it writes the resolver file and the uplink's holder steps back from it.
// Defends design 08 sign-in-page §2 (novox/hq ADR 0687 §2): the seat gains the required verb
// `uplink-names`, which replaces nothing of a shell command.
// The seat: node-scoped, decided by ADR 0247, and its three verbs required of every holder — a holder
// exists only once the module serving them does, so nothing has to be optional while it catches up.
// The seat: node-scoped, decided by ADR 0247 (gaining ADR 0687 and ADR 0613), and its four verbs required
// of every holder — a holder exists only once the module serving them does, so nothing has to be optional
// while it catches up.
func TestTheMachinesOwnResolverIsANodeSeatWithItsVerbs(t *testing.T) {
s, ok := SeatNamed(ResolverSeat)
if !ok {
t.Fatalf("%s is not in the mesh's set", ResolverSeat)
}
if s.Scope != ScopeNode || s.Decision != "novox/hq ADR 0247" || s.Delivers != "" || s.Replicated {
t.Errorf("%s is %+v; a node seat under ADR 0247 that delivers nothing", ResolverSeat, s)
if s.Scope != ScopeNode || s.Decision != "novox/hq ADR 0247, ADR 0687, ADR 0613" || s.Delivers != "" || s.Replicated {
t.Errorf("%s is %+v; a node seat under ADR 0247, ADR 0687, ADR 0613 that delivers nothing", ResolverSeat, s)
}
var got []string
for _, v := range s.Serves {
@@ -24,12 +27,15 @@ func TestTheMachinesOwnResolverIsANodeSeatWithItsVerbs(t *testing.T) {
if v.Optional {
t.Errorf("%s.%s is optional; its first holder serves it", ResolverSeat, v.Name)
}
if v.Description == "" || v.Input["type"] != "object" || len(v.Replaces) == 0 {
t.Errorf("%s.%s has no description, no object schema or says it replaces nothing", ResolverSeat, v.Name)
if v.Description == "" || v.Input["type"] != "object" {
t.Errorf("%s.%s has no description or no object schema", ResolverSeat, v.Name)
}
if v.Name != "uplink-names" && len(v.Replaces) == 0 {
t.Errorf("%s.%s says it replaces nothing", ResolverSeat, v.Name)
}
}
if strings.Join(got, " ") != "routes route unroute" {
t.Errorf("%s serves %v, not routes, route and unroute", ResolverSeat, got)
if strings.Join(got, " ") != "routes route unroute uplink-names" {
t.Errorf("%s serves %v, not routes, route, unroute and uplink-names", ResolverSeat, got)
}
// The verbs name a link, domains and servers, and never a VPN: the resolver knows nothing of one.
for _, v := range s.Serves {
@@ -2,16 +2,52 @@
"format": 1,
"seat": "node-display-session",
"scope": "node",
"grain": "seat-list",
"grain": "whole",
"domain": "Core",
"decision": "novox/hq ADR 0208",
"decision": "novox/hq ADR 0208, ADR 0687, ADR 0613",
"verbs": [
{
"name": "reload",
"description": "Reload the session's configuration in place, keeping its windows.",
"input": {
"properties": {},
"properties": {
"force": {
"type": "boolean",
"description": "reload even when the check finds errors"
}
},
"type": "object"
},
"answer": {
"type": "object",
"required": [
"reloaded",
"errors"
],
"properties": {
"reloaded": {
"type": "boolean"
},
"errors": {
"type": "array",
"items": {
"$ref": "#/defs/ConfigError"
},
"description": "the configuration's problems, found whether or not it reloaded"
},
"why": {
"type": "string",
"description": "why it did not reload, when it did not"
},
"i3": {
"type": "array",
"description": "i3's own outcome of each command it ran to reload; a sway holder could not give this"
},
"watcher": {
"type": "object",
"description": "i3's own watcher status; a sway holder could not give this"
}
}
}
},
{
@@ -20,6 +56,20 @@
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"required": [
"workspaces"
],
"properties": {
"workspaces": {
"type": "array",
"items": {
"$ref": "#/defs/Workspace"
}
}
}
}
},
{
@@ -33,6 +83,67 @@
}
},
"type": "object"
},
"answer": {
"type": "object",
"required": [
"windows"
],
"properties": {
"windows": {
"type": "array",
"items": {
"$ref": "#/defs/Window"
}
}
}
}
},
{
"name": "open",
"description": "Open the address in the person's default browser. Refused, naming the reason: a scheme other than http or https (named), no scheme (a file path), no host, an address over 2048 bytes once encoded, no graphical session running, no default program for the scheme, the opener ending with a failure (its status named). The encoding: RFC 3986's unreserved characters and : / ? # [ ] @ & = + % are kept as they are; every other character is percent-encoded, as the bytes of its UTF-8 form. Nothing is refused for a character, and no shell reads the address. Its callers are the modules whose manifest invokes it and the operator, through the mesh MCP server; the sign-in reaction is not one.",
"class": "act",
"input": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string",
"maxLength": 2048,
"description": "the address to open, http or https"
}
}
},
"answer": {
"type": "object",
"required": [
"address",
"started"
],
"properties": {
"address": {
"type": "string",
"description": "the address as handed on, encoded"
},
"program": {
"type": "string",
"description": "the desktop entry that opened it (as browser.desktop); given only once the opener started"
},
"command": {
"type": "string",
"description": "the first word of that entry's command; given only once the opener started"
},
"started": {
"type": "string",
"enum": [
"opened",
"opening"
],
"description": "opened when the opener ended well within its bound, opening when it still ran at its bound"
}
}
}
}
],
@@ -41,5 +152,111 @@
"kind": "config",
"comment": "#"
}
]
],
"defs": {
"ConfigError": {
"type": "object",
"description": "one problem the configuration check reports",
"required": [
"text"
],
"properties": {
"file": {
"type": "string"
},
"line": {
"type": "integer"
},
"text": {
"type": "string"
}
}
},
"Workspace": {
"type": "object",
"required": [
"num",
"name",
"output",
"visible",
"focused"
],
"properties": {
"num": {
"type": "integer"
},
"name": {
"type": "string"
},
"output": {
"type": "string"
},
"visible": {
"type": "boolean"
},
"focused": {
"type": "boolean"
},
"urgent": {
"type": "boolean"
}
}
},
"Window": {
"type": "object",
"required": [
"window",
"title",
"workspace",
"output"
],
"properties": {
"con_id": {
"type": "integer"
},
"window": {
"type": "string"
},
"class": {
"type": "string"
},
"instance": {
"type": "string"
},
"role": {
"type": "string"
},
"title": {
"type": "string"
},
"workspace": {
"type": "string"
},
"output": {
"type": "string"
},
"focused": {
"type": "boolean"
},
"urgent": {
"type": "boolean"
},
"floating": {
"type": "boolean"
},
"fullscreen": {
"type": "boolean"
},
"scratchpad": {
"type": "boolean"
},
"marks": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
@@ -2,9 +2,9 @@
"format": 1,
"seat": "node-resolver",
"scope": "node",
"grain": "seat-list",
"grain": "whole",
"domain": "Connectivity",
"decision": "novox/hq ADR 0247",
"decision": "novox/hq ADR 0247, ADR 0687, ADR 0613",
"verbs": [
{
"name": "routes",
@@ -17,6 +17,44 @@
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"required": [
"mesh",
"links",
"outside_writes",
"uplink_names",
"mesh_resolvers"
],
"properties": {
"mesh": {
"$ref": "#/defs/Scope",
"description": "the global scope: the mesh's resolvers, which answer every name nothing routes elsewhere"
},
"links": {
"type": "array",
"items": {
"$ref": "#/defs/Scope"
},
"description": "every link given servers of its own"
},
"outside_writes": {
"type": "array",
"items": {
"$ref": "#/defs/Displacement"
},
"description": "the resolver file's outside writes, newest first"
},
"uplink_names": {
"$ref": "#/defs/UplinkNamesOnLink",
"description": "the names of the applied list that resolved holds on the named link now, never the file's"
},
"mesh_resolvers": {
"$ref": "#/defs/MeshResolversSilence",
"description": "whether the mesh's resolvers are silent now, by the fallback's guard, and since when"
}
}
}
},
{
@@ -48,6 +86,36 @@
"servers"
],
"type": "object"
},
"answer": {
"type": "object",
"required": [
"link",
"servers",
"domains",
"said"
],
"properties": {
"link": {
"type": "string"
},
"servers": {
"type": "array",
"items": {
"type": "string"
}
},
"domains": {
"type": "array",
"items": {
"type": "string"
}
},
"said": {
"type": "string",
"description": "what was done, in words the operator reads"
}
}
}
},
{
@@ -67,6 +135,71 @@
"link"
],
"type": "object"
},
"answer": {
"type": "object",
"required": [
"link",
"said"
],
"properties": {
"link": {
"type": "string"
},
"said": {
"type": "string",
"description": "what was done, in words the operator reads"
}
}
}
},
{
"name": "uplink-names",
"description": "Set the host names the uplink's holder checks a network's sign-in through: read from what resolved holds for the named link, not from the file. Its callers are the modules whose manifest invokes it, and the operator, through the mesh MCP server. Refused, naming the name and the reason: a name that is not a host name (a wildcard, a trailing dot, a label over 63 bytes), the root, the mesh's own domain or a name under it, or more than 8 names.",
"input": {
"type": "object",
"required": [
"names"
],
"properties": {
"names": {
"type": "array",
"minItems": 0,
"maxItems": 8,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 253,
"description": "a host name, in letters, digits, hyphens and dots, taken lower-cased"
},
"description": "the list replaces what was given before; an empty list takes every name away"
}
}
},
"answer": {
"type": "object",
"required": [
"names",
"link",
"set_at"
],
"properties": {
"names": {
"type": "array",
"items": {
"type": "string"
},
"description": "the names now given"
},
"link": {
"type": "string",
"description": "the link they are answered over now; empty when no link carries a default route"
},
"set_at": {
"type": "string",
"description": "when the list was set, RFC 3339"
}
}
}
}
],
@@ -74,5 +207,113 @@
{
"path": "/etc/resolv.conf"
}
]
],
"defs": {
"Scope": {
"type": "object",
"description": "one place resolved sends names: the machine's global servers, or a link",
"required": [
"servers",
"domains"
],
"properties": {
"link": {
"type": "string"
},
"servers": {
"type": "array",
"items": {
"type": "string"
}
},
"domains": {
"type": "array",
"items": {
"type": "string"
},
"description": "the routing domains, without resolved's leading tilde: every name under one goes to these servers"
},
"default_route": {
"type": "boolean",
"description": "whether names no domain routes may also go here; only the mesh's resolvers are"
}
}
},
"Displacement": {
"type": "object",
"description": "one outside write of the resolver file, as the guard says it",
"required": [
"id",
"at"
],
"properties": {
"id": {
"type": "string"
},
"at": {
"type": "string",
"description": "RFC 3339"
},
"writer": {
"type": "string",
"description": "who the file's own header names, or empty"
},
"taken_by": {
"type": "string",
"description": "the module that took it"
},
"taken_at": {
"type": "string",
"description": "when it was taken, RFC 3339"
},
"ended": {
"type": "string",
"description": "when the module's own file stood again, RFC 3339"
},
"how": {
"type": "string"
}
}
},
"UplinkNamesOnLink": {
"type": "object",
"description": "the applied list's names, as resolved holds them on the named link now",
"required": [
"names",
"link",
"refused"
],
"properties": {
"names": {
"type": "array",
"items": {
"type": "string"
}
},
"link": {
"type": "string"
},
"refused": {
"type": "string",
"description": "the reason resolved last refused them, or empty"
}
}
},
"MeshResolversSilence": {
"type": "object",
"description": "whether the mesh's resolvers are silent now, and since when",
"required": [
"silent"
],
"properties": {
"silent": {
"type": "boolean"
},
"since": {
"type": "string",
"description": "RFC 3339, when silent is true"
}
}
}
}
}
+272 -3
View File
@@ -2,9 +2,9 @@
"format": 1,
"seat": "node-uplink",
"scope": "node",
"grain": "seat-list",
"grain": "whole",
"domain": "Connectivity",
"decision": "novox/hq ADR 0117",
"decision": "novox/hq ADR 0117, ADR 0687, ADR 0689, ADR 0613",
"verbs": [
{
"name": "resolvers",
@@ -13,6 +13,80 @@
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"required": [
"path",
"nameservers",
"written_by_the_mesh",
"changed"
],
"properties": {
"path": {
"type": "string",
"description": "the resolver file's path"
},
"link": {
"type": "string",
"description": "the file it points to, when it is a symbolic link"
},
"nameservers": {
"type": "array",
"items": {
"type": "string"
},
"description": "the resolvers it lists"
},
"search": {
"type": "array",
"items": {
"type": "string"
},
"description": "the search domains it lists"
},
"options": {
"type": "array",
"items": {
"type": "string"
},
"description": "the options line's words"
},
"header": {
"type": "array",
"items": {
"type": "string"
},
"description": "the file's leading comment lines, the first four"
},
"written_by_the_mesh": {
"type": "boolean",
"description": "the file is the one the mesh declares, by its header"
},
"changed": {
"type": "string",
"description": "when the file was last changed, RFC 3339"
},
"owner": {
"type": "string",
"description": "the account that owns the file"
},
"writer": {
"type": "string",
"description": "who wrote it when the mesh did not, as far as the machine shows"
},
"why": {
"type": "string",
"description": "why that name is given, for writer"
},
"beside": {
"type": "array",
"items": {
"$ref": "#/defs/BesideFile"
},
"description": "every file next to it whose name starts with its own: a backup a writer kept"
}
}
}
},
{
@@ -22,13 +96,208 @@
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"required": [
"links"
],
"properties": {
"links": {
"type": "array",
"items": {
"$ref": "#/defs/Link"
},
"description": "every link from the kernel, with its default route and what the network manager knows of its names, the link carrying the default route first"
},
"dns_not_read": {
"type": "string",
"description": "the network manager's names could not be read, and why"
}
}
}
}
],
"events": [
{
"name": "sign-in-asked",
"subject": "sign-in-asked.<node>",
"body": {
"$ref": "#/defs/SignInAsked"
}
},
{
"name": "sign-in-ended",
"subject": "sign-in-ended.<node>",
"body": {
"$ref": "#/defs/SignInEnded"
}
}
],
"family": {
"name": "node-uplink.events",
"max-age-days": 7
},
"paths": [
{
"path": "/etc/resolv.conf",
"steps-back-for": "node-resolver"
}
]
],
"defs": {
"BesideFile": {
"type": "object",
"description": "one file beside the resolver file, a backup a writer kept",
"required": [
"path",
"changed"
],
"properties": {
"path": {
"type": "string"
},
"changed": {
"type": "string",
"description": "RFC 3339"
},
"mesh": {
"type": "boolean",
"description": "it begins as the mesh's own file does: the file a writer moved aside"
}
}
},
"LinkDNS": {
"type": "object",
"description": "the resolvers and search domains the network manager knows for one link",
"properties": {
"servers": {
"type": "array",
"items": {
"type": "string"
}
},
"domains": {
"type": "array",
"items": {
"type": "string"
}
},
"manager": {
"type": "string",
"description": "the program that said so"
},
"state": {
"type": "string",
"description": "its word for the link"
}
}
},
"Link": {
"type": "object",
"description": "one network link on the machine",
"required": [
"name",
"state"
],
"properties": {
"name": {
"type": "string"
},
"state": {
"type": "string"
},
"kind": {
"type": "string"
},
"addresses": {
"type": "array",
"items": {
"type": "string"
}
},
"default_route": {
"type": "boolean",
"description": "the default route leaves through it"
},
"metric": {
"type": "integer",
"description": "that route's metric"
},
"dns": {
"$ref": "#/defs/LinkDNS"
}
}
},
"SignInAsked": {
"type": "object",
"description": "the network asks for a sign-in: the page opened for it",
"required": [
"node",
"link",
"network",
"address",
"at"
],
"properties": {
"node": {
"type": "string",
"description": "the node's name"
},
"link": {
"type": "string",
"description": "the interface name of the link the default route leaves through"
},
"network": {
"type": "string",
"description": "the network's name as the network manager knows it, its connection's name"
},
"address": {
"type": "string",
"description": "an http or https address, the one opened"
},
"at": {
"type": "string",
"description": "the time of the change it says, never of its publish, RFC 3339 in UTC to the second"
}
}
},
"SignInEnded": {
"type": "object",
"description": "the sign-in ended: signed in, the network left, or no longer asked",
"required": [
"node",
"link",
"network",
"at",
"why"
],
"properties": {
"node": {
"type": "string",
"description": "the node's name"
},
"link": {
"type": "string",
"description": "the interface name of the link; empty only for a no-longer-asked said with no connection active"
},
"network": {
"type": "string",
"description": "the network's name as the network manager knows it; empty only for a no-longer-asked said with no connection active"
},
"at": {
"type": "string",
"description": "the time of the change it says, never of its publish, RFC 3339 in UTC to the second"
},
"why": {
"type": "string",
"enum": [
"signed-in",
"left",
"no-longer-asked"
],
"description": "why the sign-in ended"
}
}
}
}
}