fix(core): carry duplicates through the import audit event

success no longer includes dedup-skipped mail, so without a
duplicates field ImportPerformed consumers could not tell an
all-duplicates batch from one that silently lost everything. Also
documents that ExtractOutcome::Imported covers mail dropped by
archive rules, which has always counted as a success.
This commit is contained in:
sripwoud
2026-08-18 21:59:34 +02:00
parent 8eac80e15c
commit fa98f161c6
3 changed files with 7 additions and 2 deletions

View File

@@ -46,8 +46,10 @@ use crate::{
utils::{compute_content_hash, hex_hash, html::extract_text},
};
/// The outcome of extracting an envelope: either the message was imported,
/// or it was skipped because its content hash was already archived.
/// The outcome of extracting an envelope. `Duplicate` means the message was
/// skipped because its content hash was already archived. `Imported` covers
/// every other processed message, including mail dropped by archive rules,
/// which has always counted as a success on the import surfaces.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[must_use]
pub enum ExtractOutcome {

View File

@@ -209,6 +209,7 @@ pub enum Event {
format: String,
total: u64,
success: u64,
duplicates: u64,
failed: u64,
},
MailboxRemoved {

View File

@@ -77,6 +77,7 @@ impl ImportApi {
format: "eml".to_string(),
total: result.total as u64,
success: result.success as u64,
duplicates: result.duplicates as u64,
failed: result.failed as u64,
});
@@ -274,6 +275,7 @@ impl ImportApi {
format: format_str.clone(),
total: 0,
success: 0,
duplicates: 0,
failed: 0,
});
tokio::task::spawn_blocking(move || {