Skip to content

Commit b995573

Browse files
committed
fix(release): honor --skip-build-validation for package completeness
The package-completeness preflight (every tracked runtime file must be present in the release ZIP) is a build-structure assertion, but it ran unconditionally even when the operator passed --skip-build-validation. The flag's documented contract is to bypass build-structure assertions in both preflight.package and package, so the completeness check now respects it via a should_validate_package_completeness() guard. Fixes #8189
1 parent 40ab44a commit b995573

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

src/core/release/execution_dispatch.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,18 @@ pub(super) fn execute_release_plan_step(
115115
context.options.skip_build_validation,
116116
)
117117
.and_then(|result| {
118-
executor::package_preflight::validate_package_completeness(
119-
context.component,
120-
std::path::Path::new(&context.component.local_path),
121-
&context.state.artifacts,
122-
)?;
118+
// `--skip-build-validation` bypasses build-structure
119+
// assertions in both `preflight.package` and `package`;
120+
// package-completeness is one such assertion (#8189).
121+
if executor::package_preflight::should_validate_package_completeness(
122+
context.options.skip_build_validation,
123+
) {
124+
executor::package_preflight::validate_package_completeness(
125+
context.component,
126+
std::path::Path::new(&context.component.local_path),
127+
&context.state.artifacts,
128+
)?;
129+
}
123130
Ok(result)
124131
})
125132
.unwrap_or_else(|err| failed_result("package", "package", err)),

src/core/release/executor/package_preflight.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ pub(crate) fn run_package_preflight(component_local_path: &str) -> Result<()> {
1515
super::lockfile_guard::guard_local_file_dependencies(component_path)
1616
}
1717

18+
/// Whether the package-completeness structure assertion should run.
19+
///
20+
/// `--skip-build-validation` is documented to bypass build-structure
21+
/// assertions in both `preflight.package` and `package`. Package-completeness
22+
/// (every tracked runtime file present in the ZIP) is such a structure
23+
/// assertion, so an explicit override must skip it rather than fail closed
24+
/// (#8189).
25+
pub(crate) fn should_validate_package_completeness(skip_build_validation: bool) -> bool {
26+
!skip_build_validation
27+
}
28+
1829
/// Confirm that the durable artifacts produced by the final package step
1930
/// include every tracked runtime file in the configured release scope.
2031
pub(crate) fn validate_package_completeness(
@@ -300,6 +311,16 @@ mod tests {
300311
.expect("excluded runtime file should not fail");
301312
}
302313

314+
#[test]
315+
fn skip_build_validation_bypasses_package_completeness() {
316+
// #8189: when the operator passes --skip-build-validation, the
317+
// package-completeness structure assertion must not run, matching the
318+
// documented CLI contract.
319+
assert!(!should_validate_package_completeness(true));
320+
// Default release behavior still enforces completeness.
321+
assert!(should_validate_package_completeness(false));
322+
}
323+
303324
fn run_git(repo: &Path, args: &[&str]) {
304325
let output = Command::new("git")
305326
.args(args)

0 commit comments

Comments
 (0)