gunk-dev/the-valley

checks.nix

source28abc5737165main's published tip history
10.6 KiB
1# What is tested, and where each test's logic lives.
2#
3# One file per subject, each returning the checks for it. A check's shell
4# body is never here: it is a script under checks/, and a check definition
5# is only what builds it, what it is given, and why it exists.
6#
7# hosts.nix the eval-only host declarations the module checks share
8# host-module.nix module-eval — what the NixOS modules render from a
9# declaration, and what they must refuse: the host
10# module and the web publisher's beside it
11# schema.nix cue-vet, attest-schema, identity-schema — the schemas
12# against the examples they accept and the ones they
13# must reject
14# knowledge.nix knowledge-lint-consumer, knowledge-lint-rejects,
15# prose-format — the lint's reusable and rejection
16# forms, and the prose
17# knot.nix knot-unit, knot-agree — the plan graph's module, and
18# its validator held to the schema and the lint
19# delta.nix delta-unit — valley-delta-v1, its conformance vectors,
20# and the trees it reads and refuses
21# go-dependencies.nix
22# go-dependencies — every Go module's imports and
23# go.mod held to the standard library and this
24# repository's modules, with flow/ the one exception
25# derive.nix derive-unit, composed-unit — the Go deriver of
26# required checks, and the composed-policy reader's
27# layer reads
28# review.nix review-unit — review records, their binding to the
29# version judged, and their append-only history
30# attest.nix attest-unit, attest-conformance, attest-e2e — the
31# helper's unit tests, the written form as a fixed
32# contract, and the helper driven end to end
33# integrator.nix integrator-unit, integrator-e2e — the verdict rules,
34# and the controller over real repositories
35# restack.nix restack-unit, restack-e2e — the restacker's planner
36# and its write passes, over repositories wired with
37# the rendered hook
38# signers.nix signers-e2e — the signers the host publishes, read by
39# a fresh client to verify the real integrator's landing
40# hooks.nix valleyhook-unit, note-unit, change-unit,
41# exactjson-unit, pushpolicy-unit, pushreason-unit,
42# mirror-e2e, bus-e2e, protect-e2e, knots-e2e, init-e2e —
43# the hooks the module renders, run against real git, the
44# formats they read, the mirror pusher's reason, and the
45# init script that wires them
46# onmain.nix onmain-unit, onmain-e2e — the bridge that requests a
47# run of a host's own unit when a project's main moves,
48# over real git, and its wiring in a NixOS machine: the
49# path unit, the environment file and the start limit
50# approval.nix approval-unit — approval statements, their signing
51# and verification, and the PIV session signer
52# identity.nix identity-unit, identity-e2e — the compiler's unit
53# tests, and the registry compiler over a real
54# instance repository, against the hand-written
55# artifacts it replaces, and the hook reading its grants
56# sigverify.nix sigverify-unit, sigverify-e2e — the security-key
57# signature verifier against real ssh-keygen, real git
58# and OpenSSH's software authenticator
59# web.nix web-unit, web-server-unit, web-reader-state-crash,
60# web-receiver-unit, web-image, readaccess-unit — the
61# web UI's export contract (projection, manifest, upload
62# checks, and receiver state directory), the valley-web
63# server and its browser state, that state's
64# transactions killed and failed at each step, the
65# valley-web-receive receiver, the edge container image,
66# and the two read-access consents and coverage report
67# web-reader-browser-e2e.nix
68# web-reader-browser-e2e — the reader page in headless
69# Chromium in the build sandbox, behind a TLS proxy
70# web-push-e2e.nix web-push-e2e — the push path end to end over the
71# shipped publisher, receiver, valley-web and CLI,
72# with real git
73# cli.nix valley-cli, review-notes, policy-deriver,
74# own-policy, valley-request, rebase-unit,
75# valley-go-unit, valley-status, valley-ready,
76# valley-changes, valley-walk, valley-knot, valley-plan,
77# selfupdate-unit, valley-self-update — the valley
78# command, the rebase engine, self-update and its
79# home-manager module, and the-valley's own policy
80# darwin.nix valley-darwin-build, valley-darwin-eval — what the
81# flake offers on aarch64-darwin, checked from here and
82# never run: each client program's Go compiled, linked
83# and vetted for darwin/arm64, and every Darwin package,
84# app and formatter evaluated
85# ssh-e2e.nix ssh-e2e — the push boundary over a real sshd in a
86# NixOS machine, and the request grant's handoff
87# publish-e2e.nix publish-e2e — an integrator landing reaching the push
88# mirror and the bus, in a NixOS machine running the
89# real controller
90# worker-e2e.nix worker-e2e — the build slice and the check worker in a
91# NixOS machine: the worker's key, its enrollment and
92# its evidence on origin, and the slice's caps on its
93# builds and on builds that are not its own
94# restack-host-e2e.nix
95# restack-host-e2e — the restacker's service in a NixOS
96# machine: its controller restacking a ready change
97# over sshd as its own principal, its Unix user's
98# isolation, and what its key can push
99# flow.nix flow-build, flow-unit, flow-vet, flow-e2e — klaus
100# (flow/): its package and version stamp, its unit
101# tests, go vet, and its end-to-end suite over real git,
102# a private tmux server and the valley command
103# flow-policy.nix flow-policy — what the project policy requires of a
104# change around klaus, from its Go and prose to the
105# valley command its end-to-end suite runs
106# web-publisher-e2e.nix
107# web-publisher-e2e — the web publisher's sandbox in
108# a NixOS machine: the unit the module renders, with a
109# probe in place of the publisher, and the read links'
110# wrapper run as root, delivering through the policy
111# unit to a receiver
112#
113# Fixtures live with the thing they are fixtures of: host declarations,
114# attestations, events, graphs and policies under examples/, attestation
115# vectors under attest/, delta vectors under delta/, the integrator's
116# scenarios under integrator/e2e/.
117#
118# A check is given only the files it reads, so an edit to any other file
119# leaves its derivation, and the evidence for it, unchanged. A source path
120# names one file or directory, and lib.fileset narrows a directory to the
121# part of it a check reads. The sandbox holds a check to what it is given:
122# a file it reads and was not given fails it. nix/tools/drv-churn.sh
123# measures which checks an edit changes.
124{
125 pkgs,
126 lib,
127 self,
128 system,
129 packages,
130}:
131let
132 hosts = import ./checks/hosts.nix {
133 inherit
134 pkgs
135 lib
136 self
137 ;
138 };
139 # The same hosts over stand-ins for the programs they run, for the checks
140 # that read what the module renders and run none of the programs.
141 stubbedHosts = import ./checks/hosts.nix {
142 inherit
143 pkgs
144 lib
145 self
146 ;
147 stubbed = true;
148 };
149 # The part of a directory a check reads: the paths given, each in its
150 # place under root.
151 partOf =
152 root: paths:
153 lib.fileset.toSource {
154 inherit root;
155 fileset = lib.fileset.unions paths;
156 };
157 # integrator-e2e's stand-ins for nix and nix-store, without its
158 # scenarios. attest-e2e, valley-request, signers-e2e and restack-e2e run
159 # through these two and read nothing else of integrator/e2e/.
160 nixStandIns = partOf ../integrator/e2e [
161 ../integrator/e2e/nix
162 ../integrator/e2e/nix-store
163 ];
164 # The CLI a NixOS test machine installs. It is the real installed
165 # package, built as if nix knew no commit, so its version is always
166 # 0.1.0-unknown. packages.valley's version names the commit the flake is
167 # built from. A machine that installed it would get a new derivation, and
168 # boot again, for every new commit, even one with the same tree. attest
169 # exports a tree with no commit, so it gives both packages the same
170 # derivation. valley-cli and valley-self-update test the version that
171 # names the commit.
172 machineValley =
173 (import ./packages.nix {
174 inherit pkgs lib;
175 rev = null;
176 }).valley;
177 args = {
178 inherit
179 pkgs
180 lib
181 self
182 system
183 packages
184 hosts
185 stubbedHosts
186 partOf
187 nixStandIns
188 machineValley
189 ;
190 };
191in
192import ./checks/host-module.nix args
193// import ./checks/schema.nix args
194// import ./checks/knowledge.nix args
195// import ./checks/knot.nix args
196// import ./checks/delta.nix args
197// import ./checks/go-dependencies.nix args
198// import ./checks/derive.nix args
199// import ./checks/review.nix args
200// import ./checks/attest.nix args
201// import ./checks/integrator.nix args
202// import ./checks/restack.nix args
203// import ./checks/signers.nix args
204// import ./checks/hooks.nix args
205// import ./checks/onmain.nix args
206// import ./checks/approval.nix args
207// import ./checks/identity.nix args
208// import ./checks/sigverify.nix args
209// import ./checks/web.nix args
210// import ./checks/web-push-e2e.nix args
211// import ./checks/web-reader-browser-e2e.nix args
212// import ./checks/cli.nix args
213// import ./checks/darwin.nix args
214// import ./checks/ssh-e2e.nix args
215// import ./checks/publish-e2e.nix args
216// import ./checks/worker-e2e.nix args
217// import ./checks/telemetry.nix args
218// import ./checks/restack-host-e2e.nix args
219// import ./checks/web-publisher-e2e.nix args
220// import ./checks/flow.nix args
221// import ./checks/flow-policy.nix args