diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 17:33:17 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 17:33:17 +0000 |
| commit | 4304b0f336ddba7b4ec6780795059ff2066d105b (patch) | |
| tree | 10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /tests/detect.rs | |
| parent | e757979f1a2afdbe7146066345bb9acd19d3b151 (diff) | |
| download | aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip | |
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its
arguments or fields, or cited the design docs (§n, I-n, m-n, decision n).
2247 comments down to 83.
What survives: the section dividers that segment the large modules, the
secret-handling warnings, the agent wire-frame directions, and the few notes
without which the code they attach to reads as redundant, reorderable, or
unsound.
Diffstat (limited to 'tests/detect.rs')
| -rw-r--r-- | tests/detect.rs | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/tests/detect.rs b/tests/detect.rs index 6284b31..a7641b1 100644 --- a/tests/detect.rs +++ b/tests/detect.rs @@ -7,7 +7,6 @@ use aur_build::review::{approve, candidates}; use aur_build::watch::detect::{check_pkgbase, Outcome}; use aur_build::watch::mirror::{sync_mirror, Sync}; -/// Path of the fake AUR repo for `name`, matching `Env::subscribe`'s URL. fn aur(env: &Env, name: &str) -> std::path::PathBuf { env.path(&format!("aur/{name}.git")) } @@ -40,7 +39,6 @@ fn first_detection_opens_a_first_introduction_with_no_base() { assert_eq!(c.kind, candidate_kind::FIRST_INTRODUCTION); assert_eq!(c.base_release_id, None, "I2 has no referent for a first introduction"); assert_eq!(c.version(), "1.0-1"); - // The pin is recorded on the snapshot and it is the commit we cloned. let snap = db::snapshot_by_id(&env.db, c.snapshot_id).unwrap().unwrap(); assert_eq!(snap.aur_commit, commit); assert_eq!(snap.recipe_hash.len(), 64); @@ -59,7 +57,6 @@ fn cheap_poll_does_not_fetch_when_the_tip_is_unchanged() { Sync::Unchanged { head } => assert_eq!(head, git_head(&aur(&env, "foo"))), other => panic!("expected Unchanged, got {other:?}"), } - // A new commit makes it fetch. git_add_commit(&aur(&env, "foo"), &[("PKGBUILD", &common::pkgbuild("foo", "1.1", "1", ""))], "bump"); let moved = sync_mirror(&env.cfg, &env.db, "foo", &url).unwrap(); assert!(matches!(moved, Sync::Fetched { .. }), "SHA moved -> fetch"); @@ -69,8 +66,6 @@ fn git_head(p: &std::path::Path) -> String { aur_build::git::head(p).unwrap() } -/// §3: `recipe_hash` covers the *entire* tree, because a shipped patch is part of -/// the recipe and is a classic silent-change vector. #[test] fn recipe_hash_covers_shipped_patches() { let env = Env::new(); @@ -83,7 +78,6 @@ fn recipe_hash_covers_shipped_patches() { let h1 = db::snapshot_by_id(&env.db, c1.snapshot_id).unwrap().unwrap().recipe_hash; env.accept_as_release(c1.id); - // Same PKGBUILD, different patch bytes. git_add_commit(&aur(&env, "foo"), &[("fix.patch", "--- a\n+++ b\n@@\n-old\n+EVIL\n")], "patch2"); let rep = check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); assert!( @@ -117,7 +111,6 @@ fn skip_sources_are_stream_hashed_into_the_cache() { assert_eq!(digests[0].digest, expected, "we hash SKIP sources ourselves (§5.3)"); assert!(digests[0].skip_declared); assert_eq!(digests[0].kind, "static"); - // The bytes landed in the content-addressed cache and are recorded. let cached = env.query_i64( "SELECT count(*) FROM source_cache WHERE url LIKE '%payload.txt' AND digest=?1", ¶ms(vec![expected.clone()]), @@ -125,7 +118,6 @@ fn skip_sources_are_stream_hashed_into_the_cache() { assert_eq!(cached, Some(1)); let path = env.cfg.source_cache_path(&expected); assert!(path.exists(), "cached file is reused by the build"); - // A declared checksum costs no bandwidth: nothing was downloaded for it. } #[test] @@ -153,7 +145,6 @@ fn declared_checksums_are_trusted_without_downloading() { ); } -/// I2, the headline rule: diffs are always against the last *accepted* version. #[test] fn i2_diff_base_is_the_last_accepted_version_however_many_detections_arrive() { let env = Env::new(); @@ -164,15 +155,12 @@ fn i2_diff_base_is_the_last_accepted_version_however_many_detections_arrive() { let rel1 = env.accept_as_release(c1.id); assert_eq!(accepted(&env, "foo").unwrap().id, rel1); - // v2 arrives and is detected but nobody looks at it. git_add_commit(&aur(&env, "foo"), &[("PKGBUILD", &common::pkgbuild("foo", "2.0", "1", ""))], "v2"); check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); let c2 = pending(&env, "foo").unwrap(); assert_eq!(c2.base_release_id, Some(rel1), "base is the accepted release"); assert_eq!(c2.version(), "2.0-1"); - // v3 and v4 arrive while nobody is looking: they collapse into the same review, - // and the base is *still* v1. for v in ["3.0", "4.0"] { git_add_commit(&aur(&env, "foo"), &[("PKGBUILD", &common::pkgbuild("foo", v, "1", ""))], v); check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); @@ -188,7 +176,6 @@ fn i2_diff_base_is_the_last_accepted_version_however_many_detections_arrive() { ); } -/// §7.1: `superseded` exists only when a human actually saw the old diff. #[test] fn a_viewed_review_is_frozen_and_a_fresh_one_opened() { let env = Env::new(); @@ -240,7 +227,6 @@ fn a_rejected_identity_is_not_re_raised() { check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); let c = pending(&env, "foo").unwrap(); approve::reject(&env.db, "tester", c.id, "not this one").unwrap(); - // Re-running detection must not nag (§7.1). let rep = check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); assert!( matches!(rep.outcome, Outcome::PreviouslyRejected | Outcome::NoChange), @@ -248,13 +234,11 @@ fn a_rejected_identity_is_not_re_raised() { rep.outcome ); assert!(pending(&env, "foo").is_none()); - // A *newer* version is still detected: rejection does not block (§7.1). git_add_commit(&aur(&env, "foo"), &[("PKGBUILD", &common::pkgbuild("foo", "2.0", "1", ""))], "v2"); check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); assert!(pending(&env, "foo").is_some()); } -/// I11: a change that is not publishable never silently disappears. #[test] fn recipe_drift_under_a_static_version_is_a_notice_not_a_candidate() { let env = Env::new(); @@ -264,7 +248,6 @@ fn recipe_drift_under_a_static_version_is_a_notice_not_a_candidate() { let c = pending(&env, "foo").unwrap(); env.accept_as_release(c.id); - // Maintainer edits the PKGBUILD but forgets to bump pkgrel. git_add_commit( &aur(&env, "foo"), &[("PKGBUILD", &common::pkgbuild("foo", "1.0", "1", "# a comment only"))], @@ -282,7 +265,6 @@ fn recipe_drift_under_a_static_version_is_a_notice_not_a_candidate() { assert_eq!(notices[0].severity, "warning"); } -/// §5.3: the single most valuable detection — same version, swapped bytes. #[test] fn digest_drift_with_an_unchanged_version_is_an_integrity_alert() { let env = Env::new(); @@ -300,7 +282,6 @@ fn digest_drift_with_an_unchanged_version_is_an_integrity_alert() { let c = pending(&env, "foo").unwrap(); env.accept_as_release(c.id); - // The CDN now serves something else and the version did not move. std::fs::write(&payload, b"EVIL swapped artifact").unwrap(); let rep = check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); match rep.outcome { @@ -311,7 +292,6 @@ fn digest_drift_with_an_unchanged_version_is_an_integrity_alert() { let notices = db::list_notices(&env.db, false).unwrap(); assert_eq!(notices[0].severity, "high"); assert!(notices[0].detail_json.contains("no longer serves")); - // The index keeps serving the artifact built from the old bytes (I1). assert_eq!(db::unapproved_index_entries(&env.db).unwrap(), Vec::<String>::new()); } @@ -354,7 +334,6 @@ fn detection_is_idempotent_and_records_no_duplicate_candidate() { fn srcinfo_is_preferred_over_the_pkgbuild_when_present() { let env = Env::new(); env.subscribe("foo"); - // .SRCINFO disagrees with the PKGBUILD, which is what makepkg reports. make_git_repo( &aur(&env, "foo"), &[ @@ -398,7 +377,6 @@ fn epoch_and_pkgrel_are_part_of_the_identity() { check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); let c = pending(&env, "foo").unwrap(); env.accept_as_release(c.id); - // pkgrel reset: a major signal, and a new identity. git_add_commit(&aur(&env, "foo"), &[("PKGBUILD", &common::pkgbuild("foo", "1.0", "7", ""))], "rel"); check_pkgbase(&env.cfg, &env.db, "foo").unwrap(); let c2 = pending(&env, "foo").expect("pkgrel bump is publishable, so it is a candidate"); |
