gunk-dev/the-valley

checks.nix

source4a0035221288main'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 (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, and the read links'
83# wrapper run as root, delivering through the policy
84# unit to a receiver
85#
86# Fixtures live with the thing they are fixtures of: host declarations,
87# attestations, events, graphs and policies under examples/, attestation
88# vectors under attest/, delta vectors under delta/, the integrator's
89# scenarios under integrator/e2e/.
90#
91# A check is given only the files it reads, so an edit to any other file
92# leaves its derivation, and the evidence for it, unchanged. A source path
93# names one file or directory, and lib.fileset narrows a directory to the
94# part of it a check reads. The sandbox holds a check to what it is given:
95# a file it reads and was not given fails it. nix/tools/drv-churn.sh
96# measures which checks an edit changes.
97{
98 pkgs,
99 lib,
100 self,
101 system,
102 packages,
103}:
104let
105 hosts = import ./checks/hosts.nix {
106 inherit
107 pkgs
108 lib
109 self
110 ;
111 };
112 # The same hosts over stand-ins for the programs they run, for the checks
113 # that read what the module renders and run none of the programs.
114 stubbedHosts = import ./checks/hosts.nix {
115 inherit
116 pkgs
117 lib
118 self
119 ;
120 stubbed = true;
121 };
122 # The part of a directory a check reads: the paths given, each in its
123 # place under root.
124 partOf =
125 root: paths:
126 lib.fileset.toSource {
127 inherit root;
128 fileset = lib.fileset.unions paths;
129 };
130 # integrator-e2e's stand-ins for nix and nix-store, without its
131 # scenarios. attest-e2e, valley-request, signers-e2e and restack-e2e run
132 # through these two and read nothing else of integrator/e2e/.
133 nixStandIns = partOf ../integrator/e2e [
134 ../integrator/e2e/nix
135 ../integrator/e2e/nix-store
136 ];
137 args = {
138 inherit
139 pkgs
140 lib
141 self
142 system
143 packages
144 hosts
145 stubbedHosts
146 partOf
147 nixStandIns
148 ;
149 };
150in
151import ./checks/host-module.nix args
152// import ./checks/schema.nix args
153// import ./checks/knowledge.nix args
154// import ./checks/knot.nix args
155// import ./checks/delta.nix args
156// import ./checks/derive.nix args
157// import ./checks/review.nix args
158// import ./checks/attest.nix args
159// import ./checks/integrator.nix args
160// import ./checks/restack.nix args
161// import ./checks/signers.nix args
162// import ./checks/hooks.nix args
163// import ./checks/identity.nix args
164// import ./checks/sigverify.nix args
165// import ./checks/web.nix args
166// import ./checks/web-push-e2e.nix args
167// import ./checks/cli.nix args
168// import ./checks/ssh-e2e.nix args
169// import ./checks/publish-e2e.nix args
170// import ./checks/worker-e2e.nix args
171// import ./checks/restack-host-e2e.nix args
172// import ./checks/web-publisher-e2e.nix args