gunk-dev/the-valley

policy.cue

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