gunk-dev/the-valley

checks.nix

sourceb115ae7362ffmain's published tip history
9.4 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, mirror-e2e, bus-e2e,
42# protect-e2e, knots-e2e, init-e2e — the hooks the module renders,
43# run against real git, the formats they read, and the
44# init script that wires them
45# approval.nix approval-unit — approval statements, their signing
46# and verification, and the PIV session signer
47# identity.nix identity-unit, identity-e2e — the compiler's unit
48# tests, and the registry compiler over a real
49# instance repository, against the hand-written
50# artifacts it replaces, and the hook reading its grants
51# sigverify.nix sigverify-unit, sigverify-e2e — the security-key
52# signature verifier against real ssh-keygen, real git
53# and OpenSSH's software authenticator
54# web.nix web-unit, web-server-unit, web-reader-state-crash,
55# web-receiver-unit, web-image, readaccess-unit — the
56# web UI's export contract (projection, manifest, upload
57# checks, and receiver state directory), the valley-web
58# server and its browser state, that state's
59# transactions killed and failed at each step, the
60# valley-web-receive receiver, the edge container image,
61# and the two read-access consents and coverage report
62# web-reader-browser-e2e.nix
63# web-reader-browser-e2e — the reader page in headless
64# Chromium in the build sandbox, behind a TLS proxy
65# web-push-e2e.nix web-push-e2e — the push path end to end over the
66# shipped publisher, receiver, valley-web and CLI,
67# with real git
68# cli.nix valley-cli, review-notes, policy-deriver,
69# own-policy, valley-request, rebase-unit,
70# valley-go-unit, valley-status, valley-ready,
71# valley-changes, valley-walk, valley-knot, valley-plan,
72# selfupdate-unit, valley-self-update,
73# valley-darwin-eval — the valley command, the
74# rebase engine, self-update and its home-manager
75# module, the-valley's own policy, and the CLI's
76# package evaluated for Darwin
77# ssh-e2e.nix ssh-e2e — the push boundary over a real sshd in a
78# NixOS machine, and the request grant's handoff
79# publish-e2e.nix publish-e2e — an integrator landing reaching the push
80# mirror and the bus, in a NixOS machine running the
81# real controller
82# worker-e2e.nix worker-e2e — the build slice and the check worker in a
83# NixOS machine: the worker's key, its enrollment and
84# its evidence on origin, and the slice's caps on its
85# builds and on builds that are not its own
86# restack-host-e2e.nix
87# restack-host-e2e — the restacker's service in a NixOS
88# machine: its controller restacking a ready change
89# over sshd as its own principal, its Unix user's
90# isolation, and what its key can push
91# web-publisher-e2e.nix
92# web-publisher-e2e — the web publisher's sandbox in
93# a NixOS machine: the unit the module renders, with a
94# probe in place of the publisher, and the read links'
95# wrapper run as root, delivering through the policy
96# unit to a receiver
97#
98# Fixtures live with the thing they are fixtures of: host declarations,
99# attestations, events, graphs and policies under examples/, attestation
100# vectors under attest/, delta vectors under delta/, the integrator's
101# scenarios under integrator/e2e/.
102#
103# A check is given only the files it reads, so an edit to any other file
104# leaves its derivation, and the evidence for it, unchanged. A source path
105# names one file or directory, and lib.fileset narrows a directory to the
106# part of it a check reads. The sandbox holds a check to what it is given:
107# a file it reads and was not given fails it. nix/tools/drv-churn.sh
108# measures which checks an edit changes.
109{
110 pkgs,
111 lib,
112 self,
113 system,
114 packages,
115}:
116let
117 hosts = import ./checks/hosts.nix {
118 inherit
119 pkgs
120 lib
121 self
122 ;
123 };
124 # The same hosts over stand-ins for the programs they run, for the checks
125 # that read what the module renders and run none of the programs.
126 stubbedHosts = import ./checks/hosts.nix {
127 inherit
128 pkgs
129 lib
130 self
131 ;
132 stubbed = true;
133 };
134 # The part of a directory a check reads: the paths given, each in its
135 # place under root.
136 partOf =
137 root: paths:
138 lib.fileset.toSource {
139 inherit root;
140 fileset = lib.fileset.unions paths;
141 };
142 # integrator-e2e's stand-ins for nix and nix-store, without its
143 # scenarios. attest-e2e, valley-request, signers-e2e and restack-e2e run
144 # through these two and read nothing else of integrator/e2e/.
145 nixStandIns = partOf ../integrator/e2e [
146 ../integrator/e2e/nix
147 ../integrator/e2e/nix-store
148 ];
149 # The CLI a NixOS test machine installs. It is the real installed
150 # package, built as if nix knew no commit, so its version is always
151 # 0.1.0-unknown. packages.valley's version names the commit the flake is
152 # built from. A machine that installed it would get a new derivation, and
153 # boot again, for every new commit, even one with the same tree. attest
154 # exports a tree with no commit, so it gives both packages the same
155 # derivation. valley-cli and valley-self-update test the version that
156 # names the commit.
157 machineValley =
158 (import ./packages.nix {
159 inherit pkgs lib;
160 rev = null;
161 }).valley;
162 args = {
163 inherit
164 pkgs
165 lib
166 self
167 system
168 packages
169 hosts
170 stubbedHosts
171 partOf
172 nixStandIns
173 machineValley
174 ;
175 };
176in
177import ./checks/host-module.nix args
178// import ./checks/schema.nix args
179// import ./checks/knowledge.nix args
180// import ./checks/knot.nix args
181// import ./checks/delta.nix args
182// import ./checks/go-dependencies.nix args
183// import ./checks/derive.nix args
184// import ./checks/review.nix args
185// import ./checks/attest.nix args
186// import ./checks/integrator.nix args
187// import ./checks/restack.nix args
188// import ./checks/signers.nix args
189// import ./checks/hooks.nix args
190// import ./checks/approval.nix args
191// import ./checks/identity.nix args
192// import ./checks/sigverify.nix args
193// import ./checks/web.nix args
194// import ./checks/web-push-e2e.nix args
195// import ./checks/web-reader-browser-e2e.nix args
196// import ./checks/cli.nix args
197// import ./checks/ssh-e2e.nix args
198// import ./checks/publish-e2e.nix args
199// import ./checks/worker-e2e.nix args
200// import ./checks/telemetry.nix args
201// import ./checks/restack-host-e2e.nix args
202// import ./checks/web-publisher-e2e.nix args