From 8bb76cb266a2fef5d5fe43c0f9643101f59112aa Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 17:16:23 +0000 Subject: config: the test hooks are a gated submodule, not the production surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Seven fields sat on `Config` next to `signing_key_id` and `bind`: a PATH override, three shim protocol variables, a fault-injection point in the middle of `publish()`, and two more shims could obey. m-9's complaint was not that they exist — the shims are how I4, I5 and I9 are tested for real, and a mock would have asserted the mock's own behaviour — but that nothing said which of these was production and which was scaffolding, and the publish path carried a test branch on every real publish. They are one `TestHooks` submodule now, documented as what it is, and the whole submodule is `#[cfg(feature = "test-support")]` — the same feature that already gates the shims and the raw SQL escape hatch, and which only this crate's own dev-dependency turns on. A production build has no `hooks` field, no shim protocol in `child_env`, and no fault-injection branch in `publish()`; the serialized config skips the section entirely when nothing is hooked, so a real `config.json` never mentions any of it. `TestHooks::is_empty()` names the state a real process runs in, and three tests hold the line: the hook fields may be declared exactly once and only inside `TestHooks`, every `publish_fault` read in `publish.rs` must sit behind the feature gate, and a default config serializes without a trace of hooks. --- tests/dispatch.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/dispatch.rs') diff --git a/tests/dispatch.rs b/tests/dispatch.rs index d0d4bd7..e62b351 100644 --- a/tests/dispatch.rs +++ b/tests/dispatch.rs @@ -202,7 +202,7 @@ fn a_reaped_build_resumes_at_the_next_incomplete_step_with_no_duplicate_work() { pipeline::run(&env.cfg, &env.db, &id).unwrap(), pipeline::Outcome::Failed { .. } )); - let builds_before = aur_build::shims::called_with(&env.cfg.shim_dir.clone().unwrap(), "makechrootpkg", ""); + let builds_before = aur_build::shims::called_with(&env.cfg.hooks.shim_dir.clone().unwrap(), "makechrootpkg", ""); // The worker "died" at publish: the row is leased with a lease nobody will // extend. A fresh dispatcher reaps it and a worker finishes from the @@ -223,7 +223,7 @@ fn a_reaped_build_resumes_at_the_next_incomplete_step_with_no_duplicate_work() { assert_eq!(state, BuildState::Succeeded, "the resumed build did not finish"); assert_eq!( - aur_build::shims::called_with(&env.cfg.shim_dir.clone().unwrap(), "makechrootpkg", ""), + aur_build::shims::called_with(&env.cfg.hooks.shim_dir.clone().unwrap(), "makechrootpkg", ""), builds_before, "I5: resuming must not rebuild" ); -- cgit v1.2.3