# Whether a set of queue client ids would give one id the wrong grant. # # The queue's auth-callout responder matches a client id against the hive # prefix first, then against each service role in turn, and the first match # wins. So an id listed under two roles, or one under the hive prefix, silently # gets another role's grant. The responder refuses to start on the same # overlap (`Policy::checked`); `swarm-nats.nix` asserts it at evaluation. # # Pure function of the ids and the prefix, so a module-eval case can feed it # a clash: the ids are read-only options, which no host config can set. { lib }: { ids, hivePrefix, }: let # An id equal to the prefix alone names no hive (nothing follows it), as in # the responder's own matcher. underPrefix = id: lib.hasPrefix hivePrefix id && id != hivePrefix; in lib.length (lib.unique ids) != lib.length ids || lib.any underPrefix ids