{
  "assessment": {
    "all_ok": true,
    "decision": "PASS_STEP_047B_V7_ACTIVITY_PIN_AND_IDLE_REBALANCE_CANARY",
    "expected_absence": {
      "jobs_created": false,
      "selector_changed_final": false,
      "vm121_db_written": false,
      "wg_runtime_changed": false
    },
    "success_checks": {
      "active_peer_10_pinned": true,
      "after_commit_10_still_cs1": true,
      "after_commit_11_back_cs2": true,
      "after_commit_balanced_cs1_one": true,
      "after_commit_balanced_cs2_one": true,
      "allowed_ip_count_five": true,
      "commit_action_one": true,
      "commit_schema_v7": true,
      "conf_interval_60_final": true,
      "conf_mode_commit_final": true,
      "controller_commit_rc_zero": true,
      "db_enabled_peers_five": true,
      "db_lease_rows_five": true,
      "db_pending_zero": true,
      "enable_ok": true,
      "final_class_counts_one_each": true,
      "final_line_10_ok": true,
      "final_line_11_ok": true,
      "final_line_12_ok": true,
      "final_line_13_ok": true,
      "final_line_14_ok": true,
      "idle_peer_11_moved": true,
      "imbalance_apply_ok": true,
      "imbalance_cs1_two": true,
      "imbalance_cs2_zero": true,
      "imbalance_rewrite_ok": true,
      "peer_count_five": true,
      "precheck_ok": true,
      "restore_apply_ok": true,
      "selector_apply_performed": true,
      "selector_restore_copy_ok": true,
      "selector_rows_final_five": true,
      "selector_sha_restored": true,
      "selector_update_performed": true,
      "service_enabled_final": true,
      "service_running_final": true,
      "start_ok": true,
      "state_action_ip_11": true,
      "state_action_to_cs2": true,
      "state_peer10_active": true,
      "state_peer11_not_active": true,
      "state_restore_ok": true,
      "state_write_performed": true,
      "uci_zero": true,
      "vm100_047b_rc_zero": true,
      "vm121_db_safety_ok": true
    },
    "warnings": [
      "This step intentionally creates a temporary selector imbalance and marks .10 synthetic-active.",
      "Expected result: .10 remains pinned, idle .11 is moved back to cs2.",
      "Final selector is restored and production commit loop remains enabled/running."
    ]
  },
  "changes": {
    "final_service_mode": "COMMIT_ENABLED_RUNNING",
    "idle_peer_rebalance_test": "YES",
    "jobs_created": "NO",
    "selector_apply_ran": "YES_COMMIT_AND_RESTORE",
    "synthetic_active_pin_test": "YES",
    "temporary_selector_imbalance": "YES_RESTORED",
    "vm121_db_changed": "NO"
  },
  "commit_json": {
    "actions": [
      {
        "from_class": "cs1",
        "from_target_id": "canary_vpn3",
        "reason": "idle_state_rebalance_most_loaded_to_least_loaded",
        "to_class": "cs2",
        "to_target_id": "canary_vpn4",
        "tunnel_ip": "10.253.1.11"
      }
    ],
    "commit": {
      "apply_log_sanitized": "applied_vm100_wgpay_selector_rules=5|",
      "commit_rc": "0",
      "selector_apply_performed": true,
      "selector_apply_rc": "0",
      "selector_new_sha256": "2db1a0c46c1b93d9ede5f560d2d00db2dad3283adbc8f6ca6b0434ab695d8460",
      "selector_update_performed": true,
      "selector_update_rc": "0",
      "state_file_write_performed": true,
      "state_file_write_rc": "0"
    },
    "idle_seconds": 900,
    "mode": "--commit",
    "now_epoch": 1783686334,
    "reassign_cooldown_seconds": 900,
    "rows": [
      {
        "active_now": true,
        "active_state": true,
        "cooldown_ok": true,
        "delta_bytes": 0,
        "delta_packets": 0,
        "egress_class": "cs1",
        "expected_target_id": "canary_vpn3",
        "in_packets": 0,
        "last_active_epoch": 1783686334,
        "last_reassign_epoch": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn3",
        "tunnel_ip": "10.253.1.10"
      },
      {
        "active_now": false,
        "active_state": false,
        "cooldown_ok": true,
        "delta_bytes": 0,
        "delta_packets": 0,
        "egress_class": "cs1",
        "expected_target_id": "canary_vpn3",
        "in_packets": 0,
        "last_active_epoch": 0,
        "last_reassign_epoch": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn3",
        "tunnel_ip": "10.253.1.11"
      },
      {
        "active_now": false,
        "active_state": false,
        "cooldown_ok": true,
        "delta_bytes": 0,
        "delta_packets": 0,
        "egress_class": "cs3",
        "expected_target_id": "canary_vpn5",
        "in_packets": 0,
        "last_active_epoch": 0,
        "last_reassign_epoch": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn5",
        "tunnel_ip": "10.253.1.12"
      },
      {
        "active_now": false,
        "active_state": false,
        "cooldown_ok": true,
        "delta_bytes": 0,
        "delta_packets": 0,
        "egress_class": "cs4",
        "expected_target_id": "canary_vpn1",
        "in_packets": 0,
        "last_active_epoch": 0,
        "last_reassign_epoch": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn1",
        "tunnel_ip": "10.253.1.13"
      },
      {
        "active_now": false,
        "active_state": false,
        "cooldown_ok": true,
        "delta_bytes": 0,
        "delta_packets": 0,
        "egress_class": "cs5",
        "expected_target_id": "canary_vpn2",
        "in_packets": 0,
        "last_active_epoch": 0,
        "last_reassign_epoch": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn2",
        "tunnel_ip": "10.253.1.14"
      }
    ],
    "schema": "router-wgpay-egress-local-v7",
    "selector_apply": "/usr/local/sbin/router-wgpay-canary-apply.sh",
    "selector_file": "/etc/router-wgpay-selector.d/peers.conf",
    "state_file": "/var/lib/router-wgpay-egress/state.kv",
    "state_preview": {
      "format": "key_value_v2",
      "state_file": "/var/lib/router-wgpay-egress/state.kv",
      "state_file_write_performed": true,
      "state_file_write_rc": "0",
      "state_preview_sha256": "8e27f915b2f5dbce628bf94a5b764b265042fd81a017a979ceed10eb0e4c7f30",
      "would_write_state_file": true
    },
    "summary": {
      "action_count": 1,
      "action_reason": "idle_state_rebalance_most_loaded_to_least_loaded",
      "active_now_count": 1,
      "active_state_count": 1,
      "block_reason": "",
      "blocked": false,
      "idle_count": 4,
      "max_class": "cs1",
      "max_count": 2,
      "min_class": "cs2",
      "min_count": 0,
      "noop": false,
      "rows": 5,
      "selector_apply_would_run": true,
      "selector_file_would_change": true,
      "state_file_would_write": true
    }
  },
  "db_summary": {
    "enabled_peers": 5,
    "forced_leases": 0,
    "lease_rows": 5,
    "pending_jobs": 0
  },
  "mode": "V7_SYNTHETIC_ACTIVE_PIN_IDLE_REBALANCE_COMMIT_RESTORE",
  "publish": {
    "facts_json": "https://helena-background-beam-harry.trycloudflare.com/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260710-122531_step047b_v7_activity_pin_idle_rebalance_canary/facts.json",
    "report_txt": "https://helena-background-beam-harry.trycloudflare.com/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260710-122531_step047b_v7_activity_pin_idle_rebalance_canary/report.txt",
    "trycf_report": "https://helena-background-beam-harry.trycloudflare.com/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260710-122531_step047b_v7_activity_pin_idle_rebalance_canary/"
  },
  "schema": "router-step-facts-v1",
  "step": "STEP_047B_V7_ACTIVITY_PIN_AND_IDLE_REBALANCE_CANARY",
  "summary": {
    "allowed_ip_count_final": "5",
    "commit_action": {
      "from_class": "cs1",
      "from_target_id": "canary_vpn3",
      "reason": "idle_state_rebalance_most_loaded_to_least_loaded",
      "to_class": "cs2",
      "to_target_id": "canary_vpn4",
      "tunnel_ip": "10.253.1.11"
    },
    "db_summary": {
      "enabled_peers": 5,
      "forced_leases": 0,
      "lease_rows": 5,
      "pending_jobs": 0
    },
    "line_10_after_commit": "10.253.1.10 cs1 canary_vpn3",
    "line_10_final": "10.253.1.10 cs1 canary_vpn3",
    "line_11_after_commit": "10.253.1.11 cs2 canary_vpn4",
    "line_11_final": "10.253.1.11 cs2 canary_vpn4",
    "line_12_final": "10.253.1.12 cs3 canary_vpn5",
    "line_13_final": "10.253.1.13 cs4 canary_vpn1",
    "line_14_final": "10.253.1.14 cs5 canary_vpn2",
    "peer_count_final": "5",
    "rollback": "/root/rollback-step047b-v7-active-pin-20260710-122531.sh",
    "row10_active_now": true,
    "row10_active_state": true,
    "row11_active_state": false,
    "selector_sha_final": "2db1a0c46c1b93d9ede5f560d2d00db2dad3283adbc8f6ca6b0434ab695d8460",
    "selector_sha_pre": "2db1a0c46c1b93d9ede5f560d2d00db2dad3283adbc8f6ca6b0434ab695d8460",
    "service_running_final": "true",
    "state_action_ip_after_commit": "action_ip=10.253.1.11",
    "state_exists_final": "true",
    "state_peer10_active_now": "peer.10.253.1.10.active_now=true",
    "state_peer10_active_state": "peer.10.253.1.10.active_state=true",
    "state_peer11_active_state": "peer.10.253.1.11.active_state=false",
    "state_schema_final": "schema=router-wgpay-egress-local-state-v2"
  }
}
