agentWarnings method

List<String> agentWarnings(
  1. FakeAgent a
)

The codes of AgentRuntimeStatus.warnings for a as the server computes them at each heartbeat (10 8, 09 4.8), only while the runtime is online or degraded.

The fake counts billing.mismatch_alert_after as one heartbeat: billing_mode_mismatch shows once a heartbeat saw the reported mode differ from the configured one (FakeAgent.mismatchAtHeartbeat); right after a switch only billing_mode_matches is false, as on the server. There is no tool_class_mismatch, because the fake has no reported tool class.

Implementation

List<String> agentWarnings(FakeAgent a) {
  if (a.state != 'online' && a.state != 'degraded') return const [];
  final reported = a.reportedBillingMode;
  final supported = a.billingModesSupported;
  return [
    if (a.mismatchAtHeartbeat &&
        reported != null &&
        reported != a.billingMode)
      'billing_mode_mismatch',
    if (reported == null &&
        supported != null &&
        !supported.contains(a.billingMode))
      'billing_mode_unsupported',
    if (a.keyType == 'unknown') 'billing_evidence_unknown',
  ];
}