gunk-dev/the-valley

checks.nix

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