Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub fn derive_findings(snapshot: &StoreAnalysis) -> Vec<IntuneFinding> {
push_license_failure(snapshot, &mut findings);
push_download_failure(snapshot, &mut findings);
push_registration_failure(snapshot, &mut findings);
push_installer_failure(snapshot, &mut findings);
push_provisioning_failure(snapshot, &mut findings);
push_uninstall_failure(snapshot, &mut findings);
push_no_interactive_user(snapshot, &mut findings);
Expand All @@ -40,6 +41,7 @@ pub fn derive_findings(snapshot: &StoreAnalysis) -> Vec<IntuneFinding> {
push_device_failure_without_intune_intent(snapshot, &mut findings);
push_ambiguous_display_name(snapshot, &mut findings);
push_unknown_event_version(snapshot, &mut findings);
push_event_level_mismatch(snapshot, &mut findings);
push_malformed_source(snapshot, &mut findings);
push_evidence_coverage_gap(snapshot, &mut findings);
push_install_completed(snapshot, &mut findings);
Expand Down Expand Up @@ -252,6 +254,37 @@ fn push_registration_failure(snapshot: &StoreAnalysis, findings: &mut Vec<Intune
);
}

/// A Store-delivered Win32 package whose own installer reported failure.
///
/// Kept apart from the registration rule because the failing grammar is a
/// plain Windows installer: AppX dependency/framework remediation does not
/// apply, and suggesting it here would be the cross-family collapse this
/// module exists to prevent.
fn push_installer_failure(snapshot: &StoreAnalysis, findings: &mut Vec<IntuneFinding>) {
let affected = transactions_in_state(snapshot, StoreTransactionState::InstallerFailure);
if affected.is_empty() {
return;
}
push_finding(
findings,
"store-win32-installer-failed",
IntuneFindingSeverity::Error,
IntuneFindingConfidence::High,
"Store-delivered Win32 installer reported failure",
format!(
"The installer for {} ran and reported failure. This is the package's own Windows installer, not an AppX deployment stage.{}",
labels(&affected),
error_suffix(&affected)
),
&[
"Read the cited exit code against the installer's own documentation (MSI or setup engine), not against AppX deployment errors",
"Collect the installer's own log for the failing run",
],
evidence_of(&affected),
Vec::new(),
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}

fn push_provisioning_failure(snapshot: &StoreAnalysis, findings: &mut Vec<IntuneFinding>) {
let affected = transactions_in_state(snapshot, StoreTransactionState::ProvisioningFailure);
if affected.is_empty() {
Expand Down Expand Up @@ -499,13 +532,24 @@ fn push_ambiguous_display_name(snapshot: &StoreAnalysis, findings: &mut Vec<Intu

// ── Coverage rules ──────────────────────────────────────────────────────────

/// Canonical citation list: sorted and de-duplicated, so a record supplied
/// twice is one citation and neither the rendered count nor the citation
/// order depends on artifact permutation or duplication.
fn normalized_refs(refs: impl Iterator<Item = IntuneEvidenceRef>) -> Vec<IntuneEvidenceRef> {
let mut evidence: Vec<IntuneEvidenceRef> = refs.collect();
evidence.sort();
evidence.dedup();
evidence
}

fn push_unknown_event_version(snapshot: &StoreAnalysis, findings: &mut Vec<IntuneFinding>) {
let evidence = snapshot
.observations
.iter()
.filter(|observation| observation.unknown_version)
.map(|observation| observation.context.evidence_ref.clone())
.collect::<Vec<_>>();
let evidence = normalized_refs(
snapshot
.observations
.iter()
.filter(|observation| observation.unknown_version)
.map(|observation| observation.context.evidence_ref.clone()),
);
if evidence.is_empty() {
return;
}
Expand All @@ -525,6 +569,40 @@ fn push_unknown_event_version(snapshot: &StoreAnalysis, findings: &mut Vec<Intun
);
}

/// A *known* event whose level contradicts the outcome its event id states.
///
/// Deliberately a separate finding from `store-unknown-event-version`: there
/// the dialect is unrecognized and nothing was interpreted; here the dialect is
/// fully understood and the record contradicts itself. Both degrade the
/// touched transaction's confidence, but for different reasons and with
/// different remediations, so conflating them would hide which one happened.
fn push_event_level_mismatch(snapshot: &StoreAnalysis, findings: &mut Vec<IntuneFinding>) {
let evidence = normalized_refs(
snapshot
.observations
.iter()
.filter(|observation| observation.level_mismatch)
.map(|observation| observation.context.evidence_ref.clone()),
);
if evidence.is_empty() {
return;
}
push_finding(
findings,
"store-event-level-mismatch",
IntuneFindingSeverity::Info,
IntuneFindingConfidence::High,
"A known event's level contradicts its stated outcome",
format!(
"{} record(s) carry a recognized failure event id but were logged at Information level. The stated outcome was kept and the level was not promoted into evidence; any transaction they touch is reported at reduced confidence.",
evidence.len()
),
&["Compare the rendered event text with the event id's documented meaning; the export may have altered the level"],
evidence,
Vec::new(),
);
}

fn push_malformed_source(snapshot: &StoreAnalysis, findings: &mut Vec<IntuneFinding>) {
let gaps = snapshot
.coverage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,31 @@ pub struct StoreObservation {
pub app_id: Option<String>,
pub execution_context: StoreExecutionContext,
pub action: StoreDeploymentAction,
/// The source's own operation-correlation token — for a Windows event, the
/// ETW activity id. This is the only linkage that can tie a success record
/// to an earlier failure as one operation: record order alone proves
/// chronology, not linkage (ADR-003), so the reducer requires a shared
/// activity id before a later success may supersede a failure. Absent for
/// sources whose grammar carries no such token (IME text, supplied facts).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub activity_id: Option<String>,
/// Intune's typed assignment intent, present only when this observation is
/// a typed assignment. This is the authoritative statement of intent: the
/// reducer reads intent from here and never from caller-writable
/// `named_data` (ADR-001).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub typed_intent: Option<StoreAssignmentIntent>,
pub error: Option<IntuneErrorCode>,
/// True when the record came from a recognized provider but an event id or
/// schema version this build has no rule for.
pub unknown_version: bool,
/// True when a *known* event's level contradicts the outcome its event id
/// states (a failure id logged at Information level). Deliberately a
/// separate flag from [`Self::unknown_version`]: an unrecognized dialect
/// and a self-contradictory known record degrade confidence for distinct
/// reasons, and conflating them would hide which one happened.
#[serde(default, skip_serializing_if = "core::ops::Not::not")]
pub level_mismatch: bool,
#[serde(default)]
pub named_data: Vec<IntuneNamedValue>,
/// Verbatim record or rendered event text. Redacted by the export
Expand Down
Loading