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