Repository navigation
fix(audit): report Warning on timeout/IO-error instead of empty Vec - #112
Conversation
|
PR #112 and #113 both fix pawan#103 and are NOT byte-identical — content diff below so the merge picks the right survivor. Shared core (identical in both)Both replace the
#112 is a superset of #113Verified via
RecommendationKeep #112, close #113 as the subset — the reverse of the size heuristic. #113's diff is #112 minus the not-json guard minus the tests. If the merger prefers #113's branch for history reasons, the not-json guard and the tests should be ported onto it first, or the advisory-DB-fetch failure mode ships without coverage. Note: both branches are unmerged; per the no-premature-close rule, pawan#103 stays OPEN until one of them merges and is verified on origin/main. |
Fixes CI Test(nextest) failure on PR #112: pawan-core defines its own `Result<T> = std::result::Result<T, PawanError>` alias (lib.rs:119) taking ONE generic arg. The new tests wrote `Result<Result<...>, ()>` with two args, which resolved to the crate alias and failed with E0107 (type alias takes 1 generic argument but 2 were supplied) + E0308. This only failed in CI because the broken code is in #[cfg(test)], which `cargo check` does not compile. Fixed by fully-qualifying both bindings as std::result::Result. Verified: cargo test -p pawan-core --lib healing::tests passes 45/45 including the three new audit tests.
|
Merge-ready status (one read): Code change (1 file, +232/−5): CI: Test(nextest) PASS, Doc PASS, macOS PASS. Check&Lint FAIL is the pre-existing async-trait 0.1.89 Merge: no conflicts (mergeable, merge-tree clean vs origin/main). The only blocker is the shared lint baseline. Note: PR #113 is a subset of this change (same core fix, minus the not-json guard, minus the tests). If only one lands, this one is the superset. |
Fixes CI Test(nextest) failure on PR #112: pawan-core defines its own `Result<T> = std::result::Result<T, PawanError>` alias (lib.rs:119) taking ONE generic arg. The new tests wrote `Result<Result<...>, ()>` with two args, which resolved to the crate alias and failed with E0107 (type alias takes 1 generic argument but 2 were supplied) + E0308. This only failed in CI because the broken code is in #[cfg(test)], which `cargo check` does not compile. Fixed by fully-qualifying both bindings as std::result::Result. Verified: cargo test -p pawan-core --lib healing::tests passes 45/45 including the three new audit tests.
ef37250 to
eaa1d77
Compare
Fixes pawan#103: AuditFixer::check previously returned Ok(Vec::new()) when cargo audit timed out after 120s or failed with an I/O error, making these paths indistinguishable from a clean audit. Changes: - Timeout path now returns Warning diagnostic with code "audit-timeout" - I/O error path now returns Warning diagnostic with code "audit-io-error" - Updated documentation to reflect all three code paths - Added tests to verify timeout/IO-error arms return proper warnings The Warning diagnostic prevents "✓ Project is healthy!" from firing after an incomplete security scan.
Fixes CI Test(nextest) failure on PR #112: pawan-core defines its own `Result<T> = std::result::Result<T, PawanError>` alias (lib.rs:119) taking ONE generic arg. The new tests wrote `Result<Result<...>, ()>` with two args, which resolved to the crate alias and failed with E0107 (type alias takes 1 generic argument but 2 were supplied) + E0308. This only failed in CI because the broken code is in #[cfg(test)], which `cargo check` does not compile. Fixed by fully-qualifying both bindings as std::result::Result. Verified: cargo test -p pawan-core --lib healing::tests passes 45/45 including the three new audit tests.
eaa1d77 to
f1ed5e8
Compare
Summary
Fixes pawan#103 (reopened — the prior "not reproducible" closure was verified incorrect against origin/main)
AuditFixer::check on origin/main returns
Ok(Vec::new())when cargo audit times out after 120s or fails with an I/O error (the_ => return Ok(Vec::new())catch-all at healing/mod.rs:393), making these paths indistinguishable from a clean audit.Changes
Problem
The original code returned an empty Vec for timeout and I/O error paths:
This caused "✓ Project is healthy!" to appear even when the security scan never completed.
Solution
Return a Warning diagnostic for these paths, which contributes to the warnings count and prevents the healthy gate from firing.
Testing
test_audit_timeout_arm_returns_warning_not_emptytest_audit_io_error_arm_returns_warning_not_emptytest_audit_timeout_counts_as_warning_in_count_issues_shapeThese tests verify the match arms return Warning diagnostics instead of empty Vecs.