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/shims.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'tests/shims.rs') diff --git a/tests/shims.rs b/tests/shims.rs index d06a81e..5cc0167 100644 --- a/tests/shims.rs +++ b/tests/shims.rs @@ -7,7 +7,6 @@ use common::{corpus_root, env_with_fixture, shim_dir, Env, Web}; use aur_build::shims; -/// Run a shim binary with the harness protocol in the environment. fn shim(tool: &str, cwd: &Path, envs: &[(&str, &Path)], args: &[&str]) -> (i32, String, String) { let exe = shim_dir().join(tool); assert!(exe.exists(), "shim {tool} not built at {}", exe.display()); @@ -45,7 +44,6 @@ fn makechrootpkg_emits_pkginfo_buildinfo_and_sig() { let log = tmp.path().join("shimlog"); std::fs::create_dir_all(&log).unwrap(); - // Exactly the invocation §8.1 step 5 makes. let chroot_args = ["-c", "-r", "chroot", "--", "-siTESTKEY", "-f"]; let (code, out, err) = shim( "makechrootpkg", @@ -58,7 +56,6 @@ fn makechrootpkg_emits_pkginfo_buildinfo_and_sig() { let pkg = build.join("plain-make-1.0-1-x86_64.pkg.tar.zst"); assert!(pkg.exists(), "artifact left in the build dir like the real tool does"); let bytes = std::fs::read(&pkg).unwrap(); - // Read the artifact with the production parser, not a shim-only one (§6 M-4). let pkginfo = aur_build::pkginfo::pkginfo_text(&bytes).unwrap(); assert!(pkginfo.contains("pkgname = plain-make")); assert!(pkginfo.contains("pkgver = 1.0-1")); @@ -80,8 +77,6 @@ fn makechrootpkg_emits_pkginfo_buildinfo_and_sig() { #[test] fn makechrootpkg_refuses_a_missing_pkgbuild() { - // Step 0 materializes from the mirror; if that silently produced nothing, the - // fake tool must notice rather than build an empty package. let tmp = tempfile::tempdir().unwrap(); let build = tmp.path().join("build"); std::fs::create_dir_all(&build).unwrap(); @@ -140,7 +135,6 @@ fn repo_add_writes_a_pacman_database() { assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr)); assert!(db.exists(), "database written"); - // The db is a gzip'd tar with one DESC per package — what pacman downloads. let dec = flate2::read::GzDecoder::new(std::fs::File::open(&db).unwrap()); let mut ar = tar::Archive::new(dec); let names: Vec = ar @@ -170,8 +164,6 @@ fn repo_add_writes_a_pacman_database() { #[test] fn pacman_u_verifies_digests_and_q_reports_the_world() { - // The provisioning step's fail-closed world check runs against this fake: `-U` - // must refuse bytes that do not hash to the digest their name claims. let tmp = tempfile::tempdir().unwrap(); let log = tmp.path().join("shimlog"); std::fs::create_dir_all(&log).unwrap(); @@ -201,8 +193,6 @@ fn pacman_u_verifies_digests_and_q_reports_the_world() { assert_eq!(code, 0); assert!(out.contains("plain-make 1.0-1"), "the world check reads -Q: {out}"); - // A blob whose bytes do not match the digest its name claims is refused like a - // bad signature. let bad = tmp.path().join(aur_build::hash::hex(b"some other artifact")); std::fs::write(&bad, b"tampered").unwrap(); let (code, _, err) = shim( @@ -244,8 +234,6 @@ fn mkarchroot_creates_a_warm_root() { assert!(root.join("SHIM-ROOT").exists()); } -/// Every fixture in the corpus must be drivable through the shims: the executable -/// documentation of the §16 edge cases. #[test] fn every_fixture_is_drivable_through_the_shims() { let mut names = Vec::new(); @@ -314,8 +302,6 @@ fn every_fixture_is_drivable_through_the_shims() { } } -/// The corpus doubles as detection fixtures: each one must be detectable through -/// the real watcher against its local git repo. #[test] fn fixtures_are_detected_through_the_watcher() { for name in ["plain-make", "with-patch", "install-hooks", "skip-checksum", "split-pkgbase", "epoch-bump"] { @@ -343,7 +329,6 @@ fn shim_environment_reaches_child_processes_through_the_config() { cfg.hooks.shim_dir = Some(env.path("shimlog")); std::fs::create_dir_all(env.path("shimlog")).unwrap(); - // Prove the config is what puts the shims on PATH, not the test process env. let mut cmd = Command::new("sh"); cfg.child_env(&mut cmd); let out = cmd.args(["-c", "command -v makechrootpkg; echo $AUR_SHIM_MANIFEST"]).output().unwrap(); @@ -352,13 +337,6 @@ fn shim_environment_reaches_child_processes_through_the_config() { assert!(s.contains("manifest.json"), "{s}"); } -// repo-add's database filename. A shim must be as strict as the tool it stands in -// for: the pipeline used to render the index to `.tar.gz.tmp`, real repo-add -// rejects that as a usage error, and every publish test passed while the first -// real package died at the last step. - -/// Names pacman's repo-add accepts as its database argument, measured against -/// `repo-add (pacman) 7.1.0` rather than guessed from its docs. const REAL_ACCEPTED: [&str; 5] = [ "aur.db.tar", "aur.db.tar.gz", @@ -367,8 +345,6 @@ const REAL_ACCEPTED: [&str; 5] = [ "aur.db.tar.xz", ]; -/// Names it refuses — including the render target the pipeline used to use, and -/// the `.files.*` forms, which are `repo-files`' business and not repo-add's. const REAL_REJECTED: [&str; 5] = ["aur.db", "aur.db.gz", "aur.db.tar.gz.tmp", "aur.files.tar.gz", "aur"]; @@ -393,8 +369,6 @@ fn repo_add_shim_refuses_a_database_name_repo_add_refuses() { } } -/// The oracle, when the host has one: the shim's verdict must be the real tool's -/// verdict, name for name. #[test] fn repo_add_db_names_match_the_real_repo_add() { if Command::new("repo-add").arg("--version").output().is_err() { @@ -416,8 +390,6 @@ fn repo_add_db_names_match_the_real_repo_add() { } } -/// The regression itself, asserted on the pipeline rather than on the shim: what -/// filename does publish actually hand repo-add? #[test] fn publish_hands_repo_add_a_database_name_the_real_tool_accepts() { let web = Web::new("plain-make"); @@ -443,8 +415,6 @@ fn publish_hands_repo_add_a_database_name_the_real_tool_accepts() { "publish passed {db}, which repo-add would refuse" ); - // The render happens in a scratch directory beside the live database, under the - // name a consumer will download, and is gone once the rename lands. let arch = web.env.cfg.repo_arch_dir(); let leftovers: Vec = std::fs::read_dir(&arch) .unwrap() -- cgit v1.2.3