{
  "assessment": {
    "all_ok": true,
    "decision": "PASS_STEP_046Q_VM100_LOCAL_CONTROLLER_FULL_COMMIT_APPLY_RESTORE",
    "expected_absence": {
      "jobs_created": false,
      "selector_changed_final": false,
      "service_enabled": false,
      "vm121_db_written": false,
      "wg_runtime_changed": false
    },
    "success_checks": {
      "after_commit_action_line_ok": true,
      "after_commit_allowed_ip_count_stable": true,
      "after_commit_balanced_cs1_one": true,
      "after_commit_balanced_cs2_one": true,
      "after_commit_peer_count_stable": true,
      "commit_action_from_cs1": true,
      "commit_action_one": true,
      "commit_action_to_cs2": true,
      "commit_json_schema_v6": true,
      "commit_selector_apply_performed": true,
      "commit_selector_apply_rc_zero": true,
      "commit_selector_update_performed": true,
      "commit_selector_update_rc_zero": true,
      "commit_state_write_performed": true,
      "commit_state_write_rc_zero": true,
      "controller_commit_rc_zero": true,
      "db_enabled_peers_five": true,
      "db_lease_rows_five": true,
      "db_pending_zero": true,
      "final_allowed_ip_count_five": true,
      "final_line_10_ok": true,
      "final_line_11_ok": true,
      "final_line_12_ok": true,
      "final_peer_count_five": true,
      "final_rows_five": true,
      "final_uci_zero": true,
      "imbalance_apply_ok": true,
      "imbalance_created_cs1_two": true,
      "imbalance_created_cs2_zero": true,
      "imbalance_rewrite_ok": true,
      "precheck_ok": true,
      "restore_apply_ok": true,
      "selector_restore_copy_ok": true,
      "selector_sha_restored": true,
      "service_disabled_final": true,
      "service_not_running_final": true,
      "state_action_count_after_commit_ok": true,
      "state_action_to_class_after_commit_ok": true,
      "state_exists_after_commit": true,
      "state_restore_ok": true,
      "state_restored": true,
      "state_schema_after_commit_ok": true,
      "vm100_046q_rc_zero": true,
      "vm121_db_safety_ok": true
    },
    "warnings": [
      "This step intentionally creates a temporary selector imbalance, commits a real selector update/apply/state write, then restores original selector/state.",
      "Controller v6 remains installed but service remains disabled and not running.",
      "VM121 DB is read-only and no jobs are created."
    ]
  },
  "changes": {
    "controller_commit_ran": "YES",
    "jobs_created": "NO",
    "selector_apply_ran": "YES_COMMIT_AND_RESTORE",
    "service_enabled": "NO",
    "service_running_final": "NO",
    "state_file_temporarily_written": "YES_RESTORED",
    "temporary_selector_imbalance": "YES_RESTORED",
    "vm100_controller_script_patched": "YES",
    "vm121_db_changed": "NO"
  },
  "commit_json": {
    "actions": [
      {
        "from_class": "cs1",
        "from_target_id": "canary_vpn3",
        "reason": "idle_rebalance_most_loaded_to_least_loaded",
        "to_class": "cs2",
        "to_target_id": "canary_vpn4",
        "tunnel_ip": "10.253.1.10"
      }
    ],
    "commit": {
      "apply_log_sanitized": "applied_vm100_wgpay_selector_rules=5|",
      "commit_rc": "0",
      "selector_apply_performed": true,
      "selector_apply_rc": "0",
      "selector_new_sha256": "2064ac77e088941f205d50c388f7dab462e9b2c55047ae12ed0f560cd2326c5e",
      "selector_update_performed": true,
      "selector_update_rc": "0",
      "state_file_write_performed": true,
      "state_file_write_rc": "0"
    },
    "mode": "--commit",
    "rows": [
      {
        "active_now": false,
        "egress_class": "cs1",
        "expected_target_id": "canary_vpn3",
        "in_packets": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn3",
        "total_bytes": 0,
        "total_packets": 0,
        "tunnel_ip": "10.253.1.10"
      },
      {
        "active_now": false,
        "egress_class": "cs1",
        "expected_target_id": "canary_vpn3",
        "in_packets": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn3",
        "total_bytes": 0,
        "total_packets": 0,
        "tunnel_ip": "10.253.1.11"
      },
      {
        "active_now": false,
        "egress_class": "cs3",
        "expected_target_id": "canary_vpn5",
        "in_packets": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn5",
        "total_bytes": 0,
        "total_packets": 0,
        "tunnel_ip": "10.253.1.12"
      },
      {
        "active_now": false,
        "egress_class": "cs4",
        "expected_target_id": "canary_vpn1",
        "in_packets": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn1",
        "total_bytes": 0,
        "total_packets": 0,
        "tunnel_ip": "10.253.1.13"
      },
      {
        "active_now": false,
        "egress_class": "cs5",
        "expected_target_id": "canary_vpn2",
        "in_packets": 0,
        "out_packets": 0,
        "selector_target_match": true,
        "target_id": "canary_vpn2",
        "total_bytes": 0,
        "total_packets": 0,
        "tunnel_ip": "10.253.1.14"
      }
    ],
    "schema": "router-wgpay-egress-local-v6",
    "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_v1",
      "state_file": "/var/lib/router-wgpay-egress/state.kv",
      "state_file_write_performed": true,
      "state_file_write_rc": "0",
      "state_preview_sha256": "b94146867867e496ebe027a0718cc4a443caaabb60eacab7924c377020e4ef2c",
      "would_write_state_file": true
    },
    "summary": {
      "action_count": 1,
      "action_reason": "idle_rebalance_most_loaded_to_least_loaded",
      "active_count": 0,
      "block_reason": "",
      "blocked": false,
      "idle_count": 5,
      "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
    },
    "synthetic_active_ips": "",
    "transaction_preview": {
      "would_run_selector_apply": true,
      "would_update_selector_rows": 1,
      "would_write_state_file": true
    }
  },
  "db_summary": {
    "enabled_peers": 5,
    "forced_leases": 0,
    "lease_rows": 5,
    "pending_jobs": 0
  },
  "mode": "VM100_CONTROLLER_V6_FULL_COMMIT_APPLY_STATE_WRITE_RESTORE",
  "publish": {
    "facts_json": "https://helena-background-beam-harry.trycloudflare.com/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260710-114450_step046q_vm100_full_commit_apply_restore/facts.json",
    "report_txt": "https://helena-background-beam-harry.trycloudflare.com/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260710-114450_step046q_vm100_full_commit_apply_restore/report.txt",
    "trycf_report": "https://helena-background-beam-harry.trycloudflare.com/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260710-114450_step046q_vm100_full_commit_apply_restore/"
  },
  "schema": "router-step-facts-v1",
  "step": "STEP_046Q_VM100_LOCAL_CONTROLLER_FULL_COMMIT_APPLY_RESTORE",
  "summary": {
    "allowed_ip_count_final": "5",
    "commit_action": {
      "from_class": "cs1",
      "from_target_id": "canary_vpn3",
      "reason": "idle_rebalance_most_loaded_to_least_loaded",
      "to_class": "cs2",
      "to_target_id": "canary_vpn4",
      "tunnel_ip": "10.253.1.10"
    },
    "commit_meta": {
      "apply_log_sanitized": "applied_vm100_wgpay_selector_rules=5|",
      "commit_rc": "0",
      "selector_apply_performed": true,
      "selector_apply_rc": "0",
      "selector_new_sha256": "2064ac77e088941f205d50c388f7dab462e9b2c55047ae12ed0f560cd2326c5e",
      "selector_update_performed": true,
      "selector_update_rc": "0",
      "state_file_write_performed": true,
      "state_file_write_rc": "0"
    },
    "init_enabled_final": "false",
    "line_10_after_commit": "10.253.1.10 cs2 canary_vpn4",
    "line_10_final": "10.253.1.10 cs1 canary_vpn3",
    "line_11_after_commit": "10.253.1.11 cs1 canary_vpn3",
    "line_11_final": "10.253.1.11 cs2 canary_vpn4",
    "line_12_final": "10.253.1.12 cs3 canary_vpn5",
    "peer_count_final": "5",
    "rollback": "/root/rollback-step046q-full-commit-20260710-114450.sh",
    "script": "/usr/local/sbin/router-wgpay-egress-local.sh",
    "script_sha256": "24fd978af369fdcab9f7760553bd312b1f02bd41a2fcc1c3daa197572acdbc92",
    "selector_backup": "/root/step046q-selector-20260710-114450.backup",
    "service_running_final": "false",
    "state_exists_after_commit": "true",
    "state_exists_final": "false",
    "state_exists_pre": "false",
    "state_restored": true,
    "state_sha_after_commit": "b94146867867e496ebe027a0718cc4a443caaabb60eacab7924c377020e4ef2c",
    "state_sha_final": "none",
    "state_sha_pre": "none",
    "uci_peer_sections_final": "0"
  }
}
