From ef0f1db706b8099eabc94fcb429a6a12105c7444 Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Tue, 5 May 2026 08:08:30 -0400 Subject: [PATCH] fix(output): add missing surface field to test Finding constructors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #54 and #55 were merged ~30s apart on main. #55 added a new `surface` field to `Finding` (with `#[serde(default)]` on the field but no default on the struct itself), and #54 was merged without rebasing onto post-#55 main. The new field is required at construction time, so the test helpers in `src/output/json.rs` and `src/output/text.rs` introduced by #54 no longer compile against the post-#55 struct shape. Both PRs passed CI on their own branches because each was tested against the main they branched from — neither saw the other's changes. No textual conflict, but a semantic one: `cargo build` still succeeds (lib target only references the field via serde), but `cargo clippy --all-targets` and `cargo test` fail with E0063 on the lib-test target. Fix is mechanical: add `surface: Surface::Backend` to the two test helpers, matching the convention already used elsewhere in the codebase (src/scanner/matcher.rs, src/rego/grouping.rs, etc). Followup: the repo ruleset on `main` doesn't include a `required_status_checks` rule, so neither "CI must pass" nor "branches must be up to date before merging" is currently enforced — that's why this slipped through. Tracked separately. --- src/output/json.rs | 3 ++- src/output/text.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output/json.rs b/src/output/json.rs index 6dcc360..d97ee8a 100644 --- a/src/output/json.rs +++ b/src/output/json.rs @@ -111,7 +111,7 @@ impl From for crate::error::ZiftError { #[cfg(test)] mod tests { use super::*; - use crate::types::{AuthCategory, Confidence, Language, ScanPass}; + use crate::types::{AuthCategory, Confidence, Language, ScanPass, Surface}; use std::path::PathBuf; fn finding() -> Finding { @@ -128,6 +128,7 @@ mod tests { pattern_rule: None, rego_stub: None, pass: ScanPass::Structural, + surface: Surface::Backend, } } diff --git a/src/output/text.rs b/src/output/text.rs index 6444b14..ec61246 100644 --- a/src/output/text.rs +++ b/src/output/text.rs @@ -124,7 +124,7 @@ pub fn print( #[cfg(test)] mod tests { use super::*; - use crate::types::{AuthCategory, Confidence, Finding, Language, ScanPass}; + use crate::types::{AuthCategory, Confidence, Finding, Language, ScanPass, Surface}; use std::path::PathBuf; fn finding(confidence: Confidence) -> Finding { @@ -141,6 +141,7 @@ mod tests { pattern_rule: None, rego_stub: None, pass: ScanPass::Structural, + surface: Surface::Backend, } }