gunk-dev/the-valley

checks.nix

source8db90d62d329main's published tip history
6.6 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 module renders from a
9# declaration, and what it must refuse
10# schema.nix cue-vet, attest-schema, identity-schema — the schemas
11# against the examples they accept and the ones they
12# must reject
13# knowledge.nix knowledge-lint-consumer, knowledge-lint-rejects,
14# prose-format — the lint's reusable and rejection
15# forms, and the prose
16# knot.nix knot-unit, knot-agree — the plan graph's module, and
17# its validator held to the schema and the lint
18# delta.nix delta-unit — valley-delta-v1, its conformance vectors,
19# and the trees it reads and refuses
20# derive.nix derive-unit — the Go deriver of required checks, held
21# to bin/valley's
22# review.nix review-unit — review records, their binding to the
23# version judged, and their append-only history
24# attest.nix attest-unit, attest-conformance, attest-e2e — the
25# helper's unit tests, the written form as a fixed
26# contract, and the helper driven end to end
27# integrator.nix integrator-unit, integrator-e2e — the verdict rules,
28# and the controller over real repositories
29# restack.nix restack-unit, restack-e2e — the restacker's planner
30# over a repository wired with the rendered hook
31# signers.nix signers-e2e — the signers the host publishes, read by
32# a fresh client to verify the real integrator's landing
33# hooks.nix valleyhook-unit, note-unit, change-unit, mirror-e2e,
34# bus-e2e, protect-e2e, knots-e2e, init-e2e — the hooks
35# the module renders, run against real git, the formats
36# they read, and the init script that wires them
37# identity.nix identity-unit, identity-e2e — the compiler's unit
38# tests, and the registry compiler over a real
39# instance repository, against the hand-written
40# artifacts it replaces, and the hook reading its grants
41# sigverify.nix sigverify-unit, sigverify-e2e — the security-key
42# signature verifier against real ssh-keygen, real git
43# and OpenSSH's software authenticator
44# webui.nix webui-unit, webui-server-unit — the web UI's export
45# contract: the projection, the manifest, the upload's
46# checks and the receiver's state; and the server and
47# valley-web; over the shared fixture and real git
48# cli.nix valley-cli, review-notes, policy-deriver,
49# own-policy, valley-request, rebase-unit,
50# valley-go-unit, valley-status, valley-ready,
51# valley-changes, valley-knot, valley-plan,
52# selfupdate-unit, valley-self-update,
53# valley-darwin-eval — bin/valley, its Go verbs, the
54# rebase engine, self-update and its home-manager
55# module, the-valley's own policy, and the CLI's
56# package evaluated for Darwin
57# ssh-e2e.nix ssh-e2e — the push boundary over a real sshd in a
58# NixOS machine, and the request grant's handoff
59# publish-e2e.nix publish-e2e — an integrator landing reaching the push
60# mirror and the bus, in a NixOS machine running the
61# real controller
62# worker-e2e.nix worker-e2e — the build slice and the check worker in a
63# NixOS machine: the worker's key, its enrollment and
64# its evidence on origin, and the slice's caps on its
65# builds and on builds that are not its own
66#
67# Fixtures live with the thing they are fixtures of: host declarations,
68# attestations, events, graphs and policies under examples/, attestation
69# vectors under attest/, delta vectors under delta/, the integrator's
70# scenarios under integrator/e2e/.
71#
72# A check is given only the files it reads, so an edit to any other file
73# leaves its derivation, and the evidence for it, unchanged. A source path
74# names one file or directory, and lib.fileset narrows a directory to the
75# part of it a check reads. The sandbox holds a check to what it is given:
76# a file it reads and was not given fails it. nix/tools/drv-churn.sh
77# measures which checks an edit changes.
78{
79 pkgs,
80 lib,
81 self,
82 system,
83 packages,
84}:
85let
86 hosts = import ./checks/hosts.nix {
87 inherit
88 pkgs
89 lib
90 self
91 ;
92 };
93 # The same hosts over stand-ins for the programs they run, for the checks
94 # that read what the module renders and run none of the programs.
95 stubbedHosts = import ./checks/hosts.nix {
96 inherit
97 pkgs
98 lib
99 self
100 ;
101 stubbed = true;
102 };
103 # The part of a directory a check reads: the paths given, each in its
104 # place under root.
105 partOf =
106 root: paths:
107 lib.fileset.toSource {
108 inherit root;
109 fileset = lib.fileset.unions paths;
110 };
111 # integrator-e2e's stand-ins for nix and nix-store, without its
112 # scenarios. attest-e2e, valley-request, signers-e2e and restack-e2e run
113 # through these two and read nothing else of integrator/e2e/.
114 nixStandIns = partOf ../integrator/e2e [
115 ../integrator/e2e/nix
116 ../integrator/e2e/nix-store
117 ];
118 args = {
119 inherit
120 pkgs
121 lib
122 self
123 system
124 packages
125 hosts
126 stubbedHosts
127 partOf
128 nixStandIns
129 ;
130 };
131in
132import ./checks/host-module.nix args
133// import ./checks/schema.nix args
134// import ./checks/knowledge.nix args
135// import ./checks/knot.nix args
136// import ./checks/delta.nix args
137// import ./checks/derive.nix args
138// import ./checks/review.nix args
139// import ./checks/attest.nix args
140// import ./checks/integrator.nix args
141// import ./checks/restack.nix args
142// import ./checks/signers.nix args
143// import ./checks/hooks.nix args
144// import ./checks/identity.nix args
145// import ./checks/sigverify.nix args
146// import ./checks/webui.nix args
147// import ./checks/cli.nix args
148// import ./checks/ssh-e2e.nix args
149// import ./checks/publish-e2e.nix args
150// import ./checks/worker-e2e.nix args