gunk-dev/the-valley

oc-87deec8-valley-can-host-cosmo.md

source10091af9534amain's published tip history
8.0 KiB · Rendered
1---
2type: outcome
3id: oc-87deec8
4status: open
5title: The valley can host cosmo
6created: 2026-07-31
7blocked_by: [oc-f3bcfd0, ida-7638082, ida-62a7a3b, ida-b037dc9, ida-a0e5d03]
8---
9
10# The valley can host cosmo
11
12cosmo is the NixOS configuration that builds five machines, one of which is the pilot host that
13serves the valley. It is the obvious second project to migrate, and it is the first project whose
14requirements exceed what a valley host serves. This outcome is done when cosmo's canonical origin is
15the valley host, its changes are gated at least as well as they are gated today, the automation it
16depends on still runs, and its machines deploy without reading GitHub.
17
18## What the host serves today, and why it was enough once
19
20A valley host serves exactly four things: a bare git repository per project, publication mirrors, a
21host-level restic backup, and a `ref-updated` bus ([schema/valley.cue](../../../schema/valley.cue),
22[schema/events.cue](../../../schema/events.cue),
23[nix/valley-host.nix](../../../nix/valley-host.nix)).
24
25That was enough for the pilot repo because the pilot repo's gate is a human reading a diff, its only
26consumer is a flake input, and it is the only repository the host's single replication identity has
27had to authenticate for. Each of those three facts stops being true with cosmo, and a fourth
28requirement — automation — has no equivalent on the host at all.
29
30## The four gaps
31
32**No verification gate.** cosmo's gate is a `pull_request` workflow, and S1 direct-push mode has no
33pull request for it to attach to, so the gate does not degrade at migration — it disappears.
34[[ida-7638082]]
35([ida-7638082-host-has-no-check-runner.md](../ideas/ida-7638082-host-has-no-check-runner.md)).
36
37**Automation has nowhere to land, and its current home destroys work.** Three GitHub bots keep
38cosmo's flake inputs current, in two distinct shapes — one scheduled, two reacting to an upstream
39ref update. Nothing on the host consumes an event and acts, and nothing on the host owns a clock.
40Worse, leaving the bots on the mirror is not neutral: the mirror's unpublish sweep deletes their
41branches and the forced `main` refspec overwrites their merges, both silently. [[ida-62a7a3b]]
42([ida-62a7a3b-reactions-have-no-home.md](../ideas/ida-62a7a3b-reactions-have-no-home.md)).
43
44**Consumers read GitHub.** Every cosmo machine auto-upgrades nightly from `github:patflynn/cosmo`,
45the pilot host's converge unit both resolves and fetches from GitHub, and cosmo pins the-valley from
46its GitHub mirror. Sovereignty of the write path does not make the read path sovereign.
47[[ida-b037dc9]]
48([ida-b037dc9-consumers-read-the-mirror.md](../ideas/ida-b037dc9-consumers-read-the-mirror.md)).
49
50**The second mirror has no identity.** The host's one deploy key is already spent on the-valley, and
51GitHub allows a given deploy key on one repository. The migration runbook flagged this fork as
52deferred until the second migration; cosmo is the second migration. [[ida-a0e5d03]]
53([ida-a0e5d03-second-mirror-identity.md](../ideas/ida-a0e5d03-second-mirror-identity.md)).
54
55## Protection comes before the move
56
57cosmo's authoritative branches need a protection block before cosmo moves onto the valley. Every
58project a host serves runs the push policy, but a project without protection protects no ref, so any
59key that can push could move its `main`. cosmo's machines deploy from that branch, and its release
60tags are verified on the machines. So the declaration that moves cosmo also protects its `main` and
61names a grant opening its release tags to the principal that signs them
62([bd-75c8721](../bugs/bd-75c8721-pushes-could-write-any-namespace.md)).
63
64That protection also means cosmo's first `main` on the valley cannot be pushed. It is seeded on the
65host by the git user, from the GitHub mirror at a commit the operator has checked, and every change
66after it lands by integration request ([integration.md](../../design/integration.md), _A protected
67stream starts from a seed_).
68
69## The phase mapping — what hosting cosmo pulls forward
70
71**cosmo readiness is not an increment on Phase 1.** This is the decision-relevant content of this
72node. Mapped against [roadmap.md](../../design/roadmap.md), the four gaps land like this:
73
74| Gap | Where it closes |
75| ---------------------- | ----------------------------------------------------------------------------- |
76| No verification gate | Phase 2 **and** Phase 3 — attestations, then an integrator that requires them |
77| Automation has no home | Phase 5 — the first phase in which anything subscribes and acts |
78| Consumers read GitHub | Phase 5 if convergence is the valley's job; today, if it is cosmo's own |
79| Second mirror identity | Phase 0 — the only gap that is present-phase work |
80
81The verification gap needs both of Phases 2 and 3, not either. A policy without an attestation is a
82document; an attestation without an integrator is a receipt nobody checks; and the integrator's
83refusal only exists because of Phase 3's `pre-receive` invariant. The path-scoped policy that would
84govern it is already designed ([[ida-1ec03b1]]
85([ida-1ec03b1-path-scoped-verification-policy.md](../ideas/ida-1ec03b1-path-scoped-verification-policy.md)))
86and its CUE schema is settled in [[dcr-f41f718]]
87([dcr-f41f718-declared-verification-policy.md](../decisions/dcr-f41f718-declared-verification-policy.md))
88— so what is missing is not the design but the two mechanisms that make it bind.
89
90So hosting cosmo properly would pull Phases 2, 3, and 5 forward, ahead of S1's own last two
91unchecked boxes: a week of real human and agent work without GitHub, and a migration-plus-restore
92runbook that is repeatable for the next repo. The roadmap sequences by validation gate, and the
93gates of Phases 2, 3, and 5 are about the contributor protocol's ergonomics, pull-based integration,
94and reactive controllers — none of them is "a second project is hosted". Hosting cosmo is not a
95reason to reorder them; it is a reason to know that it would.
96
97The competing reading deserves stating, because it is the same argument S1 already accepted once.
98S1's direct-push interim mode is deliberately degraded, on the theory that feeling a gate's absence
99is the validation signal that motivates building it. Migrating cosmo now, gate and all, would be
100that theory applied again. The difference is stakes, and only stakes: the interim mode's pain is a
101human merging diffs by hand in the pilot repo, while cosmo's is an unchecked change to the
102configuration of five machines that a timer deploys within the hour.
103
104The cheap half is available regardless. Repointing cosmo's converge unit, `autoUpgrade`, and its
105the-valley input at sovereign URLs is a change to one project's configuration and needs nothing new
106from the valley — see the reachability question in [[ida-b037dc9]].
107
108## A note that is not a blocker
109
110cosmo configures classic-laddie, and classic-laddie is the host that would serve cosmo. A cosmo
111change that breaks the valley host, sshd, or tailscale removes the push access needed to land the
112fix. This is a recovery-path property rather than a blocker: every clone is complete, restic sits
113behind the primary ([[oc-9949561]]
114([oc-9949561-push-replication.md](./oc-9949561-push-replication.md))), and the machine can be
115repaired at the console or from any clone. It is worth naming because it raises the cost of an
116unchecked change, which is the whole argument in [[ida-7638082]].
117
118## Why this outcome depends on S1 rather than the reverse
119
120One of S1's unchecked acceptance boxes is that the migration-plus-restore runbook exists and is
121repeatable for the next repo, and cosmo is that next repo — which invites hanging [[oc-f3bcfd0]]
122([oc-f3bcfd0-s1-holds.md](./oc-f3bcfd0-s1-holds.md)) off this outcome. That would be false twice
123over. The box asks for a repeatable runbook, not for a second migration to have happened; and making
124S1 depend on this outcome would make S1 wait on Phase 5. The truthful edge runs the other way: this
125outcome sits downstream of S1, because cosmo does not migrate onto a host whose durability story is
126not yet established.