Design 08 sign-in-page: the watcher's health is an exec check on the machine (C-2b)

A unit check on NetworkManager's service would assert a state the mesh never sets,
and a tool check needs the bus the watcher must do without; an exec check that
asks the watcher's socket works behind a sign-in page.
This commit is contained in:
jochen
2026-11-24 21:51:22 +01:00
parent df22a1382c
commit 89910e4ede
2 changed files with 25 additions and 18 deletions
@@ -117,7 +117,7 @@ L-2. The fact `private-interface` renders the literal `mesh0`. Quick, not thorou
Lead answers to code review round 1 of the milestone sign-in-page (fix-1981@g14, 2026-11-24). Each names what settles it.
C-1 (grants: membership). The tool runner's membership lists the held seat's own-node machine event too (onMachine), so its runtime's mayPublish lets it publish; tests on node-uplink's sign-in-asked.<node> subject itself, and the whole test publishes through the runtime's check, not straight to the stream. Principle: evidence over assertion; §4a.
C-2 (validator: a tool check alone). networkmanager's service resource (NetworkManager's unit) carries health of kind unit, so the watcher's tool check stands beside a check of another kind (ADR 0227 rule 8, ADR 0240 rule 2), as zfs's process watch stands beside its units' unit checks (read in mesh-catalog main, modules/zfs). §27 changes from "the service resource as it is today" to that.
~~C-2 (validator: a tool check alone). networkmanager's service resource (NetworkManager's unit) carries health of kind unit, so the watcher's tool check stands beside a check of another kind (ADR 0227 rule 8, ADR 0240 rule 2), as zfs's process watch stands beside its units' unit checks (read in mesh-catalog main, modules/zfs). §27 changes from "the service resource as it is today" to that.~~ *Corrected by C-2b (2026-11-24).*
C-3 (mesh-sdk test copies). Copy the three definitions byte for byte from mesh-networking and mesh-contracts at their heads, and fix the two tests' decision text to match. Principle: a copy is a copy.
C-4 (guard: names in place). The guard judges "in place" from the domains resolved holds on the link now (rawDomainsOf), not from its applied record alone, and sets them again when they are missing; a test where the network manager rewrites the link's domains and one where resolved restarts. §7.
C-5 (i3: the opener's bound). cmd/i3-tools runs the opener with its own run that stops waiting at 10 s without killing the opener (DMC-8); a test with an opener that outlives the bound and keeps running.
@@ -125,3 +125,5 @@ C-6 (generated packages). systemd-resolved and i3 import noderesolver and nodedi
C-7 (/var/lib/node-resolver unknown). It stays: mesh-catalog's checks/owned refuses a directory without unknown (ADR 0422 §8). Its value is "module", as L-1: the guard leaves a path it does not know as it is and writes it to the journal once; README line and a unit test. Not "program" (no other program writes there, ADR 0422 §2).
C-8 (bounds). The watcher socket's 5 s and the names file write's 15 s are stated constants in the design lines, as R2-7 holds for 60 s, 10 s and 256. Principle: a bound is stated; a setting only where machines differ.
NOTES taken: (a) node-resolver's real definition adds outside_writes to routes' answer, which systemd-resolved answers today (U-M3: every existing field carries over); (b) a refused open writes a hand-act too (DQ-7: each call); (c) fallback.json's since is the time of the guard's first round, never zero; (d) the watcher redials the system bus only on the socket's file event and on rating-again, never in a loop. mesh-catalog-connectivity's stale generated files on trunk stay a finding outside the milestone.
C-2b (corrects C-2). NetworkManager.service keeps no state and no health (ADR 0117 §4, §5: the mesh never starts, stops, enables or disables it; a unit check on a service not stated running is refused, ADR 0240 rule 1). The sign-in process's health is of kind exec, command `./uplink-tools health`, which asks the watcher's socket and exits non-zero when the watcher is not subscribed or the last uplink-names call stands failed (60s, 20s, 2 looks, 60s grace); with no tool check left, ADR 0227 rule 8 does not apply, and the check runs on the machine, so it works behind a sign-in page (ADR 0689). `uplink_health` stays a tool of the bundle, not a health check.
@@ -218,11 +218,15 @@ by nothing (DMC-6).
page a bundle never runs; the part that must work without the bus may not need the bus to start. So:
- **the watcher** is a process resource of `networkmanager`, as the zfs module's watch is: its `name`
`networkmanager-sign-in`, `artifact` `tools`, `run` `./uplink-tools watch`, `user` `${machine:account}`,
started by the machine's service manager at boot and kept running, needing no bus; its `health` of kind `tool`,
with `tool` `uplink_health`, `interval` 60s, `timeout` 20s, `looks` 2 and `grace` 60s, as zfs-watch's. It
started by the machine's service manager at boot and kept running, needing no bus; its `health` of kind `exec`,
`command` `./uplink-tools health`, `interval` 60s, `timeout` 20s, `looks` 2 and `grace` 60s (C-2b). The command
asks the watcher's socket (§12) and reads `names.json`, and exits non-zero, naming which, when the socket does
not answer, when the watcher is not subscribed or when the last `uplink-names` call stands failed; `no holder`
is healthy. It runs on the machine, so the check works behind a sign-in page (ADR 0689); with no tool check,
ADR 0227 rule 8 does not apply. It
watches the rating (§14), opens the page and tells the person (§15 to §19), and keeps the events (§20, §21).
- **the bundle** `uplink-tools`, in the tool runner once it reaches the bus, as today: it answers `resolvers` and
`links`, serves the tools and the health tool (§23), publishes the kept events (§20) and calls `uplink-names`
`links`, serves the tools (§23), publishes the kept events (§20) and calls `uplink-names`
(§13). It reads the watcher's state only through the module's own local state (§12).
- **the shared code** (DMC-3): `main.go`, `uplink.go`, `uplink_test.go` and `copies_test.go` stay byte-equal
between `networkmanager` and `systemd-networkd`; `main.go` takes each holder's own subcommands and tools from its
@@ -260,14 +264,15 @@ by nothing (DMC-6).
`node-resolver` on its node it reads with `mesh-module-assigner.assignments` (its node, `seats`) when such an event
comes. An answer that no holder serves the verb is no failure: `result` is `no holder`, and the machine's resolver
file then lists the mesh's resolvers, through which the check already resolves. A failed call is written to its
journal with the reason, makes its health unhealthy (§23) and is asked again at the next such moment or by its
journal with the reason, makes its health unhealthy (§11) and is asked again at the next such moment or by its
tool (§23), never on a timer (the lead's answer of 2026-11-24: events first). Its manifest `invokes`
`seat:mesh-module-assigner.assignments`, `seat:node-resolver.uplink-names` and `seat:node-resolver.routes`, which
`uplink_sign_in` reads (§23; R3-3). **The moments, corrected by the prepare** (the
prepare's check): the node-engine says no `running` for a module restarted in place at the same build, so a
restarted resolver is met by two more moments, with no new node-engine event in this milestone: the bus connection
coming back, and the health look, at which `uplink_health` reads `<node>/node-resolver.routes` and calls
`uplink-names` again when a holder runs and the names it last gave are not in `uplink_names.names`. **The bus
restarted resolver gets no new call: it needs none, since the names file holds across its restart (§6) and the
guard sets them again from what resolved holds (§7, C-4). One more moment is added, with no new node-engine event
in this milestone: the bus connection coming back. (The health look the prepare's answer added here is gone with C-2b: the
health check runs on the machine and calls nothing on the bus.) **The bus
connection coming back** is the first heartbeat of its consumer answered after a missed one (mesh-sdk's
`OnHeartbeat` and `Missed`; DMC-4). **`no holder`** is read from `mesh-module-assigner.assignments` (its node,
`seats`) naming no holder of `node-resolver` on its node, never from the bus's no-responders text (DQ-8).
@@ -359,15 +364,15 @@ by nothing (DMC-6).
- `uplink_names_again` (acts): calls `uplink-names` now as §13 does.
- `uplink_rating_again` (acts): asks the watcher `rating-again` (§12).
- `uplink_publish_again` (acts): publishes the kept events in `pending/` now, as §20 does (R3-5).
- `uplink_health` (the health tool of §11): unhealthy while the watcher's socket does not answer, while the
- `uplink_health` (reads; a tool of the bundle, not a health check, C-2b): unhealthy while the watcher's socket does not answer, while the
watcher is not subscribed, or while the last `uplink-names` call stands failed, naming which; `no holder` is
healthy.
24. **Its README**, written whole in this milestone (DMC-7), says the two parts and their shared folder, that the watcher opens the page and tells the person on
its own machine without the bus, how it finds the session (§16, §17), that it keeps and the bundle publishes the
two events from the network manager's own rating, that with the check switched off it neither opens nor keeps,
and that the bundle calls `uplink-names` where a holder of `node-resolver` runs (ADR 0687 §2, §3; ADR 0689); and
that the watcher's health is judged only once the tool runner has reached the bus, since its health tool is the
bundle's (R3-4); and that the watcher leaves a path in its folder it does not know as it is and writes it to its
that the watcher's health is checked on the machine by `./uplink-tools health`, which needs no bus (C-2b,
replacing R3-4's line); and that the watcher leaves a path in its folder it does not know as it is and writes it to its
journal once per path (§12; L-1). Its review reads it.
25. **Its tests** (ADR 0687 and ADR 0689, *How it is checked*), unit, with the network manager's D-Bus signals,
logind, the user manager, the opener and the notification service stood in, and no bus: PORTAL at a join opens
@@ -380,8 +385,9 @@ by nothing (DMC-6).
`rating-again`; past 256 kept events the oldest is dropped with a journal line; the bundle publishes the kept
events in order with their message ids and deletes each on acknowledgement, keeps a refused one and publishes it
at the next moment; `uplink-names` called at the bundle's start, on a changed `check-address`, when the bus
connection comes back and on a running holder of `node-resolver`, `no holder` recorded as healthy; the health
tool unhealthy for a watcher not subscribed and for a failed `uplink-names` call; a watcher restarted after its
connection comes back and on a running holder of `node-resolver`, `no holder` recorded as healthy; `./uplink-tools
health` exits non-zero for a socket that does not answer, a watcher not subscribed and a failed `uplink-names`
call, and zero for `no holder`, with no bus (C-2b); a watcher restarted after its
events were published and `pending/` emptied makes message ids it has not used before, and the bus keeps them
(R3-1); `uplink_publish_again` publishes what waits (R3-5); a path in the folder of §12 it does not know is left as
it is and written to the journal once (L-1); each tool. **One integration
@@ -391,11 +397,10 @@ by nothing (DMC-6).
R2-1).
26. **Nothing names a network in it** (ADR 0687 §6): §33 holds for its code, configuration and tests.
27. **Its manifest** declares the process of §11, the directory of §12, the `consumes` and `invokes` of §13, the
five tools of §23 under `tools` (the manifest validator refuses a tool health check whose tool is not listed; DMC-5), and
keeps its claim of `node-uplink`, its package and its configuration file as today. Its service resource
(`NetworkManager.service`, still with no state, ADR 0117 §4) gains `health` of kind `unit`, so the watcher's tool
check stands beside a check of another kind (ADR 0227 rule 8, ADR 0240 rule 2), as zfs's watch stands beside its
units' checks (C-2). The prepare
five tools of §23 under `tools` (DMC-5), and keeps its claim of `node-uplink`, its package, its configuration file
and its service resource as today: `NetworkManager.service` keeps no state and no health, since the mesh never
starts, stops, enables or disables it (ADR 0117 §4, §5) and a unit check on a service not stated running is
refused (ADR 0240 rule 1; C-2b, correcting C-2). The prepare
confirms, on each machine that runs `networkmanager`, that the tool runner runs as the same account as the
watcher, `${machine:account}`, since the folder of §12 is that account's alone (mode 0700), and writes it in the
milestone file (R3-6).