From e757979f1a2afdbe7146066345bb9acd19d3b151 Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:09:59 +0000 Subject: comments: say why, not what MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath. --- tests/pipeline.rs | 55 +++++++++++++++++++++---------------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) (limited to 'tests/pipeline.rs') diff --git a/tests/pipeline.rs b/tests/pipeline.rs index d4ef724..6dd1df5 100644 --- a/tests/pipeline.rs +++ b/tests/pipeline.rs @@ -1,6 +1,3 @@ -//! End-to-end pipeline tests driven entirely by the toolchain shims (§16a): -//! no root, no network, no real chroot — but the *real* step machine runs. - mod common; use aur_build::db::{self, builds, model::*}; @@ -86,11 +83,9 @@ fn end_to_end_publishes_a_signed_index() { #[test] fn the_build_never_signs_ingest_does() { - // Signing moved hub-side: the build environment is a sandbox that must - // never hold the key, so the build command carries no `-si` and the - // signature over each artifact is made at ingest by the hub's own gpg. - // This is the property that makes a remote build sandbox safe to run at - // all — worst the sandbox ever returns is unsigned bytes. + // 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 { .. })); @@ -119,10 +114,8 @@ fn the_build_never_signs_ingest_does() { #[test] fn a_tampered_store_artifact_fails_the_lease_closed() { - // dep-client depends on plain-make, so its lease pins plain-make's exact - // artifact. Corrupt the store bytes after publication: provisioning - // re-hashes everything it stages and must refuse, not build against bytes - // that are not what the index — and the review behind it — approved. + // 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 { .. })); @@ -152,9 +145,8 @@ fn a_tampered_store_artifact_fails_the_lease_closed() { other => panic!("{other:?}"), } - // Restore the bytes and resume: the lease verifies, the sandbox's own - // `pacman -Q` confirms the pinned world landed, and the build completes — - // which is the happy provisioning path proven end to end as well. + // 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 { .. }), @@ -281,9 +273,8 @@ 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, never a half-written index (I4). + // 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!( @@ -310,8 +301,8 @@ 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. Steps 0-8 are checkpointed as - // succeeded, so only publish re-runs — the expensive step is not repeated. + // "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), @@ -373,8 +364,8 @@ 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: that is exactly - // "unresolvable" in §10.4, and the answer is to wait, not to fail. + // 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); @@ -397,9 +388,8 @@ 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 — a busy loop that - // burns a claim and a plan step each tick — so it must stay put. + // 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); @@ -489,9 +479,8 @@ 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 we build the bad state from - // the other side: a release with nothing behind it. A rebuild of it must - // still refuse to publish — the guard is on publishing, not on noticing. + // 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(); @@ -531,8 +520,7 @@ 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, - // so an operator who clicked twice got a green result and no explanation. + // 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); @@ -549,8 +537,7 @@ fn withdrawing_a_release_twice_is_refused_the_second_time() { #[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 — files no index - // names, sitting in the directory consumers download from. + // 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"); @@ -567,8 +554,8 @@ 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 - // from the served tree, so cleaning up costs nothing but the copy. + // 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