gunk-dev/the-valley

checks.nix

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