docs: pre-load meta-flake design
scratchpad in claude.md and an in-flight callout at the top of docs/approvals.md describe the upcoming overhaul so subsequent commits can cite the design. covers: module-only agent flake shape, /var/lib/hyperhive/meta/ as a hive-c0re-owned single repo, applied remote pre-wired in proposed for manager git plumbing, /meta RO bind for the system-wide deploy log, auto-migration on hive-c0re startup with HIVE_SKIP_META_MIGRATION kill-switch.
This commit is contained in:
parent
e26143a412
commit
a1cfb60fd0
2 changed files with 66 additions and 23 deletions
68
CLAUDE.md
68
CLAUDE.md
|
|
@ -114,29 +114,51 @@ read them à la carte.
|
||||||
In-flight or recent context that hasn't earned a section yet.
|
In-flight or recent context that hasn't earned a section yet.
|
||||||
Prune freely.
|
Prune freely.
|
||||||
|
|
||||||
- **Just landed:** tag-driven config-apply overhaul. Two-repo
|
- **In flight:** meta-flake overhaul. Each agent's applied
|
||||||
split kept (proposed = manager RW, applied = core-only) for
|
repo becomes a tiny module-only flake (`nixosModules.default
|
||||||
safety. New flow: at `request_apply_commit` time hive-c0re
|
= import ./agent.nix`); `agent.nix` is just a NixOS module
|
||||||
fetches the manager's commit into applied and pins it as
|
function `{ config, pkgs, lib, ... }: { ... }` — no
|
||||||
`proposal/<id>`; the manager-side repo is then irrelevant
|
extendModules, no hyperhive input visible to the manager.
|
||||||
for that approval. Approve / deny / build walk through more
|
A single hive-c0re-owned repo at `/var/lib/hyperhive/meta/`
|
||||||
tags (`approved/`, `building/`, `deployed/`, `failed/`,
|
declares one input per agent (pointing at that agent's
|
||||||
`denied/`) on the same commit; `applied/main` only
|
applied repo via `git+file://`) and one
|
||||||
fast-forwards on `deployed/`. `failed/` and `denied/` are
|
`nixosConfigurations.<n>` output per agent, wrapping
|
||||||
annotated — body is the build error or the operator's deny
|
`inputs.agent-<n>.nixosModules.default` with the identity
|
||||||
note respectively. Manager has `/applied` bind-mounted RO
|
+ `HIVE_PORT` / `HIVE_LABEL` / `HIVE_DASHBOARD_PORT`
|
||||||
(whole tree) so `git fetch /applied/<n>/.git
|
injection that today's per-agent `setup_applied` does
|
||||||
'refs/tags/*:refs/tags/applied/*'` mirrors every relevant
|
inline. Containers run against `meta#<n>` instead of
|
||||||
tag into its proposed clone. `agent.nix` stays the entry
|
`applied/<n>#default`. Every approval that lands does
|
||||||
point; the whole tracked tree is now preserved
|
`nix flake lock --update-input agent-<n>` in meta and
|
||||||
through apply (arbitrary files supported). The wrapper
|
commits the lock — meta's git log is the system-wide
|
||||||
`flake.nix` is regenerated by hive-c0re every
|
deploy audit trail; per-agent tags stay as before for
|
||||||
spawn/rebuild but never tracked, so the applied log is
|
inside-baseball state.
|
||||||
exactly the manager's commits in deploy order. Migration:
|
- **Companion change:** the manager's `/agents/<n>/config/`
|
||||||
no in-place — pre-overhaul applied dirs are detected via
|
(proposed) gets `applied` pre-configured as a git remote
|
||||||
the missing `deployed/0` tag and `setup_applied` bails
|
pointing at `/applied/<n>/.git` (the RO bind already
|
||||||
with `destroy --purge` instructions. See
|
there). `git fetch applied` / `git show
|
||||||
`docs/approvals.md`.
|
applied/refs/tags/deployed/<id>` / `git rebase
|
||||||
|
applied/main` etc. all just work from inside the
|
||||||
|
manager. The manager additionally gets `/meta` RO-bound,
|
||||||
|
so `git -C /meta log --oneline` and
|
||||||
|
`cat /meta/flake.lock` answer "what's actually deployed
|
||||||
|
across the swarm right now."
|
||||||
|
- **Auto-migration on startup:** new phase before
|
||||||
|
`auto_update::run` rewrites each existing
|
||||||
|
`applied/<n>/flake.nix` to the module-only shape +
|
||||||
|
relocates `deployed/0`, adds the `applied` remote to each
|
||||||
|
proposed repo, bootstraps the meta repo from the agent
|
||||||
|
list if missing, and `nixos-container update`s every
|
||||||
|
container to point at `meta#<n>` (no fs wipe, no
|
||||||
|
re-login). Idempotent; `HIVE_SKIP_META_MIGRATION=1`
|
||||||
|
defers it.
|
||||||
|
- **Just landed (prior overhaul still in place):** tag-driven
|
||||||
|
config-apply. Two-repo split (proposed = manager RW,
|
||||||
|
applied = core-only); `request_apply_commit` fetches the
|
||||||
|
manager's commit into applied and pins it as
|
||||||
|
`proposal/<id>`; approve / deny / build walk through tags
|
||||||
|
on the same commit; `applied/main` only fast-forwards on
|
||||||
|
`deployed/`. `failed/` + `denied/` are annotated. See
|
||||||
|
`docs/approvals.md` for the state machine.
|
||||||
- **Recent (since last compaction):** inline +/- diffs on
|
- **Recent (since last compaction):** inline +/- diffs on
|
||||||
Write/Edit, send full body via collapsed details, operator
|
Write/Edit, send full body via collapsed details, operator
|
||||||
cancel + ttl on questions, deny-with-reason, dashboard
|
cancel + ttl on questions, deny-with-reason, dashboard
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,27 @@ step — the operator just sees the name. On approve, hive-c0re
|
||||||
creates the container in a background task while the dashboard
|
creates the container in a background task while the dashboard
|
||||||
shows a spinner.
|
shows a spinner.
|
||||||
|
|
||||||
|
## Meta flake (in flight)
|
||||||
|
|
||||||
|
> The next overhaul (currently being implemented) introduces a
|
||||||
|
> single hive-c0re-owned meta repo at
|
||||||
|
> `/var/lib/hyperhive/meta/` that consumes every agent's
|
||||||
|
> applied repo as a flake input and owns the wrapper
|
||||||
|
> nixosConfiguration. Each agent's `applied/<n>/flake.nix`
|
||||||
|
> shrinks to `nixosModules.default = import ./agent.nix` —
|
||||||
|
> `agent.nix` becomes a plain NixOS module function (no
|
||||||
|
> extendModules / hyperhive input). Containers will run
|
||||||
|
> against `--flake /var/lib/hyperhive/meta#<n>`. Every
|
||||||
|
> approval that builds does
|
||||||
|
> `nix flake lock --update-input agent-<n>` in meta and
|
||||||
|
> commits the lock; meta's git log is the system-wide deploy
|
||||||
|
> trail. Manager additionally gets `/applied/<n>/.git`
|
||||||
|
> pre-registered as the `applied` remote inside its proposed
|
||||||
|
> repo, and `/meta` RO-bound for browsing the deploy log.
|
||||||
|
> Auto-migrates on startup. Sections below describe the
|
||||||
|
> current (still-deployed) tag-driven shape that the meta
|
||||||
|
> flake builds on top of.
|
||||||
|
|
||||||
## Two repos per agent
|
## Two repos per agent
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue