hyperhive/hive-types
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 88e571a463 swarm-controller: refuse a new agent name the forge would reject
Every agent becomes a Forgejo user of the same name, and nothing upstream
of `CreateForgeUser` knew what Forgejo refuses: `admin`, `api`, `foo-` or a
41-character name passed name validation and failed one node into
provisioning with Forgejo's 422.

`nix/reserved-names.nix` gains the 22 reserved usernames of Forgejo
v16.0.5 (`models/user/user.go:639-680`) that `[a-z0-9-]` can spell, and
the bare `-` (`models/repo/repo.go:67`). The dot and underscore entries are
left out, since our charset cannot produce them. The header's admission
rule grows a third class — a username the forge refuses — because that is
a failure behind the refusal.

The shape rules are not literals, so they live in
`hive_types::forge_username_violation`: no leading `-`, no `--`, no
trailing `-`, at most 40 characters. Beside `is_reserved_name`, not in
`Ident::parse`: an `Ident` is also a hive, label, account and subagent
name, and parsing runs on every read of an existing name.

`create_agent` used to WARN on a reserved name, deliberately: an operator
with agents already created under a colliding name would otherwise be
unable to re-run creation. That reason is kept, and narrowed to what it
protects. A name breaking either rule is now refused with a 400 naming the
rule when the name is NOT in the swarm roster, and still only warned
about when it is, so re-creating an existing agent keeps working. The
roster is read only for a rule-breaking name; when it cannot be read, a new
name and an existing one look alike, and this warns as before. The
hive-collision warning is unchanged.
2026-09-24 15:16:32 +02:00
..
src swarm-controller: refuse a new agent name the forge would reject 2026-09-24 15:16:32 +02:00
Cargo.toml docs(#2627): add READMEs for the remaining infra crates 2026-07-23 13:16:29 +02:00
README.md docs: restructure into topic subdirectories, collapse duplicated index 2026-09-02 01:55:37 +02:00

hive-types

Foundational shared newtypes for the hyperhive workspace. A zero-dependency (bar serde) leaf crate, so every wire-type crate (hive-sh4re, hive-host-sock, hive-core-agent-sock) and both binaries (hive-c0re, hivectl) can share them without cross-crate coupling and without growing hive-sh4re.

What's here

  • Ident — a validated agent-name newtype. Typing agent-name fields as Ident (rather than bare String) gets serde-validated parsing at the socket boundary for free: a malformed name is rejected at deserialize time instead of flowing into a handler that has to re-validate by hand.

The crate is deliberately a leaf with the smallest possible dependency footprint so anything in the workspace can depend on it. See docs/process/conventions.md ("identity = socket") for how agent identity is modelled across the sockets.