gunk-dev/the-valley

policy.cue

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