fix(scan): a failed run says why in plain words, never with a raw error
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m53s

A failed scan run stored the error it stopped on, verbatim: git2, I/O or
database errors that can carry server paths and internal details, in
English, on the German UI.

A failed run now records a stable error_code (repository unreachable,
archive password required or wrong, interrupted, internal) and a plain
English error_message; the raw error stays in the log, where it already
was. The dashboard words the code in German or English with what to do
next. A run interrupted by a restart shows only its existing hint. Runs
recorded before codes existed keep their stored message.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-09-26 12:48:35 +02:00
1 parent e09c0d0a9d
commit 83bfa3edd3
7 files changed
+162 -3

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ pub use pentest::{
};
pub use repository::ScanTrigger;
pub use sbom::{SbomEntry, VulnRef};
pub use scan::{ScanPhase, ScanRun, ScanRunStatus, ScanType, SkipCode, SkippedStage};
pub use scan::{RunErrorCode, ScanPhase, ScanRun, ScanRunStatus, ScanType, SkipCode, SkippedStage};
pub use werkbank::{
CompleteRequest, CompleteResponse, DastCollect, Executor, HeartbeatAck, HeartbeatRequest,
InputRef, Job, JobCollect, JobRecord, JobResult, JobRuntime, JobStatus, JobType, LeaseRequest,
+23
View File
@@ -112,7 +112,13 @@ pub struct ScanRun {
pub current_phase: ScanPhase,
pub phases_completed: Vec<ScanPhase>,
pub new_findings_count: u32,
/// Why a failed run failed, in plain English; never a raw error or a
/// server path (those go to the log).
pub error_message: Option<String>,
/// Why a failed run failed, as a stable code for the dashboard to word;
/// absent on runs recorded before it existed.
#[serde(default)]
pub error_code: Option<RunErrorCode>,
#[serde(with = "super::serde_helpers::bson_datetime")]
pub started_at: DateTime<Utc>,
#[serde(default, with = "super::serde_helpers::opt_bson_datetime")]
@@ -177,6 +183,22 @@ pub enum SkipCode {
CveLookupIncomplete,
}
/// Why a scan run failed, stable for the dashboard to word.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum RunErrorCode {
/// The repository could not be cloned or fetched (address, access, network).
RepositoryUnreachable,
/// A password-protected archive without a password.
ArchivePasswordRequired,
/// An archive whose stored password is wrong.
ArchivePasswordWrong,
/// The agent restarted while the run was going.
Interrupted,
/// Anything else; the details are in the agent's log.
Internal,
}
/// A pipeline stage that was planned but intentionally not executed.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct SkippedStage {
@@ -232,6 +254,7 @@ impl ScanRun {
phases_completed: Vec::new(),
new_findings_count: 0,
error_message: None,
error_code: None,
started_at: Utc::now(),
completed_at: None,
skipped_stages: Vec::new(),