fix(#3422): the bridge reads and writes users.yml directly

`swarm agent create` failed with "no user store at
swarm-authelia-bridge-users.json but users.yml already holds users" on
any hive that had users. The guard was correct; what was wrong is that
two files both claimed to be canonical for one physical file.

The bridge kept a private users.json and rendered users.yml from it,
while swarmctl kept its own pair against the same users.yml. A writer
whose own JSON was absent could not tell "nothing here yet" from
"someone else's users", so it refused to write at all.

users.yml becomes the store: read before write, through serde_norway
rather than a hand-rolled emitter. Unknown top-level and per-user keys
round-trip through `extra`, or whichever process writes second would
silently delete what the first added. Validation stays on the write path
-- a bare to_string(&store) serialises perfectly and drops the "no
control character ever reaches this file" guarantee silently.

The seed constant goes with the guard: nothing writes a seed now, an
absent file is an empty store, and left as a pub constant it read as if
the seed dance were still load-bearing.
This commit is contained in:
atlas 2026-08-18 10:31:48 +02:00
commit 24f4cd42a9
5 changed files with 190 additions and 101 deletions

View file

@ -15,6 +15,7 @@ clap-markdown = "0.1"
clap_complete.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_norway = "0.9.42"
[lints]
workspace = true