diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 17:16:23 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 17:16:23 +0000 |
| commit | 8bb76cb266a2fef5d5fe43c0f9643101f59112aa (patch) | |
| tree | ef421aa194b3cac2ab9e2662fcf41ce551260138 /src/pipeline | |
| parent | e7922f3dd1d985dcb993b624146b2492183f3a11 (diff) | |
| download | aur-build-8bb76cb266a2fef5d5fe43c0f9643101f59112aa.tar.gz aur-build-8bb76cb266a2fef5d5fe43c0f9643101f59112aa.zip | |
config: the test hooks are a gated submodule, not the production surface
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.
Diffstat (limited to 'src/pipeline')
| -rw-r--r-- | src/pipeline/publish.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pipeline/publish.rs b/src/pipeline/publish.rs index 4f21e72..d70ba8d 100644 --- a/src/pipeline/publish.rs +++ b/src/pipeline/publish.rs @@ -117,7 +117,9 @@ pub fn publish(ctx: &Ctx) -> Result<i64> { // Fault injection so I4 can be tested for real: die between the tmp write // and the rename, and the old index must still be what consumers get. - if ctx.cfg.publish_fault.as_deref() == Some("before-rename") { + // Compiled out of a production build (ยง6 M-9). + #[cfg(feature = "test-support")] + if ctx.cfg.hooks.publish_fault.as_deref() == Some("before-rename") { return Err(Error::other("injected fault: before-rename")); } @@ -148,7 +150,8 @@ pub fn publish(ctx: &Ctx) -> Result<i64> { "unblocked_builds": unblocked, }), )?; - if ctx.cfg.publish_fault.as_deref() == Some("after-rename") { + #[cfg(feature = "test-support")] + if ctx.cfg.hooks.publish_fault.as_deref() == Some("after-rename") { return Err(Error::other("injected fault: after-rename")); } Ok(release_id) |
