gunk-dev/the-valley

checks.nix

sourcef0de1b6b5b5dmain's published tip history
7.7 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-receiver-unit,
48# web-image, readaccess-unit — the web UI's export
49# contract (projection, manifest, upload checks, and
50# receiver state directory), the valley-web server, the
51# valley-web-receive receiver, the edge container image,
52# and the two read-access consents and coverage report
53# web-push-e2e.nix web-push-e2e — the push path end to end over the
54# shipped publisher, receiver, valley-web and CLI,
55# with real git
56# cli.nix valley-cli, review-notes, policy-deriver,
57# own-policy, valley-request, rebase-unit,
58# valley-go-unit, valley-status, valley-ready,
59# valley-changes, valley-knot, valley-plan,
60# selfupdate-unit, valley-self-update,
61# valley-darwin-eval — bin/valley, its Go verbs, the
62# rebase engine, self-update and its home-manager
63# module, the-valley's own policy, and the CLI's
64# package evaluated for Darwin
65# ssh-e2e.nix ssh-e2e — the push boundary over a real sshd in a
66# NixOS machine, and the request grant's handoff
67# publish-e2e.nix publish-e2e — an integrator landing reaching the push
68# mirror and the bus, in a NixOS machine running the
69# real controller
70# worker-e2e.nix worker-e2e — the build slice and the check worker in a
71# NixOS machine: the worker's key, its enrollment and
72# its evidence on origin, and the slice's caps on its
73# builds and on builds that are not its own
74# restack-host-e2e.nix
75# restack-host-e2e — the restacker's service in a NixOS
76# machine: its controller restacking a ready change
77# over sshd as its own principal, its Unix user's
78# isolation, and what its key can push
79# web-publisher-e2e.nix
80# web-publisher-e2e — the web publisher's sandbox in
81# a NixOS machine: the unit the module renders, with a
82# probe in place of the publisher
83#
84# Fixtures live with the thing they are fixtures of: host declarations,
85# attestations, events, graphs and policies under examples/, attestation
86# vectors under attest/, delta vectors under delta/, the integrator's
87# scenarios under integrator/e2e/.
88#
89# A check is given only the files it reads, so an edit to any other file
90# leaves its derivation, and the evidence for it, unchanged. A source path
91# names one file or directory, and lib.fileset narrows a directory to the
92# part of it a check reads. The sandbox holds a check to what it is given:
93# a file it reads and was not given fails it. nix/tools/drv-churn.sh
94# measures which checks an edit changes.
95{
96 pkgs,
97 lib,
98 self,
99 system,
100 packages,
101}:
102let
103 hosts = import ./checks/hosts.nix {
104 inherit
105 pkgs
106 lib
107 self
108 ;
109 };
110 # The same hosts over stand-ins for the programs they run, for the checks
111 # that read what the module renders and run none of the programs.
112 stubbedHosts = import ./checks/hosts.nix {
113 inherit
114 pkgs
115 lib
116 self
117 ;
118 stubbed = true;
119 };
120 # The part of a directory a check reads: the paths given, each in its
121 # place under root.
122 partOf =
123 root: paths:
124 lib.fileset.toSource {
125 inherit root;
126 fileset = lib.fileset.unions paths;
127 };
128 # integrator-e2e's stand-ins for nix and nix-store, without its
129 # scenarios. attest-e2e, valley-request, signers-e2e and restack-e2e run
130 # through these two and read nothing else of integrator/e2e/.
131 nixStandIns = partOf ../integrator/e2e [
132 ../integrator/e2e/nix
133 ../integrator/e2e/nix-store
134 ];
135 args = {
136 inherit
137 pkgs
138 lib
139 self
140 system
141 packages
142 hosts
143 stubbedHosts
144 partOf
145 nixStandIns
146 ;
147 };
148in
149import ./checks/host-module.nix args
150// import ./checks/schema.nix args
151// import ./checks/knowledge.nix args
152// import ./checks/knot.nix args
153// import ./checks/delta.nix args
154// import ./checks/derive.nix args
155// import ./checks/review.nix args
156// import ./checks/attest.nix args
157// import ./checks/integrator.nix args
158// import ./checks/restack.nix args
159// import ./checks/signers.nix args
160// import ./checks/hooks.nix args
161// import ./checks/identity.nix args
162// import ./checks/sigverify.nix args
163// import ./checks/web.nix args
164// import ./checks/web-push-e2e.nix args
165// import ./checks/cli.nix args
166// import ./checks/ssh-e2e.nix args
167// import ./checks/publish-e2e.nix args
168// import ./checks/worker-e2e.nix args
169// import ./checks/restack-host-e2e.nix args
170// import ./checks/web-publisher-e2e.nix args