gunk-dev/the-valley

checks.nix

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