openapi: 3.1.0 info: title: Dexwize Analysis (rules-engine and correlation-engine) version: 1.0.0 description: > Deterministic findings for E04 (performance analysis and root cause) and E05 (conflicts and crash correlation). Every request needs a bearer token from identity-service; the tenant comes only from the token. Findings of other tenants and their devices return 404. Every finding links to its evidence. rules-engine serves /v1/rules, /v1/analysis/*; correlation-engine serves /v1/correlations/*; both serve /v1/findings. servers: - url: https://api.dexwize.example security: - bearer: [] paths: /v1/rules: get: summary: Loaded detection pack and rules (FindingsRead) operationId: listRules responses: '200': description: Pack identity and rules content: application/json: schema: $ref: '#/components/schemas/RulePack' '403': description: Missing FindingsRead /v1/analysis/runs: post: summary: Evaluate all rules over the caller's fleet and store findings (FindingsRead; audited) operationId: runRules responses: '200': description: Run summary content: application/json: schema: $ref: '#/components/schemas/RunResult' '403': description: Missing FindingsRead /v1/analysis/fleet/consumers: get: summary: Fleet top resource consumers and startup-impact models (FindingsRead) operationId: fleetConsumers responses: '200': description: Fleet report content: application/json: schema: type: object properties: devices: type: integer topConsumers: type: array items: $ref: '#/components/schemas/FleetConsumer' startupModels: type: array items: $ref: '#/components/schemas/StartupModel' /v1/analysis/devices/{deviceId}/resources: get: summary: Top CPU, memory, disk and network consumers and startup impact for one device (DevicesRead) operationId: deviceResources parameters: - name: deviceId in: path required: true schema: type: string format: uuid responses: '200': description: Device report content: application/json: schema: type: object properties: resources: $ref: '#/components/schemas/DeviceResourceReport' startup: oneOf: - $ref: '#/components/schemas/StartupImpact' - type: 'null' '403': description: Missing DevicesRead '404': description: Unknown device or another tenant's device /v1/correlations/runs: post: summary: Run fleet correlation (FindingsRead; audited) description: >- Crash and hang association with installed app versions (correlation.crash_app_association), plus app and app-pair CPU impact (correlation.app_cpu_impact, correlation.app_pair_cpu_impact). All correlation findings are replaced together. operationId: runCorrelation responses: '200': description: Run summary content: application/json: schema: $ref: '#/components/schemas/RunResult' /v1/correlations/crash-associations: get: summary: Every app version tested, with crash rates and adjusted p-values (FindingsRead) operationId: crashAssociations responses: '200': description: Associations, most significant first content: application/json: schema: type: array items: $ref: '#/components/schemas/CrashAssociation' /v1/correlations/cpu-impact: get: summary: Every app and app pair compared for CPU impact, with cohort means and adjusted p-values (FindingsRead) operationId: cpuImpactAssociations responses: '200': description: Comparisons, most significant first content: application/json: schema: type: array items: $ref: '#/components/schemas/PerformanceAssociation' /v1/findings: get: summary: List findings (FindingsRead) operationId: listFindings parameters: - name: status in: query schema: $ref: '#/components/schemas/FindingStatus' - name: severity in: query schema: $ref: '#/components/schemas/Severity' - name: type in: query schema: type: string - name: source in: query schema: type: string enum: - rules - correlation - name: deviceId in: query schema: type: string format: uuid - name: limit in: query schema: type: integer minimum: 1 maximum: 500 default: 100 - name: offset in: query schema: type: integer minimum: 0 default: 0 responses: '200': description: Findings without per-device instances, most severe first content: application/json: schema: type: array items: $ref: '#/components/schemas/Finding' /v1/findings/{id}: get: summary: One finding with every affected device and its evidence (FindingsRead) operationId: getFinding parameters: - name: id in: path required: true schema: type: string format: uuid responses: '200': description: Finding with instances content: application/json: schema: $ref: '#/components/schemas/Finding' '404': description: Not found or another tenant's finding /v1/analysis/fleet/boot-trend: get: summary: Daily median boot and sign-in times for the caller tenant fleet, per measurement method (ReportsRead) description: >- Computed from the analysis facts window (7 days). Precise boot-phase timings and System-log estimates are separate points and must not be compared. operationId: fleetBootTrend responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/BootTrendPoint' '401': description: Missing or invalid token '403': description: Missing ReportsRead components: securitySchemes: bearer: type: http scheme: bearer bearerFormat: JWT schemas: Severity: type: string enum: - Info - Low - Medium - High - Critical RootCause: type: string enum: - Software - Configuration - Hardware FindingStatus: type: string enum: - Open - Acknowledged - Resolved - Suppressed Evidence: type: object required: - ref - source - deviceId - field - value properties: ref: type: string description: device/batch/{batch}/record/{index}, device/profile, or device/{table}/{rowKey} source: type: string enum: - telemetry_record - device_profile - analytics_row deviceId: type: string format: uuid batchId: type: - string - 'null' format: uuid recordIndex: type: - integer - 'null' table: type: - string - 'null' rowKey: type: - string - 'null' field: type: string description: What was observed, for example installed, process, boot_duration_ms value: type: string description: The observed value that made the rule match, as a sentence (kept for compatibility and audit; display at and details) at: type: - string - 'null' format: date-time description: >- When it happened: the event time (crash, boot, call) or the start of the sampling window. Recovered from value for evidence stored before this field existed; null when there is no time (inventory, settings, device profile). details: oneOf: - $ref: '#/components/schemas/EvidenceDetails' - type: 'null' EvidenceDetails: type: object description: >- Structured facts behind an evidence value. Every value is a string (numbers in invariant culture); only facts the device reported are present. additionalProperties: type: string properties: kind: type: string description: Reliability event kind (app_crash, app_hang, blue_screen, kernel_panic, service_failure) app: type: string description: Application, process or service name as reported by the device version: type: string publisher: type: string code: type: string description: Code reported with a reliability event codeType: type: string enum: - exception - bugcheck - macos_report - signal - event_id - other description: >- What code is: a Windows exception code (0xc0000005), a Windows stop code, a macOS diagnostic report type (309/109 crash, 298/228 hang, 210 kernel panic), a Linux signal (SIGSEGV) or a Service Control Manager event id cpuPercent: type: string memoryMb: type: string megabytes: type: string windowSecs: type: string durationMs: type: string method: type: string description: How a boot was measured fleetMedianMs: type: string fleetDevices: type: string failures: type: string lookups: type: string quality: type: string description: Call quality (good, fair, poor) setting: type: string description: Application setting key (app.setting) state: type: string description: on/off for a setting, running for a service Observations: type: object description: >- Distinct events behind a finding (crashes, hangs, boots, calls, DNS failure windows): each event counts once even when the agent sent it in more than one batch. required: - count - firstAt - lastAt properties: count: type: integer minimum: 1 firstAt: type: string format: date-time lastAt: type: string format: date-time RuleCondition: type: object description: A combinator (match all/any with conditions) or one comparison of a feature with a constant properties: match: type: - string - 'null' enum: - all - any - null conditions: type: - array - 'null' items: $ref: '#/components/schemas/RuleCondition' feature: type: - string - 'null' arg: type: - string - 'null' op: type: - string - 'null' enum: - gte - gt - lte - lt - eq - neq - null value: type: - number - 'null' text: type: - string - 'null' windowHours: type: - integer - 'null' description: Look-back of features with their own window (repeated crashes 168, DNS 24); others use the analysis window RuleInfo: type: object description: The rule behind a rule finding, as the loaded detection pack has it required: - id - version - ruleVersion - title - description - condition - confidence properties: id: type: string version: type: integer ruleVersion: type: string title: type: string description: type: string explanation: type: - object - 'null' properties: en: type: string ar: type: string condition: $ref: '#/components/schemas/RuleCondition' confidence: type: object description: confidence = min(max, base + perUnit x how far the primary condition is past its threshold) properties: base: type: number perUnit: type: number max: type: number Instance: type: object required: - deviceId - confidence - evidence properties: deviceId: type: string format: uuid confidence: type: number minimum: 0 maximum: 1 groupKey: type: - string - 'null' evidence: type: array minItems: 1 description: One item per observation; an event the agent sent in more than one batch appears once items: $ref: '#/components/schemas/Evidence' observations: oneOf: - $ref: '#/components/schemas/Observations' - type: 'null' Finding: type: object required: - id - source - type - title - severity - confidence - needsReview - ruleVersion - rootCause - category - remediationHint - affectedDeviceCount - evidenceRefs - status - firstDetectedAt - lastDetectedAt properties: id: type: string format: uuid description: Stable for the same tenant, type and group key source: type: string enum: - rules - correlation type: type: string description: Rule id, or correlation.crash_app_association, correlation.app_cpu_impact, correlation.app_pair_cpu_impact title: type: string severity: $ref: '#/components/schemas/Severity' confidence: type: number minimum: 0 maximum: 1 needsReview: type: boolean description: True when confidence is below 0.6 ruleVersion: type: string description: id@version+sha256 prefix of the rule file, or the algorithm version rootCause: $ref: '#/components/schemas/RootCause' category: type: string remediationHint: type: string description: Key for localized remediation guidance hardwareRecommendation: type: - string - 'null' enum: - upgrade_ram - replace_hdd_with_ssd - replace_battery - replace_device - null groupKey: type: - string - 'null' description: For example the exact app-version set in a conflict affectedDeviceCount: type: integer minimum: 1 evidenceRefs: type: array minItems: 1 maxItems: 200 items: type: string status: $ref: '#/components/schemas/FindingStatus' firstDetectedAt: type: string format: date-time lastDetectedAt: type: string format: date-time instances: type: - array - 'null' items: $ref: '#/components/schemas/Instance' description: Only on GET /v1/findings/{id} deviceIds: type: array maxItems: 50 description: Affected devices (the first 50); join with the device list for names items: type: string format: uuid observations: oneOf: - $ref: '#/components/schemas/Observations' - type: 'null' rule: description: Only on GET /v1/findings/{id}, for rule findings whose rule is in the loaded pack oneOf: - $ref: '#/components/schemas/RuleInfo' - type: 'null' RunResult: type: object properties: source: type: string enum: - rules - correlation devicesEvaluated: type: integer findings: type: integer affectedDevices: type: integer pack: type: string packVersion: type: string manifestSha256: type: string RulePack: type: object properties: pack: type: string version: type: string manifestSha256: type: string rules: type: array items: type: object properties: id: type: string version: type: integer ruleVersion: type: string title: type: string description: type: string category: type: string severity: $ref: '#/components/schemas/Severity' rootCause: $ref: '#/components/schemas/RootCause' remediationHint: type: string hardwareRecommendation: type: - string - 'null' explanation: description: Plain-language explanation of the finding in English and Arabic, when the rule has one. type: - object - 'null' properties: en: type: string ar: type: string FleetConsumer: type: object properties: canonical: type: string category: type: - string - 'null' devices: type: integer meanCpuPercent: type: number meanMemoryMb: type: number meanDiskMb: type: number description: Mean per-device disk bytes (read plus write) over the analysis window, in MB meanNetMb: type: number description: Mean per-device network bytes (sent plus received) over the analysis window, in MB; 0 on agents without the per-process network collector StartupModel: type: object properties: method: type: string diskClass: type: string enum: - solid_state - hdd devices: type: integer msPerStartupItem: type: number baseMs: type: number CrashAssociation: type: object properties: app: type: string version: type: - string - 'null' withApp: type: integer withAppCrashing: type: integer withoutApp: type: integer withoutAppCrashing: type: integer pValue: type: number adjustedPValue: type: number description: Bonferroni-adjusted across all app versions tested rateWith: type: number rateWithout: type: number EvidenceRef: type: object properties: deviceId: type: string format: uuid source: type: string batchId: type: - string - 'null' format: uuid default: null recordIndex: type: - integer - 'null' default: null table: type: - string - 'null' default: null rowKey: type: - string - 'null' default: null required: - deviceId - source ProcessUsage: type: object description: One app's resource use on a device over the analysis window properties: canonical: type: string processName: type: string category: type: - string - 'null' cpuPercentAvg: type: number memoryBytes: type: integer description: Mean resident memory across sampling windows diskBytes: type: integer description: Total read plus write bytes across sampling windows netBytes: type: integer description: Total sent plus received bytes across sampling windows; 0 on agents without the per-process network collector ref: $ref: '#/components/schemas/EvidenceRef' required: - canonical - processName - category - cpuPercentAvg - memoryBytes - diskBytes - netBytes - ref DeviceResourceReport: type: object properties: deviceId: type: string format: uuid topCpu: type: array items: $ref: '#/components/schemas/ProcessUsage' topMemory: type: array items: $ref: '#/components/schemas/ProcessUsage' topDisk: type: array items: $ref: '#/components/schemas/ProcessUsage' topNet: type: array items: $ref: '#/components/schemas/ProcessUsage' required: - deviceId - topCpu - topMemory - topDisk - topNet PerformanceAssociation: type: object description: One CPU-impact comparison. One app (apps has one entry) compares devices running it with devices not running it; a pair compares devices running both with devices running exactly one. properties: apps: type: array minItems: 1 maxItems: 2 items: type: string with: type: integer description: Devices in the cohort with the app(s) without: type: integer meanWith: type: number description: Mean device CPU load (sum of process CPU% per sampling window, averaged) in the cohort with the app(s) meanWithout: type: number description: Baseline mean; for a pair, the costlier single app's cohort effect: type: number description: meanWith / meanWithout - 1 pValue: type: number description: One-sided Welch t-test adjustedPValue: type: number description: Bonferroni-adjusted across every comparison made StartupImpact: type: object properties: deviceId: type: string format: uuid startupItems: type: integer estimatedStartupMs: type: number method: type: string required: - deviceId - startupItems - estimatedStartupMs - method BootTrendPoint: type: object properties: day: type: string format: date method: type: string devices: type: integer boots: type: integer medianBootMs: type: number medianSignInMs: type: - number - 'null' required: - day - method - devices - boots - medianBootMs - medianSignInMs