diff options
Diffstat (limited to 'tests/invariants.rs')
| -rw-r--r-- | tests/invariants.rs | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/tests/invariants.rs b/tests/invariants.rs index 770966f..35f5b1a 100644 --- a/tests/invariants.rs +++ b/tests/invariants.rs @@ -1,13 +1,3 @@ -//! The §2 invariant index. -//! -//! Every invariant in DESIGN.md §2 gets a named test here, asserted as a -//! **post-condition on a real end-to-end run** rather than as a unit test of the -//! function that happens to maintain it. If one of these ever fails, the -//! property the whole design rests on is broken, not just some helper. -//! -//! Invariants whose mechanism lands in a later phase are named at the bottom -//! with the test that covers them once it does. - mod common; use aur_build::db::{self, builds, model::*}; @@ -72,8 +62,8 @@ fn i1_every_index_entry_traces_back_to_an_approval() { } /// **I2 — the diff base is the last accepted version, never the last seen one.** -/// Many detections arrive while nobody is looking; the review still compares -/// against the accepted release, not against whatever was polled last. +/// Many detections arrive while nobody is looking; the review still compares against +/// the accepted release. #[test] fn i2_base_is_the_last_accepted_version_after_many_detections() { let (env, fx) = env_with_fixture("plain-make"); @@ -175,8 +165,8 @@ fn i5_resume_after_a_crash_repeats_no_completed_step() { ); // No duplicate side effects: one release row for the version, one artifact. assert_eq!(count(&env, "SELECT count(*) FROM release WHERE pkgver='2.0'"), 1); - // Artifacts are content-addressed and persist across builds; what must not - // happen is the same bytes recorded twice. + // Artifacts are content-addressed; what must not happen is the same bytes + // recorded twice. assert_eq!( count(&env, "SELECT count(*) FROM artifact"), count(&env, "SELECT count(DISTINCT digest) FROM artifact"), @@ -224,8 +214,7 @@ fn i7_the_schema_refuses_a_second_open_review() { } /// **I8 — the served index is exactly the set of accepted pointers.** Not a -/// superset (nothing stale lingers) and not a subset (nothing published is -/// missing). Checked against the files on disk as well as the rows. +/// superset and not a subset. Checked against the files on disk as well as the rows. #[test] fn i8_index_equals_the_accepted_pointers() { let (env, fx) = env_with_fixture("plain-make"); @@ -304,8 +293,7 @@ fn i6_manual_rebuild_publishes_the_same_version_without_a_new_approval() { /// n-5: a manual rebuild's identity used to be a hand-rolled /// `format!("{commit}|{hash}|manual}")` — a second, incompatible format for the /// same concept, with a delimiter that can occur inside the values. It is now -/// derived through the same canonical-JSON hash as every other identity, and -/// what the change must not disturb is the two properties the queue depends on. +/// derived through the same canonical-JSON hash as every other identity. #[test] fn a_manual_rebuild_is_deterministic_and_its_own_build() { let (env, _fx) = env_with_fixture("plain-make"); @@ -418,19 +406,12 @@ fn index_db_names(path: &std::path::Path) -> Vec<String> { names } -/// I9: build hosts are treated as untrusted — a malicious PKGBUILD must not -/// reach the control plane's data or smuggle foreign bytes into what we publish. +/// I9: build hosts are treated as untrusted — a malicious PKGBUILD must not reach +/// the control plane's data or smuggle foreign bytes into what we publish. /// -/// The real enforcement is the chroot, and that tier is gated. What is *not* -/// gated, and what this pins, is the pipeline's own hygiene: `collect` scans the -/// srcdir for `*.pkg.tar.zst` and `ingest` copies whatever those paths point at -/// into the content-addressed store, from where the bytes are served from our -/// repo and signed with our key. If a build could make one of those paths be a -/// symlink to the signing keyring or the database, isolation would be the only -/// thing standing between a hostile AUR recipe and a signed artifact of our own -/// secret files. It must not be. So the pipeline refuses symlinks and refuses -/// anything that resolves outside the build's own staging directory, and this -/// test acts the attack out rather than arguing it away. +/// `collect` scans the srcdir for `*.pkg.tar.zst` and `ingest` copies whatever those +/// paths point at into the store, from where the bytes are served and signed. So the +/// pipeline refuses symlinks and anything outside the build's own staging directory. #[test] fn i9_a_build_cannot_smuggle_bytes_in_from_outside_its_own_staging_dir() { let (mut env, _fx) = env_with_fixture("plain-make"); |
