gunk-dev/the-valley

checks.nix

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