Repository navigation
HERD 0.1.0
HERD v0.1.0
HERD (Hardware Environment Replication and Deployment) is a lab reservation and topology-management platform built lab-first, for any organization that runs a hardware lab and cannot answer two questions: "do we have a lab, and how do I use it?" and "what was done in the lab, by whom, on what, for how long?" Any engineer can browse live inventory, build a topology, and reserve equipment without tribal knowledge, while leadership gets utilization reporting with CSV export to defend lab budget. The differentiator is the AI topology pipeline: a user describes a need in plain language, an LLM proposes a valid wiring plan against live inventory, a human reviews it as ghost nodes on the canvas, and committing transactionally creates the topology, books the reservation, and can push per-device configuration. This is the first tagged release; it consolidates 296 merged pull requests into a coherent platform.
Highlights
- AI topology generation with human-in-the-loop review: natural-language prompts plus optional PDFs, tech-support tarballs, or text files produce role-based device proposals rendered as ghost nodes; Accept transactionally creates the topology and books the reservation, with an optional per-device config push. Feature-gated by a configured LLM provider, with an Anthropic backend and an OpenAI-compatible backend covering vLLM, Ollama, LM Studio, OpenAI, and Azure OpenAI.
- Reservation lifecycle with editable per-reservation topology forks: PENDING to PENDING_PROVISION to ACTIVE to COMPLETED, with CANCELLED and FAILED branches, automatic activation and expiration, and conflict detection for exclusive devices. On activation each reservation gets an editable fork of its parent topology; the owner or an admin re-wires it in live-edit mode, edits autosave as drafts, and a commit reconciles with a release-before-build set arithmetic. Port claims that collide with another active reservation are refused with a conflict that names the blocker, and when the reservation ends the fork freezes to an immutable, read-only as-built record.
- Automatic infrastructure provisioning driven by reservation lifecycle events: Layer 1 port cross-connects, Layer 2 VLAN creation and membership with fabric-aware conflict-free VLAN ids, and Layer 3 static routes pinned from the switch's latest config version so teardown removes exactly what was applied. After any fork save, wiring is reconciled connection-driven at all three layers against per-connection ledgers: Layer 1 cross-connects, Layer 2 VLAN port membership derived from the recorded wiring, and Layer 3 route adjacency; failures land as retryable per-item ledger rows with background auto-retry and manual retry, direction-aware so a stuck disconnect can finish even after a reservation ends. The reservation detail's Wiring tab surfaces the Layer 1 rows with per-cross-connect status (ACTIVE, RELEASED, FAILED, attempts, last error).
- Driver sandbox with admin-uploaded packages: driver packages (.zip or .tar.gz, SHA256-cached) run as a subprocess under POSIX rlimit caps and are validated for required methods before execution. Drivers may publish their own JSON Schema config vocabulary, extracted in the sandbox at load time and preferred over inventory's connection-type registry at the configure boundary. Per-command execution transcripts and a full audit trail of runs back the config-apply and AI-confirmation surfaces.
- Encrypted-at-rest credential store: a dedicated secrets service holds named secrets under AES-GCM envelope encryption, with a key-encryption key supplied by environment (the service refuses to boot without a valid one, so there is no source-visible default), online key rotation with a two-key rotation window, ACL-gated reveal, and an internal-token retrieval surface for automated provisioning.
- Dynamic hypervisor-backed resources: a
dynamictemplate type materializes an instance from a registered hypervisor at reservation time through a Hypervisor-connection-type recipe driver, records it in an instance ledger keyed for idempotent NATS redelivery, and surfaces it as a real inventory device. A reservation carrying any dynamic request activates only once every instance is materialized, and a configurable provisioning timeout prevents a lost callback from stranding a booking. - Local and LDAP/Active Directory authentication with three-role RBAC (user, admin, superadmin): LDAP users JIT-provision on first bind while superadmin rows stay local, device-group membership gates non-admin device visibility, and resource-level ACL grants layer narrower per-resource carve-outs on top.
- External
/api/v1integration facade with outbound webhooks: a stable, versioned surface for CI/CD and test automation to reserve and release devices, authenticated with admin-minted API tokens (a token's role can never exceed its principal's) and forwarding the caller's identity so RBAC, device-group visibility, and ACL grants apply as for an interactive user. Reservation lifecycle webhooks are HMAC-SHA256 signed, at-least-once with retry and backoff, idempotent onevent_id, and dead-lettered on exhaustion. - Supporting capabilities that round out the platform: a zero-database first-startup config UI whose saved values outrank env vars; utilization reporting by user, device, topology type, day, and group with CSV export and a fleet-utilization view; multi-channel notifications (in-app bell, email, Slack-style chat, HMAC-signed webhook) driven by durable consumers; bulk CSV/JSON import and export of devices, templates, and topologies; topology versioning with diff and restore; BFS shortest-path cable routing; and fleet-scale device health polling with idle/in-use poll tiers.
Architecture
HERD is a uv workspace of twelve FastAPI microservices behind a Traefik v3 gateway that terminates TLS and routes each /api/<service> path prefix. Every service owns its own PostgreSQL 16 schema, its own Alembic migration chain, and its own test suite; there are no cross-schema foreign keys or JOINs, so services reference each other only by UUID validated over HTTP at the boundary. Asynchronous work flows over NATS JetStream, and every state-change event is written to a per-service transactional outbox in the same database transaction as the state change, then drained to NATS by a background relay with broker-side and consumer-side dedup. Consumers are durable pull consumers with service-scoped dead-letter subjects retained on a dedicated DLQ stream, so a messaging outage delays delivery rather than dropping a provisioning or notification event. The frontend is React 19 with TypeScript and Vite, using Zustand and TanStack Query for state and a React Flow canvas for topology editing.
Quality
HERD ships behind a five-level QA bar: over 3,300 backend unit tests across the thirteen suites (SQLite in-memory), OpenAPI contract snapshot tests that fail on any public-API shape change, 173 cross-service integration tests against a live stack, 130 end-to-end browser tests (123 Selenium and 7 Playwright), and Locust load tests. Around 480 frontend tests run via vitest. Coverage targets 85% or higher per backend service. CI gates main with a branch-protection ruleset: the backend and frontend jobs (lockfile-drift check, lint, format check, tests, coverage, and the frontend build) must pass before merge, an advisory integration job boots the full ephemeral stack for the contract and integration suites, and a scheduled nightly workflow runs the heavier suites PR CI skips (contract, integration, e2e, and a seeded headless load run). CodeQL runs on pull requests, pushes to main, and a weekly cron across actions, JavaScript/TypeScript, and Python.
Known boundaries
- Initial reservation provisioning and teardown are still device-set-driven, not connection-driven. The connection-driven reconcile at all three layers ships for the fork-save path; unifying initial provisioning and teardown through it is in progress under ADR 0009 (phases 6 and 7).
- The per-connection wiring-status surface is Layer 1 only today; the Layer 2 and Layer 3 wiring-status view lands with ADR 0009 phase 8.
- Dynamic hypervisor-backed resources and AI-assisted recipe authoring are feature-gated (recipe authoring is dark by default behind
AI_RECIPE_AUTHORING_ENABLED), and dynamic template authoring is API, seed, or bulk-import only; the template editor UI has no dynamic option yet. - Resource-level ACL grants have no management UI; admins drive the ACL API directly.
- Driver packages are trusted code. The execution sandbox applies POSIX
setrlimitcaps (address space, CPU) and runs each package as a subprocess, but this is resource bounding, not OS-level isolation.
Documentation
The full user manual is published at https://vendrabuck.github.io/HERD/manual/.