From 4304b0f336ddba7b4ec6780795059ff2066d105b Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:33:17 +0000 Subject: comments: keep only what the code cannot show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/pipeline.rs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'tests/pipeline.rs') diff --git a/tests/pipeline.rs b/tests/pipeline.rs index 6dd1df5..12d95b0 100644 --- a/tests/pipeline.rs +++ b/tests/pipeline.rs @@ -5,7 +5,6 @@ use aur_build::pipeline::{self, publish}; use aur_build::review::{approve, candidates, diff}; use common::*; -/// subscribe -> detect -> render the review -> approve. fn approve_fixture(env: &Env, name: &str) -> CandidateRow { aur_build::watch::detect::check_pkgbase(&env.cfg, &env.db, name).unwrap(); let c = candidates::pending_candidates(&env.db).unwrap().remove(0); @@ -14,7 +13,6 @@ fn approve_fixture(env: &Env, name: &str) -> CandidateRow { candidates::candidate_by_id(&env.db, c.id).unwrap().unwrap() } -/// Re-detect and approve whatever is pending now (a later version). fn approve_pending(env: &Env, name: &str) -> CandidateRow { approve_fixture(env, name) } @@ -65,14 +63,12 @@ fn end_to_end_publishes_a_signed_index() { assert_eq!(rel.pkgver, "1.0"); assert_eq!(rel.version(), "1.0-1"); - // Both the packages and the database are signed (§9). let arch = env.cfg.repo_arch_dir(); assert!(arch.join("plain-make-1.0-1-x86_64.pkg.tar.zst").exists()); assert!(arch.join("plain-make-1.0-1-x86_64.pkg.tar.zst.sig").exists()); assert!(arch.join("aur-build.db.tar.gz").exists()); assert!(arch.join("aur-build.db.tar.gz.sig").exists()); - // One checkpoint row per step, all green (§8.1). let all = step_rows(&env); assert_eq!(all.len(), BUILD_STEPS.len(), "one row per step: {all:?}"); assert!( @@ -83,9 +79,6 @@ fn end_to_end_publishes_a_signed_index() { #[test] fn the_build_never_signs_ingest_does() { - // Signing moved hub-side: the build command carries no `-si` and the signature - // over each artifact is made at ingest by the hub's own gpg. Worst the sandbox - // ever returns is unsigned bytes. let (env, _fx) = env_with_fixture("plain-make"); let c = approve_fixture(&env, "plain-make"); assert!(matches!(run_for(&env, &c), pipeline::Outcome::Succeeded { .. })); @@ -114,8 +107,6 @@ fn the_build_never_signs_ingest_does() { #[test] fn a_tampered_store_artifact_fails_the_lease_closed() { - // Corrupt the store bytes after publication: provisioning re-hashes everything - // it stages and must refuse, not build against bytes the index never approved. let (env, _plain, _client) = env_with_two_fixtures("plain-make", "dep-client"); let c = approve_fixture(&env, "plain-make"); assert!(matches!(run_for(&env, &c), pipeline::Outcome::Succeeded { .. })); @@ -145,8 +136,6 @@ fn a_tampered_store_artifact_fails_the_lease_closed() { other => panic!("{other:?}"), } - // Restore the bytes and resume: the lease verifies, the sandbox's `pacman -Q` - // confirms the pinned world landed, and the build completes. std::fs::write(&path, &original).unwrap(); assert!( matches!(pipeline::run(&env.cfg, &env.db, &id2).unwrap(), pipeline::Outcome::Succeeded { .. }), @@ -191,7 +180,6 @@ fn i8_served_index_holds_exactly_the_accepted_pointers() { let c2 = approve_pending(&env, "plain-make"); run_for(&env, &c2); - // The old version is gone from the index, not merely superseded in place. assert_eq!(in_index(&env), vec![("plain-make".into(), "1.0.1-1".into())]); let rel = db::accepted_release(&env.db, "plain-make").unwrap().unwrap(); assert_eq!(rel.pkgver, "1.0.1"); @@ -212,8 +200,6 @@ fn i8_served_index_holds_exactly_the_accepted_pointers() { fn step0_fails_closed_when_the_recipe_hash_drifts() { let (env, _fx) = env_with_fixture("plain-make"); let c = approve_fixture(&env, "plain-make"); - // The mirror no longer matches what was approved. There is no path from - // "AUR moved since the review" to "we built it anyway" (I3). env.exec( "UPDATE snapshot SET recipe_hash='deadbeef' WHERE id=?1", ¶ms(vec![c.snapshot_id]), @@ -235,8 +221,6 @@ fn step4_fails_closed_when_pkgver_no_longer_matches() { let (env, fx) = env_with_fixture("git-sourced"); let c = approve_fixture(&env, "git-sourced"); assert_eq!(c.pkgver, "r1.0"); - // Upstream moves after approval: the tool now resolves a different pkgver. - // The build must refuse rather than silently ship the newer one (§8.1). let mut m = fx.manifest_json(); m["vercheck"] = serde_json::json!("r9.9-1"); std::fs::write(&fx.manifest, serde_json::to_string(&m).unwrap()).unwrap(); @@ -273,8 +257,6 @@ fn i4_kill_mid_publish_leaves_the_old_index_intact() { let out = run_for(&env, &c2); assert!(matches!(out, pipeline::Outcome::Failed { .. }), "{out:?}"); - // The served database is byte-for-byte the old one, and the DB never recorded - // the new release: consumers saw either the old world or the new one (I4). assert_eq!(std::fs::read(&v1).unwrap(), before); assert_eq!(in_index(&env), vec![("plain-make".into(), "1.0-1".into())]); assert_eq!( @@ -301,8 +283,6 @@ fn i5_a_restarted_build_resumes_at_the_next_incomplete_step() { aur_build::shims::called_with(&env.cfg.hooks.shim_dir.clone().unwrap(), "makepkg", ""); assert_eq!(builds_after_crash, 2, "one real build before the crash"); - // "Restart": same build row, no fault. Only publish re-runs; the expensive - // steps are checkpointed. env.clear_publish_fault(); match pipeline::run(&env.cfg, &env.db, &id).unwrap() { pipeline::Outcome::Succeeded { release_id } => assert!(release_id > 0), @@ -314,7 +294,6 @@ fn i5_a_restarted_build_resumes_at_the_next_incomplete_step() { "I5: resuming must not rebuild" ); assert_eq!(in_index(&env), vec![("plain-make".into(), "1.0.1-1".into())]); - // Exactly one release row per version: no duplicates from the resume. assert_eq!( env.query_i64("SELECT count(*) FROM release WHERE pkgver='1.0.1'", &[]), Some(1) @@ -329,7 +308,6 @@ fn split_pkgbase_is_one_approval_and_many_index_rows() { let names: Vec = in_index(&env).into_iter().map(|(n, _)| n).collect(); assert!(names.contains(&"split-pkgbase".to_string()), "{names:?}"); assert!(names.contains(&"split-pkgbase-docs".to_string()), "{names:?}"); - // One approval, one release, N packages — the §3 split-pkgbase rule. assert_eq!(env.query_i64("SELECT count(*) FROM approval", &[]), Some(1)); assert_eq!(env.query_i64("SELECT count(*) FROM release", &[]), Some(1)); } @@ -342,14 +320,12 @@ fn a_failed_build_leaves_the_previous_version_serving() { fx.bump(&[("pkgver", "1.0.1")]); let c2 = approve_pending(&env, "plain-make"); - // The build itself fails this time. env.set_shim_fail("makepkg"); let out = run_for(&env, &c2); match out { pipeline::Outcome::Failed { step, .. } => assert_eq!(step, "build"), other => panic!("{other:?}"), } - // §8.4: the old version keeps serving and the candidate stays approved. assert_eq!(in_index(&env), vec![("plain-make".into(), "1.0-1".into())]); assert_eq!( candidates::candidate_by_id(&env.db, c2.id).unwrap().unwrap().state, @@ -364,8 +340,6 @@ fn a_failed_build_leaves_the_previous_version_serving() { #[test] fn an_unresolvable_dependency_blocks_instead_of_failing() { let (env, _fx) = env_with_fixture("missing-dep"); - // We subscribe to `dep-partner` but have never published it: "unresolvable" in - // §10.4 means wait, not fail. env.subscribe("dep-partner"); let c = approve_fixture(&env, "missing-dep"); let out = run_for(&env, &c); @@ -388,8 +362,6 @@ fn a_blocked_build_waits_until_its_dependency_actually_arrives() { let c = approve_fixture(&env, "missing-dep"); assert!(matches!(run_for(&env, &c), pipeline::Outcome::Blocked { .. })); assert_eq!(builds::blocked_builds(&env.db).unwrap().len(), 1); - // The dispatcher sweeps blocked builds every pass. Requeueing one whose blocker - // is still missing would block again immediately, so it must stay put. let _ = publish::reconcile(&env.cfg, &env.db); assert_eq!(builds::requeue_blocked(&env.db).unwrap(), 0, "requeued while still blocked"); assert_eq!(builds::blocked_builds(&env.db).unwrap().len(), 1); @@ -417,7 +389,6 @@ fn i6_manual_rebuild_reuses_the_approved_identity() { pipeline::run(&env.cfg, &env.db, &id).unwrap(), pipeline::Outcome::Succeeded { .. } )); - // Same version, new release row, and crucially: no new approval (§2 I6). assert_eq!(env.query_i64("SELECT count(*) FROM approval", &[]), before); assert_eq!(in_index(&env), vec![("plain-make".into(), "1.0-1".into())]); assert_eq!(env.query_i64("SELECT count(*) FROM release", &[]), Some(2)); @@ -429,8 +400,6 @@ fn i12_world_snapshot_is_recorded_at_ingest() { let c = approve_fixture(&env, "plain-make"); run_for(&env, &c); - // Now a second build whose chroot had our own published package installed: - // that is the pair staleness tracking is computed from (§10.1). let mut m = fx.manifest_json(); m["installed"] = serde_json::json!([ {"name": "plain-make", "version": "1.0-1", "arch": "x86_64"}, @@ -468,8 +437,6 @@ fn i12_world_snapshot_is_recorded_at_ingest() { ) }) .collect(); - // The snapshot is the installed set INTERSECTED with our own packages: - // unfiltered, Arch moving would make every package permanently stale. assert!(members.iter().any(|(n, v)| n == "plain-make" && v == "1.0-1"), "{members:?}"); assert!(!members.iter().any(|(n, _)| n == "glibc"), "{members:?}"); } @@ -479,8 +446,6 @@ fn publish_refuses_without_an_approval_behind_it() { let (env, _fx) = env_with_fixture("plain-make"); let c = approve_fixture(&env, "plain-make"); run_for(&env, &c); - // Approval rows are immutable (I10 / §7.2), so the bad state is built from the - // other side: a release with nothing behind it. let rid = db::accepted_release(&env.db, "plain-make").unwrap().unwrap().id; env.exec("UPDATE release SET approval_id=NULL WHERE id=?1", ¶ms(vec![rid])); let id = pipeline::enqueue_manual_rebuild(&env.cfg, &env.db, "plain-make").unwrap(); @@ -491,7 +456,6 @@ fn publish_refuses_without_an_approval_behind_it() { } other => panic!("I1 requires a refusal, got {other:?}"), } - // The index still holds exactly the one entry that does have an approval. assert_eq!(in_index(&env).len(), 1); } @@ -500,8 +464,6 @@ fn a_stale_accepted_pointer_refuses_to_publish() { let (env, _fx) = env_with_fixture("plain-make"); let c = approve_fixture(&env, "plain-make"); let id = pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap(); - // The approval was taken against "nothing accepted yet". Move the pointer - // out from under the build and the compare-and-swap must refuse. env.exec( "UPDATE pkgbase SET current_accepted_release_id=4242 WHERE name='plain-make'", &[], @@ -520,7 +482,6 @@ fn a_stale_accepted_pointer_refuses_to_publish() { #[test] fn withdrawing_a_release_twice_is_refused_the_second_time() { - // m-10: the second withdraw used to report success while rewriting nothing. let (env, _fx) = env_with_fixture("plain-make"); let c = approve_fixture(&env, "plain-make"); run_for(&env, &c); @@ -530,14 +491,11 @@ fn withdrawing_a_release_twice_is_refused_the_second_time() { assert!(err.to_string().contains("not published"), "{err}"); let err = approve::withdraw(&env.db, "tester", rid + 999, "x").unwrap_err(); assert!(err.to_string().contains("no release"), "{err}"); - // The first withdrawal stands: the index no longer serves it. assert!(in_index(&env).is_empty(), "the withdrawn release is still in the index"); } #[test] fn a_publish_that_does_not_land_leaves_no_orphan_files_in_the_served_tree() { - // m-16: the artifacts are copied into the served tree before the DB commit, - // and when the commit refused those bytes used to stay. let (mut env, _fx) = env_with_fixture("plain-make"); let c = approve_fixture(&env, "plain-make"); env.set_publish_fault("before-rename"); @@ -554,8 +512,6 @@ fn a_publish_that_does_not_land_leaves_no_orphan_files_in_the_served_tree() { .collect(); assert!(stray.is_empty(), "a publish that did not land left files behind: {stray:?}"); - // And the retry still works: the artifacts come from the collect dir, not the - // served tree. env.clear_publish_fault(); assert!( matches!(pipeline::run(&env.cfg, &env.db, &id).unwrap(), pipeline::Outcome::Succeeded { .. }), -- cgit v1.2.3