Her review: too much text, and an assertion helper instead of that much code where the file should just say "this option cannot contain that". `lib/name-guards.nix` gets `mustNotEqual` / `mustNotContain`; both call sites in swarm-otel become four fields each — the option, the names, the list, and the sentence explaining the failure. The message plumbing (find every offender, quote them, name the list) is one shape shared by both. Offenders are printed after their label rather than before it, because no English verb agrees with both one name and five. Converted the pre-existing equality assertion too. Leaving one hand-rolled beside one helper-built is the worse of the two outcomes, and it is the same guard. Verified by evaluating both guards directly rather than only parsing: clean rosters pass, `foo-agent`/`beehive` fail containment, `swarm` fails equality, and `forgeworks`/`operator-hq` still pass — the control that keeps the two lists from being merged.
19 lines
932 B
Nix
19 lines
932 B
Nix
# Words no HIVE name may CONTAIN. The substring half of `./reserved-names.nix`.
|
|
#
|
|
# Separate because the two differ in every dimension: subject (hive names only
|
|
# vs hive AND agent), matcher (substring vs equality), and admission rule (a
|
|
# fixed segment of a COMPOSED identifier vs a value some component emits).
|
|
# Folding them would widen the other one — containment over `forge` refuses
|
|
# `forgeworks`, which names no failure.
|
|
[
|
|
# `hive-<name>` — every hive's OIDC client id, and the string the queue's
|
|
# auth-callout responder strips to decide which hive a connection is.
|
|
"hive"
|
|
# `hive-<name>-agent` — the client its agent containers present. A hive named
|
|
# `foo-agent` mints exactly the id hive `foo`'s agents do.
|
|
"agent"
|
|
# Also an exact-match entry next door, for the collector's `<kind>/<owner>`
|
|
# components. Here because it is the word this swarm composes identifiers
|
|
# from everywhere.
|
|
"swarm"
|
|
]
|