| Filename | Latest commit message | Latest commit date |
|---|---|---|
`is_forbidden` and the webhook-secret load/regenerate path were the last two entries on the shortlist in hyperhive/hyperhive#3950; the other three landed in hyperhive/hyperhive#4650. Both are classification logic whose failure mode is silence, which is why they are worth a test rather than a coverage line. `is_forbidden` gates the arms that tell an operator a Forgejo admin PATCH was refused for want of a scope, and which credential to delete and re-mint to fix it. One of those PATCHes is `ensure_repo_creation_disabled` — the lockdown that stops an agent creating a repo it owns and self-merging in it. Two tests: a 403 is recognised in both shapes the typed client produces (the spec-listed `Forbidden` kind and the bare `UnexpectedStatusCode`), and nothing else is — not a 401, whose remedy is the automatic re-mint one function down, and not a transport error that never reached the forge at all. `load_or_generate` grows the path-taking half `load_or_generate_at`, the same seam `swarm-controller`'s `webhook::load_or_generate_at` already has and for the same stated reason. Three tests over it: a valid stored secret is returned verbatim and never rotated (the newline this module writes itself makes the trim load-bearing, not defensive); a malformed one is replaced by a secret that reaches *disk*, not just the caller, and is then stable; and each near miss — empty, whitespace, 63 chars, 65 chars, right length with a non-hex char — is refused. That last one is the security case: `Hmac::new_from_slice` accepts a key of any length, empty included, so a relaxed check fails nowhere and just keys every signature off a guessable value. Every test was confirmed able to fail: six mutations of the code under test, each watched red, then reverted. The two halves of the validity check and the two arms of `is_forbidden` were broken separately, so neither test passes on one arm alone. |
||
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
hive-c0re
The unprivileged host daemon (runs as hive-core). Owns the sqlite
broker, the approval/reminder/schedule queues, the generic job-DAG
queue, container lifecycle, gateway/forge/matrix provisioning,
per-container stats, and the axum operator dashboard. Largest crate in
the workspace — bin-only, no separate lib.
When to use it
Host-level, cross-container orchestration: spawning/rebuilding/
destroying agent containers, the approval flow, dashboard-visible
state, provisioning per-agent forge/matrix/gateway accounts. Agent-side
behavior (turn loop, MCP tools) lives in hive-agent/hive-agent-mcp
instead — this daemon only talks to agents over the socket wire types
in hive-sh4re.
Shape
Cohesive clusters live in directory submodules, each re-exported at
the crate root (crate::broker::… keeps resolving regardless of which
subdirectory a module actually lives in). One line each — read the
module's own //! doc-comment for real detail, don't expect this file
to track it:
dashboard/— the operator dashboard (containers, approvals, schedules, logs, topology).job_queue/— the job-DAG queue + desired-state reconciliation (docs/scheduler/coordinator.md).lifecycle/—nixos-containerlifecycle + per-agent config flake generation.stores/— sqlite-backed stores (broker, queues, audit, power).workers/— background sweeps (crash watch, scheduled prompts, auto-update, knowledge sync).agent_config/— per-agent registries (tool groups, capabilities, resource limits, topology).stats/— dashboard metrics aggregation + OTEL export.socket_server/— the unix-socket request server shared by per-agent + manager sockets.forge/— optional Forgejo wiring (docs/integrations/forge.md).coordinator.rs— top-level wiring forserve.meta.rs,migrate.rs— the meta flake + schema/state migrations.matrix.rs,gateway_nginx.rs,webhook_secret.rs,priv_client.rs— matrix provisioning, gateway vhosts, webhook secrets, and thehive-privclient respectively.
See the top-level CLAUDE.md/docs/ index for the full reading-path
map.