From 753e05a4f588d3e8a3ea0b88b2e03d74f9f00be8 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 15:33:32 +0000 Subject: pipeline: the name we publish comes from the real .PKGINFO parser, and the shims are test-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `publish.rs::package_name` — the function that decides which package a built artifact is, and therefore what the index says — called into the test harness (`shims::read_pkginfo`) to read it. Worse, the shim module carried its own `.PKGINFO` field parser alongside the real one in `pkginfo.rs`. Two parsers that can drift is a supply-chain-shaped foot-gun in a system whose whole job is provenance: the bytes we sign and the bytes the tests believed in would be interpreted by different code, and a green shim test would not have meant the pipeline read the package the same way. There is now one parser. `package_name` uses `pkginfo::pkginfo_text` and `pkginfo::parse_pkginfo`; the shim's `repo-add` renders its `DESC` entry from the same `PkgInfo` the production code parses, so the fake tool and the real pipeline cannot disagree about what a package calls itself. The duplicate parser and the two wrapper functions are deleted, and the harness test reads its artifact with `pkginfo` too. The module itself is now test-only in the way the review asked for. `pub(crate)` was not available — the shim binaries are separate crates that link the library — so the equivalent enforcement is used instead: `shims` is compiled out unless the `test-support` feature is on, and every shim binary declares `required-features = ["test-support"]`. A production `cargo build --release` neither builds the fakes nor links their code; `cargo build --bin makepkg` says so out loud. `tests/production_surface.rs` covers the half the compiler cannot see: no module in `src/` outside the harness may name `shims::`, and the binaries must keep declaring the feature. --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 445ae2f..f0ba1a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,6 +18,15 @@ pub mod pkginfo; pub mod pkgver; pub mod recipe; pub mod review; +/// The §16a fake toolchain: stand-ins for `makepkg`, `mkarchroot`, `gpg`, +/// `repo-add` and `pacman` so the whole step machine runs without root, network +/// or an Arch chroot. +/// +/// Test-only, and compiled out of a production build (§6 M-4): the module exists +/// only under the `test-support` feature, which nothing but this crate's own +/// dev-dependency enables, and the shim binaries declare the same feature. A +/// binary an operator runs cannot fake a build tool it cannot see. +#[cfg(feature = "test-support")] pub mod shims; pub mod time; pub mod watch; -- cgit v1.2.3