Files
AutopilotMonitor/src
Oliver Kieselbach 8e26eb15e6 fix(rules): make detection-failure result actionable for end users
Session 080edee9 follow-up — the analyze cards the user saw on re-analysis
were neither accurate (Slow Network / App Download Stalled both fired as
false positives) nor specific (Enrollment Failed never named the offending
app; ANALYZE-APP-013 never fired). Five coordinated changes, all
version-bumped so EnsureBuiltInRulesSeededAsync re-imports them on the next
backend boot — the title/severity/version-check filter does not pick up
condition-only diffs:

ANALYZE-APP-013 v1.1.0 — fire on legacy + new agent shape:
  Previous rule keyed on `failureType == esp_apps_detection_failure`,
  which is only emitted by agents that shipped AFTER 4dd050e0. Historical
  sessions (and any agent on the old build) won't match.
  Replace with a precondition + condition pair that works for BOTH:
    * precondition: esp_failure_settle_started.errorCode == 0x87d1041c
      (V2 ProvisioningStatusTracker emits this on every Apps subcategory
      failure with that HRESULT, regardless of agent version)
    * required: app_install_failed.detectionResult == NotDetected
      (ImeLogTracker sets this from the IME's DetectionActionHandler line
      across all V2 agents)
    * optional: esp_failure_settle_started.errorCode (for {{errorCode}}
      interpolation; appName comes via auto-field from the required match)

ANALYZE-ENRL-001 v1.1.0 — restore appName + cross-link to APP-013:
  My previous trim dropped the failed_app condition on the theory that the
  auto-field path would carry it. That was wrong — auto-fields come from
  the FIRST matched condition's evidence, which here is `enrollment_failed`
  (no appName). Add back the optional failed_app condition with
  dataField=appName so byField resolves {{appName}}. Explanation now leads
  with the failed app, lists reason/subcategory/errorCode, and cross-links
  to the actionable ANALYZE-APP-013 instead of "see other rule results".

ANALYZE-CORR-001 v1.1.0 ("Slow Network") — version bump for DB sync:
  Was already enabled:false in source but the DB still had it enabled (the
  seed mechanism only resyncs on title/severity/trigger/version diff, so
  the source `enabled` flip never propagated). Bump version → next deploy
  resyncs. Also adds a suppressByEvent on the app_failed condition so a
  later app_install_completed for the same appId suppresses the match (a
  retry that succeeded shouldn't count as failure).

ANALYZE-APP-009 v1.1.0 ("App Download Stalled") — same version bump for
DB sync + documents why a status-aware suppression isn't expressible yet:
  The V2 EnrollmentTerminationHandler synthesizes
  `download_progress: failed` events for promoted-stuck apps AFTER the
  real `download_progress: 100%` event already landed. The engine's
  suppressByEvent can't filter on a third event's status field, so
  status-aware suppression has to wait for either an engine extension or
  a dedicated `download_stalled` event type.

RuleEngineDetectionFailureTests — 6 new tests:
  * APP-013 fires on the historical 080edee9 event shape
  * APP-013 does NOT fire for non-Apps subcategory HRESULTs
  * APP-013 does NOT fire without esp_failure_settle_started (precondition)
  * ENRL-001 MatchedConditions carries appName + errorCode + subcategory
    + reason from three distinct event types (interpolator material)
  * CORR-001 + APP-009 shipped as disabled

Coverage: 2064/2064 backend, 413/413 web.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 15:53:02 +02:00
..