gunk-dev/the-valley

policy.cue

sourceb115ae7362ffmain's published tip history
29.3 KiB
1// the-valley's project layer: what this one project declares above the
2// floor. The floor is the owning valley's policy/instance; this
3// layer binds the-valley alone, and a project can only add to its own
4// layer (dcr-f41f718).
5package verification
6
7import (
8 "list"
9 "strings"
10)
11
12project: {
13 // the-valley takes no knowledge lint of its own tree. The docs
14 // template's lint checks a knowledge graph kept in the source, and
15 // the-valley's source holds none: its plan graph is project storage, at
16 // refs/the-valley/knots, and the push hook holds it to the knot
17 // module's rules. The nodes under archive/.the-valley/ are history that
18 // never changes, so linting them against today's schema protects
19 // nothing. The lint itself stays covered: the knowledge-lint class
20 // below requires its consumer and rejection checks.
21
22 // Every check below is the flake check of the same name in
23 // nix/checks.nix, built for the runner's own system. own-policy holds
24 // this list to that: a name here that the flake does not define fails
25 // it.
26 let ownChecks = [
27 "valleyhook-unit",
28 "protect-e2e",
29 "knots-e2e",
30 "note-unit",
31 "exactjson-unit",
32 "pushpolicy-unit",
33 "change-unit",
34 "knot-unit",
35 "knot-agree",
36 "delta-unit",
37 "derive-unit",
38 "composed-unit",
39 "review-unit",
40 "attest-unit",
41 "attest-conformance",
42 "attest-e2e",
43 "identity-unit",
44 "identity-e2e",
45 "approval-unit",
46 "integrator-unit",
47 "integrator-e2e",
48 "restack-unit",
49 "restack-e2e",
50 "signers-e2e",
51 "sigverify-unit",
52 "sigverify-e2e",
53 "web-unit",
54 "web-server-unit",
55 "web-reader-state-crash",
56 "web-reader-browser-e2e",
57 "web-receiver-unit",
58 "readaccess-unit",
59 "rebase-unit",
60 "valley-go-unit",
61 "valley-cli",
62 "review-notes",
63 "valley-request",
64 "valley-status",
65 "valley-ready",
66 "valley-changes",
67 "valley-walk",
68 "valley-knot",
69 "valley-plan",
70 "valley-darwin-eval",
71 "selfupdate-unit",
72 "valley-self-update",
73 "policy-deriver",
74 "own-policy",
75 "go-dependencies",
76 "module-eval",
77 "cue-vet",
78 "attest-schema",
79 "identity-schema",
80 "knowledge-lint-consumer",
81 "knowledge-lint-rejects",
82 "init-e2e",
83 "mirror-e2e",
84 "bus-e2e",
85 "ssh-e2e",
86 "publish-e2e",
87 "worker-e2e",
88 "telemetry-unit",
89 "telemetry-e2e",
90 "restack-host-e2e",
91 "web-publisher-e2e",
92 "web-image",
93 "web-push-e2e",
94 ]
95 for n in ownChecks {
96 checks: (n): {
97 runner: "nix"
98 attribute: n
99 }
100 }
101
102 // The integrator's scenarios take about a minute, and ssh-e2e,
103 // publish-e2e, worker-e2e, telemetry-e2e, restack-host-e2e and
104 // web-publisher-e2e boot
105 // NixOS machines. web-reader-browser-e2e boots no machine, but its
106 // closure holds Chromium, and it runs a browser in about 2 GiB.
107 // Every other check here takes seconds once its packages are built.
108 checks: "integrator-e2e": cost: "slow"
109 checks: "ssh-e2e": cost: "slow"
110 checks: "publish-e2e": cost: "slow"
111 checks: "worker-e2e": cost: "slow"
112 checks: "telemetry-e2e": cost: "slow"
113 checks: "restack-host-e2e": cost: "slow"
114 checks: "web-publisher-e2e": cost: "slow"
115 checks: "web-reader-browser-e2e": cost: "slow"
116
117 // Each class below is one part of the tree and the checks that read it.
118 // A path in two classes requires both sets. A Go module's unit check is
119 // its package built again with its tests, which runs `go test`. The
120 // package itself runs no tests (nix/packages.nix).
121
122 // The pre-receive hook and the git user's login shell, and the push
123 // policy reader the hook decides every push with (pushpolicy/), which
124 // is the hook's code wherever it lives. protect-e2e pushes to bare
125 // repositories wired with the hook a host renders, valley-ready pushes
126 // change records through that hook, and knots-e2e pushes the plan graph
127 // through it.
128 classes: valleyhook: {
129 paths: "valleyhook/**": true
130 paths: "pushpolicy/**": true
131 requires: "valleyhook-unit": true
132 requires: "pushpolicy-unit": true
133 requires: "protect-e2e": true
134 requires: "valley-ready": true
135 requires: "knots-e2e": true
136 }
137
138 // The change record, which the hook guards, the CLI's Go verbs and the
139 // rebase engine write, and the integrator and the review module read.
140 // Each reads a record through it, so a change to it requires their tests
141 // as well as its own.
142 classes: change: {
143 paths: "change/**": true
144 requires: "change-unit": true
145 requires: "review-unit": true
146 requires: "valleyhook-unit": true
147 requires: "protect-e2e": true
148 requires: "rebase-unit": true
149 requires: "valley-go-unit": true
150 requires: "valley-ready": true
151 requires: "valley-changes": true
152 requires: "integrator-unit": true
153 requires: "integrator-e2e": true
154 requires: "approval-unit": true
155 }
156
157 // The plan graph's module, which the CLI's Go verbs write the graph
158 // with and the hook validates it with. knot-agree holds its validator
159 // to the node schema and the knowledge lint, valley-knot and
160 // valley-plan drive the verbs that use it, and knots-e2e pushes
161 // through the hook. The web export reads names and knot IDs by its
162 // rules, and the web server reads a claim's age by them, so
163 // web-unit and web-server-unit are here too.
164 classes: knot: {
165 paths: "knot/**": true
166 requires: "knot-unit": true
167 requires: "knot-agree": true
168 requires: "valley-go-unit": true
169 requires: "valley-knot": true
170 requires: "valley-plan": true
171 requires: "valleyhook-unit": true
172 requires: "knots-e2e": true
173 requires: "web-unit": true
174 requires: "web-server-unit": true
175 }
176
177 // valley-delta-v1, which the CLI's Go verbs compare a version with its
178 // approved version through, and which the review module recomputes a
179 // review's binding with. delta-unit holds it to its conformance vectors,
180 // valley-go-unit builds the verbs with it, valley-ready and review-notes
181 // drive review over the comparison, and review-unit binds reviews with
182 // its bounded reading.
183 classes: delta: {
184 paths: "delta/**": true
185 requires: "delta-unit": true
186 requires: "valley-go-unit": true
187 requires: "valley-ready": true
188 requires: "review-notes": true
189 requires: "review-unit": true
190 }
191
192 // Review records: the record, its binding to the version it judged, and
193 // its append-only history. review-unit runs its tests against real git.
194 classes: review: {
195 paths: "review/**": true
196 requires: "review-unit": true
197 }
198
199 // The deriver of required checks, and the composed-policy reader it reads
200 // the whole policy through. derive-unit holds the deriver's answers,
201 // composed-unit holds the reader's layer reads, and valley-go-unit builds
202 // the verb that prints its answer with both.
203 classes: derive: {
204 paths: "derive/**": true
205 paths: "composed/**": true
206 requires: "derive-unit": true
207 requires: "composed-unit": true
208 requires: "valley-go-unit": true
209 }
210
211 // The note envelope, and the written form and tree digest of the
212 // statement inside it (note/statement/), which the attest class covers
213 // too. The hook and attest both read notes through it, the identity
214 // compiler reads its approval files back with it, the web export's
215 // manifest is a note, which the web server builds with, the vectors
216 // attest-conformance holds are signed notes, and the rebase engine
217 // verifies transfer statements with all of it, as signers-e2e drives
218 // end to end. So a change to it requires their tests as well as its
219 // own.
220 classes: note: {
221 paths: "note/**": true
222 requires: "note-unit": true
223 requires: "valleyhook-unit": true
224 requires: "protect-e2e": true
225 requires: "attest-unit": true
226 requires: "attest-conformance": true
227 requires: "attest-e2e": true
228 requires: "identity-unit": true
229 requires: "approval-unit": true
230 requires: "web-unit": true
231 requires: "web-server-unit": true
232 requires: "rebase-unit": true
233 requires: "signers-e2e": true
234 }
235
236 // The attestation helper, the written form and tree digest it writes
237 // and verifies statements with (note/statement/), and the conformance
238 // vectors under attest/conformance/ that hold the written form fixed.
239 // restack-e2e signs the changes' evidence with attest run.
240 classes: attest: {
241 paths: "attest/**": true
242 paths: "note/statement/**": true
243 requires: "attest-unit": true
244 requires: "attest-conformance": true
245 requires: "attest-e2e": true
246 requires: "restack-e2e": true
247 }
248
249 // The strict JSON reader. The push policy reader reads with it, the
250 // identity compiler its registry, read access a policy/read, and the
251 // web export, publisher, server and receiver what they are sent, so a
252 // change to it requires their unit tests as well as its own.
253 classes: exactjson: {
254 paths: "exactjson/**": true
255 requires: "exactjson-unit": true
256 requires: "pushpolicy-unit": true
257 requires: "valleyhook-unit": true
258 requires: "identity-unit": true
259 requires: "readaccess-unit": true
260 requires: "web-unit": true
261 requires: "web-server-unit": true
262 requires: "web-receiver-unit": true
263 }
264
265 // Approval statements, their signing and verifying, the PIV session
266 // signer, and the authority stamp, which the identity compiler writes
267 // and the signers publisher leaves out.
268 classes: approval: {
269 paths: "approval/**": true
270 requires: "approval-unit": true
271 requires: "identity-unit": true
272 requires: "integrator-unit": true
273 }
274
275 // The identity registry compiler, and the registries it is driven over.
276 classes: identity: {
277 paths: "identity/**": true
278 paths: "examples/identity/**": true
279 requires: "identity-unit": true
280 requires: "identity-e2e": true
281 }
282
283 // Telemetry: the records, streams and command grammar of telemetry/, the
284 // collector built from it, and the host module's half in
285 // nix/telemetry.nix. The git user's shell parses the command with it,
286 // attest, the worker and the integrator write its streams, and the CLI
287 // reads and reports with it, so a change to it requires their unit
288 // tests as well as its own. telemetry-e2e drives all of it on a NixOS
289 // machine; it follows main after a landing, as slow end-to-end checks
290 // do, and gates nothing. module-eval evaluates the module in nix/telemetry.nix, so the
291 // module-eval class requires it for that file. It runs none of the
292 // collector's code, so a change under telemetry/ does not require it.
293 classes: telemetry: {
294 paths: "telemetry/**": true
295 paths: "nix/telemetry.nix": true
296 requires: "telemetry-unit": true
297 follows: "telemetry-e2e": true
298 requires: "valleyhook-unit": true
299 requires: "attest-unit": true
300 requires: "valley-go-unit": true
301 requires: "integrator-unit": true
302 }
303
304 // The producers and the CLI that record and send telemetry: attest's
305 // progress, the worker's and the workstation's records, and approve,
306 // which runs them. telemetry-e2e observes each over ssh, and follows main
307 // after a landing.
308 classes: "telemetry-producers": {
309 paths: "attest/progress.go": true
310 paths: "status/telemetry.go": true
311 paths: "status/workertelemetry.go": true
312 paths: "status/command.go": true
313 follows: "telemetry-e2e": true
314 }
315
316 // The check worker's own code: its pass and its records in status/, the
317 // wake directory it claims, and attest's run, which runs each check a
318 // pass builds, signs and stores the evidence, and reports its progress.
319 // worker-e2e runs those passes on a NixOS machine; it follows main after
320 // a landing, as slow end-to-end checks do, and gates nothing. The rest of status/
321 // and attest/ serves other commands too, and their classes require
322 // their own checks.
323 classes: worker: {
324 paths: "status/worker.go": true
325 paths: "status/workertelemetry.go": true
326 paths: "status/wake.go": true
327 paths: "attest/run.go": true
328 paths: "attest/check.go": true
329 paths: "attest/progress.go": true
330 follows: "worker-e2e": true
331 }
332
333 // The integrator, the end-to-end scenarios under integrator/e2e/, and the
334 // verification schema, which the integrator composes every policy under
335 // and both checks read. restack-e2e runs the real integrator too: it
336 // lands one change and rejects another.
337 classes: integrator: {
338 paths: "integrator/**": true
339 paths: "composed/**": true
340 paths: "schema/verification.cue": true
341 requires: "integrator-unit": true
342 requires: "integrator-e2e": true
343 requires: "restack-e2e": true
344 }
345
346 // The security-key signature verifier.
347 classes: sigverify: {
348 paths: "sigverify/**": true
349 requires: "sigverify-unit": true
350 requires: "sigverify-e2e": true
351 }
352
353 // The web UI's module: the export contract, its shared fixture, the
354 // publisher, the server and its browser state, and the receiver. The
355 // publisher's tests also read each project's policy/read and the
356 // instance's registry under the read and identity schemas.
357 // web-push-e2e runs the three programs as they ship, and
358 // web-reader-state-crash kills valley-web inside its browser state's
359 // transactions. Changes require all five checks.
360 classes: web: {
361 paths: "web/**": true
362 paths: "schema/read.cue": true
363 paths: "schema/identity.cue": true
364 requires: "web-unit": true
365 requires: "web-server-unit": true
366 requires: "web-reader-state-crash": true
367 requires: "web-receiver-unit": true
368 requires: "web-push-e2e": true
369 }
370
371 // What a browser engine runs or is served by on a reader page:
372 // web-reader-browser-e2e runs the packaged valley-web under headless
373 // Chromium. So it is required for the reader script and pages, the
374 // layout and the stylesheet whose hash every policy carries, the
375 // rendering and its policies, the dispatch and headers in server.go,
376 // the reader handlers, the command that sets up the browser state, the
377 // check's own test, and the packaging that builds the binary and its
378 // assets. Its definition is its own class's, check-<name> below. The
379 // publisher, package export, archives and the projection of the graph
380 // are not here: a change to them alone needs no browser.
381 classes: "reader-browser": {
382 paths: "web/server/assets/reader.js": true
383 paths: "web/server/assets/style.css": true
384 paths: "web/server/templates/redeem.tmpl": true
385 paths: "web/server/templates/logout.tmpl": true
386 paths: "web/server/templates/layout.tmpl": true
387 paths: "web/server/render.go": true
388 paths: "web/server/server.go": true
389 paths: "web/server/reader.go": true
390 paths: "web/cmd/valley-web/main.go": true
391 paths: "web/cmd/valley-web/browser_test.go": true
392 paths: "nix/packages.nix": true
393 requires: "web-reader-browser-e2e": true
394 }
395
396 // The real publisher's output that web-server-unit serves:
397 // nix/checks/web-published.sh runs the publisher and the CLI as they
398 // ship, and the server's tests read what it writes.
399 classes: "web-published": {
400 paths: "nix/checks/web-published.sh": true
401 requires: "web-server-unit": true
402 }
403
404 // Read access: the two consents a reader needs, the evaluator that
405 // intersects them, and the coverage report. readaccess-unit reads both
406 // schemas, so a change to either requires it, and the web publisher
407 // reads its consents through the module, so web-unit runs too.
408 classes: readaccess: {
409 paths: "readaccess/**": true
410 paths: "schema/read.cue": true
411 paths: "schema/identity.cue": true
412 requires: "readaccess-unit": true
413 requires: "web-unit": true
414 }
415
416 // The valley CLI: the valley command (status/), the rebase engine it
417 // rebases and reads landings with (rebase/), and its completions.
418 // valley-ready drives ready, withdraw, rebase and the verbs that take a
419 // change's handle, valley-changes drives changes and pending,
420 // valley-walk drives review with no change across a host's projects,
421 // valley-plan drives plan against the golden files under
422 // status/testdata/plan/, and valley-self-update drives --version and
423 // self-update. The web publisher reads the valley through plan, pending and knot
424 // show, and its tests in web-unit run the CLI itself, as web-push-e2e
425 // runs the CLI's package.
426 classes: cli: {
427 paths: "status/**": true
428 paths: "rebase/**": true
429 paths: "completions/**": true
430 requires: "valley-go-unit": true
431 requires: "valley-cli": true
432 requires: "review-notes": true
433 requires: "valley-request": true
434 requires: "valley-status": true
435 requires: "valley-ready": true
436 requires: "valley-changes": true
437 requires: "valley-walk": true
438 requires: "valley-knot": true
439 requires: "valley-plan": true
440 requires: "valley-self-update": true
441 requires: "policy-deriver": true
442 requires: "web-unit": true
443 requires: "web-push-e2e": true
444 requires: "integrator-e2e": true
445 }
446
447 // The push path as it ships: web-push-e2e runs the publisher, the
448 // receiver, valley-web and the CLI as nix/packages.nix builds and wraps
449 // them, and exports its host declaration under schema/valley.cue. The
450 // web and cli classes require it for the code it runs.
451 classes: "web-push": {
452 paths: "nix/packages.nix": true
453 paths: "schema/valley.cue": true
454 requires: "web-push-e2e": true
455 }
456
457 // Self-update: its module (selfupdate/), the policy the package ships
458 // for its smoke test, and the home-manager module that runs it on a
459 // timer. valley-go-unit builds the verb with the module, and
460 // valley-self-update drives the verb through the package and holds the
461 // units the home-manager module renders.
462 classes: selfupdate: {
463 paths: "selfupdate/**": true
464 paths: "examples/policy/smoke/**": true
465 paths: "nix/home-module.nix": true
466 requires: "selfupdate-unit": true
467 requires: "valley-go-unit": true
468 requires: "valley-self-update": true
469 }
470
471 // The rebase engine, with its own tests over real repositories. The
472 // verbs that run it are the cli class's, so its paths are there too.
473 classes: rebase: {
474 paths: "rebase/**": true
475 requires: "rebase-unit": true
476 }
477
478 // The restacker, with its unit tests and its planner end to end. It
479 // reads origin through the rebase engine and the policy through the
480 // composed-policy reader it shares with the integrator, so a change to
481 // either requires its checks too.
482 classes: restack: {
483 paths: "restack/**": true
484 paths: "composed/**": true
485 paths: "rebase/**": true
486 requires: "restack-unit": true
487 requires: "restack-e2e": true
488 }
489
490 // What a client verifies an integrator's transfer statement with: the
491 // host's publisher and the default name it publishes, the unit that
492 // runs it, the client's reading of the signers, the instance discovery
493 // it reads them through, the snapshot that asks for them, and the
494 // verifier and cache it checks statements with.
495 // signers-e2e drives them together over the real integrator.
496 classes: signers: {
497 paths: "integrator/signers.go": true
498 paths: "integrator/main.go": true
499 paths: "nix/valley-host.nix": true
500 paths: "status/signers.go": true
501 paths: "status/list.go": true
502 paths: "rebase/snapshot.go": true
503 paths: "rebase/transfer.go": true
504 paths: "rebase/cache.go": true
505 requires: "signers-e2e": true
506 }
507
508 // The web publisher's module, which runs the publisher on a timer in a
509 // sandbox of its own. web-publisher-e2e runs the unit it renders in a
510 // NixOS machine. module-eval, in the module-eval class, holds what it
511 // renders.
512 classes: "web-publisher": {
513 paths: "nix/web-publisher.nix": true
514 requires: "web-publisher-e2e": true
515 }
516
517 // The verification policy: this layer, the pointer to the owning
518 // valley, the schema a policy is written in, and the example policies
519 // the deriver and cue-vet read.
520 classes: policy: {
521 paths: "policy/**": true
522 paths: "schema/verification.cue": true
523 paths: "examples/policy/**": true
524 requires: "policy-deriver": true
525 requires: "derive-unit": true
526 requires: "cue-vet": true
527 requires: "own-policy": true
528 }
529
530 // What module-eval evaluates: the NixOS modules, the host declarations
531 // it renders and the files they are exported from, and the wiring that
532 // hands them to the check. Nothing else changes its derivation. An edit
533 // to another check's script or definition, to the packages, or to a
534 // program's code leaves it unchanged, so those paths are not here. That
535 // holds for nix/checks/ in general: each file there is its own check's,
536 // by the per-check classes below, and module-eval's own files are
537 // nix/checks/module-eval.sh, nix/checks/host-module.nix and
538 // nix/checks/hosts.nix.
539 classes: "module-eval": {
540 paths: "nix/valley-host.nix": true
541 paths: "nix/telemetry.nix": true
542 paths: "nix/web-publisher.nix": true
543 paths: "nix/web-receiver.nix": true
544 paths: "nix/checks.nix": true
545 paths: "nix/checks/hosts.nix": true
546 paths: "nix/checks/host-module.nix": true
547 paths: "schema/valley.cue": true
548 paths: "flake.nix": true
549 paths: "flake.lock": true
550 paths: "examples/host.cue": true
551 paths: "examples/hosts/protected.cue": true
552 paths: "examples/hosts/no-backup.cue": true
553 paths: "examples/hosts/bus.cue": true
554 paths: "examples/hosts/mirrors.cue": true
555 requires: "module-eval": true
556 }
557
558 // The flake, the NixOS module, the packages and the check definitions,
559 // and the host declarations the module checks are evaluated over.
560 // own-policy is here because renaming or removing a flake check would
561 // leave this layer naming a check that no longer exists. A change to
562 // flake.nix or flake.lock requires these and module-eval, which boots
563 // no machine, so a nixpkgs bump boots none.
564 classes: nix: {
565 paths: "nix/**": true
566 paths: "flake.nix": true
567 paths: "flake.lock": true
568 paths: "examples/host.cue": true
569 paths: "examples/hosts/**": true
570 requires: "valley-darwin-eval": true
571 requires: "cue-vet": true
572 requires: "own-policy": true
573 }
574
575 // The schemas, and the example events, attestations and registries they
576 // are vetted against.
577 classes: schema: {
578 paths: "schema/**": true
579 paths: "examples/events/**": true
580 paths: "examples/attestations/**": true
581 paths: "examples/identity/**": true
582 requires: "cue-vet": true
583 requires: "attest-schema": true
584 requires: "identity-schema": true
585 }
586
587 // The knowledge lint itself: its program, the node schema it holds a
588 // graph to, and the example graphs it must accept and reject. The plan
589 // graph's validator is held to the same two by knot-agree.
590 classes: "knowledge-lint": {
591 paths: "nix/knowledge-lint.*": true
592 paths: "schema/node.cue": true
593 paths: "examples/graphs/**": true
594 requires: "knowledge-lint-consumer": true
595 requires: "knowledge-lint-rejects": true
596 requires: "knot-agree": true
597 }
598
599 // The NixOS module and what its end-to-end checks run. The hook checks
600 // follow the scripts out of the hosts in nix/checks/hosts.nix, which
601 // are made of the three declarations named here; ssh-e2e, publish-e2e,
602 // worker-e2e and restack-host-e2e run the module in NixOS machines.
603 // worker-e2e follows main after a landing and gates nothing.
604 classes: "host-module": {
605 paths: "nix/valley-host.nix": true
606 paths: "nix/checks/hosts.nix": true
607 paths: "examples/hosts/protected.cue": true
608 paths: "examples/hosts/bus.cue": true
609 paths: "examples/hosts/mirrors.cue": true
610 requires: "init-e2e": true
611 requires: "mirror-e2e": true
612 requires: "bus-e2e": true
613 requires: "protect-e2e": true
614 requires: "knots-e2e": true
615 requires: "identity-e2e": true
616 requires: "ssh-e2e": true
617 requires: "publish-e2e": true
618 follows: "worker-e2e": true
619 requires: "restack-host-e2e": true
620 requires: "valley-changes": true
621 requires: "valley-walk": true
622 }
623
624 // The Go dependency boundary (AGENTS.md): Go source, module and
625 // workspace manifests, vendor directories and anything named vendor,
626 // which Go vendors from even as a symlink, and the checker's own
627 // module, which its check-go-dependencies class below covers only as a
628 // script and a definition.
629 classes: "go-dependencies": {
630 paths: "**/*.go": true
631 paths: "**/go.mod": true
632 paths: "**/go.sum": true
633 paths: "**/go.work": true
634 paths: "**/go.work.sum": true
635 paths: "**/vendor": true
636 paths: "**/vendor/**": true
637 paths: "nix/checks/go-dependencies-checker/**": true
638 requires: "go-dependencies": true
639 }
640
641 // A check's own files require that check: its script,
642 // nix/checks/<name>.sh, and its definition, nix/checks/<name>.nix,
643 // where it has a file of its own. One class per check, named
644 // check-<name>. prose-format is the floor's check, but its script is
645 // here. own-policy fails if a script under nix/checks/ requires no
646 // check. A class can only require here, so a change to the script or
647 // definition of worker-e2e or telemetry-e2e still builds it before
648 // landing, though a change to the subject it tests only follows.
649 for n in list.Concat([ownChecks, ["prose-format"]]) {
650 classes: ("check-\(n)"): {
651 paths: ("nix/checks/\(n).sh"): true
652 paths: ("nix/checks/\(n).nix"): true
653 requires: (n): true
654 }
655 }
656
657 // The other files under nix/checks/, and the checks that read each: the
658 // definitions of a subject's checks, and the helpers and rejection lists
659 // a check is given. cli.nix, which defines every check of the CLI,
660 // is left to the nix class, as is nix/checks.nix, which wires them all.
661 // This map can only require, so telemetry.nix keeps requiring
662 // telemetry-e2e: a change to its definition builds it before landing.
663 let checkFiles = {
664 "attest.nix": ["attest-unit", "attest-conformance", "attest-e2e"]
665 "telemetry.nix": ["telemetry-unit", "telemetry-e2e"]
666 "delta.nix": ["delta-unit"]
667 "derive.nix": ["derive-unit", "composed-unit"]
668 "review.nix": ["review-unit"]
669 "identity.nix": ["identity-unit", "identity-e2e"]
670 "approval.nix": ["approval-unit"]
671 "integrator.nix": ["integrator-unit", "integrator-e2e"]
672 "signers.nix": ["signers-e2e"]
673 "sigverify.nix": ["sigverify-unit", "sigverify-e2e"]
674 "web.nix": ["web-unit", "web-server-unit", "web-reader-state-crash", "web-receiver-unit", "web-image", "readaccess-unit"]
675 "schema.nix": ["cue-vet", "attest-schema", "identity-schema"]
676 "knowledge.nix": ["knowledge-lint-consumer", "knowledge-lint-rejects", "prose-format"]
677 "hooks.nix": ["valleyhook-unit", "change-unit", "pushpolicy-unit", "mirror-e2e", "protect-e2e", "init-e2e", "bus-e2e"]
678 "host-module.nix": ["module-eval"]
679 "fail-nth.sh": ["policy-deriver", "valley-request"]
680 "review-notes-editor.sh": ["review-notes"]
681 "cue-vet-rejected.txt": ["cue-vet"]
682 "identity-rejected.txt": ["identity-schema"]
683 "knowledge-lint-rejected.txt": ["knowledge-lint-rejects"]
684 }
685 for f, ns in checkFiles {
686 classes: ("check-file-\(strings.Replace(f, ".", "-", -1))"): {
687 paths: ("nix/checks/\(f)"): true
688 requires: {for n in ns {(n): true}}
689 }
690 }
691
692 // How far an approval carries across a rebase (#Carry in
693 // schema/verification.cue). Every path not named here is same-paths.
694 //
695 // The hook, the integrator, the signature verifier and the identity
696 // compiler enforce who may do what. An approval of a change to one of
697 // them carries only while no landing has touched the same classes:
698 // same-class. The identity compiler's class is its code and the schema
699 // it holds a registry to. It requires nothing, because the identity and
700 // schema classes already require the checks of its paths.
701 classes: valleyhook: carry: "same-class": true
702 classes: integrator: carry: "same-class": true
703 classes: sigverify: carry: "same-class": true
704 classes: "identity-compiler": {
705 paths: "identity/**": true
706 paths: "schema/identity.cue": true
707 carry: "same-class": true
708 }
709
710 // The policy decides what every change requires, so an approval of a
711 // change to it carries across no landing at all: exact. That is this
712 // layer, the pointer to the owning valley, and the schema a policy is
713 // written in. The example policies are fixtures and stay same-paths. Like
714 // identity-compiler, this class requires nothing: the policy class
715 // requires the checks of its paths.
716 //
717 // This tree holds no registry, grant or secret data of its own. The
718 // registries, grants and keys under examples/ and attest/conformance/
719 // are test fixtures, and the instance's registry is in its instance
720 // repository. So nothing else here is exact.
721 classes: "policy-authority": {
722 paths: "policy/**": true
723 paths: "schema/verification.cue": true
724 carry: exact: true
725 }
726
727 // The restacker's cap is the schema's default of 64 automatic versions
728 // per change.
729}
730
731// What no class above covers falls to the floor's `unclassified` rule and
732// requires prose-format alone. That is the research artefacts under research/,
733// the GitHub mirror's workflow under .github/, and editor settings: files
734// no program here reads.