{
  "assessment": {
    "all_ok": true,
    "blockers": [],
    "decision": "PASS_STEP_044L_ACTIVITY_SAMPLER_SCHEMA_CONTRACT_CLOSE_READONLY",
    "expected_absence": {
      "activity_eval_written_to_db": false,
      "client_config_published": false,
      "force_mode_enabled": false,
      "manual_agent_service_start_used": false,
      "private_material_published": false,
      "rebalance_paused": false,
      "schema_migration_applied": false,
      "selector_changed": false,
      "vm100_changed": false,
      "vm101_changed": false,
      "vm121_db_changed": false,
      "wg_peer_runtime_changed": false
    },
    "success_checks": {
      "active_preview_count_one": true,
      "activity_service_enabled": true,
      "activity_service_status_ok": true,
      "baseline_columns_present": true,
      "contract_rows_five": true,
      "contract_rows_match_selector_classes": true,
      "counter_rows_ten": true,
      "dryrun_db_update_preview_only": true,
      "enabled_peers_five": true,
      "force_mode_off": true,
      "forced_leases_zero": true,
      "lease_columns_query_ok": true,
      "lease_rows_five": true,
      "leases_query_ok": true,
      "no_schema_migration_required": true,
      "pending_jobs_zero": true,
      "public_index_rebuilt": true,
      "public_report_created": true,
      "rebalance_not_paused": true,
      "selector_rows_five": true,
      "settings_query_ok": true,
      "settings_thresholds_loaded": true,
      "vm100_allowed_ip_count_five": true,
      "vm100_counters_collected": true,
      "vm100_peer_count_five": true,
      "vm100_uci_peer_count_zero": true,
      "vm101_cs1_to_vpn3_seen": true,
      "vm101_cs2_to_vpn4_seen": true,
      "vm101_cs3_to_vpn5_seen": true,
      "vm101_cs4_to_vpn1_seen": true,
      "vm101_cs5_to_vpn2_seen": true,
      "vm101_slot_map_collected": true,
      "vm121_db_model_collected": true
    },
    "warnings": [
      "STEP_044L is read-only and applies no migration.",
      "Existing columns last_tx_* and last_rx_* are sufficient as sampler baselines.",
      "Next step can implement a one-shot DB sampler update using this exact mapping."
    ]
  },
  "changes": {
    "client_config_published": "NO",
    "manual_agent_service_start_used": "NO",
    "private_material_published": "NO",
    "schema_migration_applied": "NO",
    "selector_changed": "NO",
    "vm100_changed": "NO_READONLY_SCHEMA_CONTRACT",
    "vm101_changed": "NO",
    "vm121_db_changed": "NO",
    "wg_peer_runtime_changed": "NO"
  },
  "columns": {
    "assigned_at": {
      "data_type": "timestamp with time zone",
      "is_nullable": "NO"
    },
    "assignment_source": {
      "data_type": "text",
      "is_nullable": "NO"
    },
    "cooldown_until": {
      "data_type": "timestamp with time zone",
      "is_nullable": "YES"
    },
    "egress_class": {
      "data_type": "text",
      "is_nullable": "NO"
    },
    "forced": {
      "data_type": "boolean",
      "is_nullable": "NO"
    },
    "id": {
      "data_type": "uuid",
      "is_nullable": "NO"
    },
    "last_activity_at": {
      "data_type": "timestamp with time zone",
      "is_nullable": "YES"
    },
    "last_rx_bytes": {
      "data_type": "bigint",
      "is_nullable": "NO"
    },
    "last_rx_packets": {
      "data_type": "bigint",
      "is_nullable": "NO"
    },
    "last_tx_bytes": {
      "data_type": "bigint",
      "is_nullable": "NO"
    },
    "last_tx_packets": {
      "data_type": "bigint",
      "is_nullable": "NO"
    },
    "peer_id": {
      "data_type": "uuid",
      "is_nullable": "NO"
    },
    "reason": {
      "data_type": "text",
      "is_nullable": "NO"
    },
    "state": {
      "data_type": "text",
      "is_nullable": "NO"
    },
    "target_id": {
      "data_type": "text",
      "is_nullable": "YES"
    },
    "tunnel_ip": {
      "data_type": "inet",
      "is_nullable": "NO"
    },
    "updated_at": {
      "data_type": "timestamp with time zone",
      "is_nullable": "NO"
    }
  },
  "contract_rows": [
    {
      "active_eval_preview": {
        "active_now": true,
        "bytes_min": 16384,
        "packets_min": 10,
        "proposed_state": "active",
        "would_set_last_activity_at": "now()"
      },
      "counter_mapping": {
        "in_counter": "peer_10_253_1_10_in_vpn",
        "in_counter_db_baseline_bytes_column": "last_rx_bytes",
        "in_counter_db_baseline_packets_column": "last_rx_packets",
        "in_counter_semantics": "transit_vpn_to_client / rx baseline",
        "out_counter": "peer_10_253_1_10_out_vpn",
        "out_counter_db_baseline_bytes_column": "last_tx_bytes",
        "out_counter_db_baseline_packets_column": "last_tx_packets",
        "out_counter_semantics": "client_to_transit_vpn / tx baseline"
      },
      "current_counters": {
        "rx_bytes": 6840,
        "rx_packets": 30,
        "tx_bytes": 6840,
        "tx_packets": 30
      },
      "current_state": "idle",
      "delta_preview": {
        "rx_bytes": 6840,
        "rx_packets": 30,
        "total_bytes": 13680,
        "total_packets": 60,
        "tx_bytes": 6840,
        "tx_packets": 30
      },
      "egress_class": "cs1",
      "forced": false,
      "peer_id": "376dfa07-0ba4-4182-af39-389a2cb3badd",
      "selector_class": "cs1",
      "stored_baseline": {
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0
      },
      "target_id": "cs1_vpn3",
      "tunnel_ip": "10.253.1.10",
      "would_not_update_db_in_this_step": true,
      "would_update_columns": {
        "last_activity_at": "now()",
        "last_rx_bytes": 6840,
        "last_rx_packets": 30,
        "last_tx_bytes": 6840,
        "last_tx_packets": 30,
        "reason": "activity_sampler_active",
        "state": "active",
        "updated_at": "now()"
      }
    },
    {
      "active_eval_preview": {
        "active_now": false,
        "bytes_min": 16384,
        "packets_min": 10,
        "proposed_state": "idle",
        "would_set_last_activity_at": "unchanged"
      },
      "counter_mapping": {
        "in_counter": "peer_10_253_1_11_in_vpn",
        "in_counter_db_baseline_bytes_column": "last_rx_bytes",
        "in_counter_db_baseline_packets_column": "last_rx_packets",
        "in_counter_semantics": "transit_vpn_to_client / rx baseline",
        "out_counter": "peer_10_253_1_11_out_vpn",
        "out_counter_db_baseline_bytes_column": "last_tx_bytes",
        "out_counter_db_baseline_packets_column": "last_tx_packets",
        "out_counter_semantics": "client_to_transit_vpn / tx baseline"
      },
      "current_counters": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "current_state": "idle",
      "delta_preview": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "total_bytes": 0,
        "total_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "egress_class": "cs2",
      "forced": false,
      "peer_id": "cb533a1a-7070-416d-9272-846327545060",
      "selector_class": "cs2",
      "stored_baseline": {
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0
      },
      "target_id": "cs2_vpn4",
      "tunnel_ip": "10.253.1.11",
      "would_not_update_db_in_this_step": true,
      "would_update_columns": {
        "last_activity_at": "unchanged",
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0,
        "reason": "activity_sampler_no_delta",
        "state": "idle",
        "updated_at": "now()"
      }
    },
    {
      "active_eval_preview": {
        "active_now": false,
        "bytes_min": 16384,
        "packets_min": 10,
        "proposed_state": "idle",
        "would_set_last_activity_at": "unchanged"
      },
      "counter_mapping": {
        "in_counter": "peer_10_253_1_12_in_vpn",
        "in_counter_db_baseline_bytes_column": "last_rx_bytes",
        "in_counter_db_baseline_packets_column": "last_rx_packets",
        "in_counter_semantics": "transit_vpn_to_client / rx baseline",
        "out_counter": "peer_10_253_1_12_out_vpn",
        "out_counter_db_baseline_bytes_column": "last_tx_bytes",
        "out_counter_db_baseline_packets_column": "last_tx_packets",
        "out_counter_semantics": "client_to_transit_vpn / tx baseline"
      },
      "current_counters": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "current_state": "idle",
      "delta_preview": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "total_bytes": 0,
        "total_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "egress_class": "cs3",
      "forced": false,
      "peer_id": "a3cbe3b5-8416-4847-b5ee-21f42359b465",
      "selector_class": "cs3",
      "stored_baseline": {
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0
      },
      "target_id": "cs3_vpn5",
      "tunnel_ip": "10.253.1.12",
      "would_not_update_db_in_this_step": true,
      "would_update_columns": {
        "last_activity_at": "unchanged",
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0,
        "reason": "activity_sampler_no_delta",
        "state": "idle",
        "updated_at": "now()"
      }
    },
    {
      "active_eval_preview": {
        "active_now": false,
        "bytes_min": 16384,
        "packets_min": 10,
        "proposed_state": "idle",
        "would_set_last_activity_at": "unchanged"
      },
      "counter_mapping": {
        "in_counter": "peer_10_253_1_13_in_vpn",
        "in_counter_db_baseline_bytes_column": "last_rx_bytes",
        "in_counter_db_baseline_packets_column": "last_rx_packets",
        "in_counter_semantics": "transit_vpn_to_client / rx baseline",
        "out_counter": "peer_10_253_1_13_out_vpn",
        "out_counter_db_baseline_bytes_column": "last_tx_bytes",
        "out_counter_db_baseline_packets_column": "last_tx_packets",
        "out_counter_semantics": "client_to_transit_vpn / tx baseline"
      },
      "current_counters": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "current_state": "idle",
      "delta_preview": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "total_bytes": 0,
        "total_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "egress_class": "cs4",
      "forced": false,
      "peer_id": "219a1f63-ec47-4f72-9663-c1a17d82301e",
      "selector_class": "cs4",
      "stored_baseline": {
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0
      },
      "target_id": "cs4_vpn1",
      "tunnel_ip": "10.253.1.13",
      "would_not_update_db_in_this_step": true,
      "would_update_columns": {
        "last_activity_at": "unchanged",
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0,
        "reason": "activity_sampler_no_delta",
        "state": "idle",
        "updated_at": "now()"
      }
    },
    {
      "active_eval_preview": {
        "active_now": false,
        "bytes_min": 16384,
        "packets_min": 10,
        "proposed_state": "idle",
        "would_set_last_activity_at": "unchanged"
      },
      "counter_mapping": {
        "in_counter": "peer_10_253_1_14_in_vpn",
        "in_counter_db_baseline_bytes_column": "last_rx_bytes",
        "in_counter_db_baseline_packets_column": "last_rx_packets",
        "in_counter_semantics": "transit_vpn_to_client / rx baseline",
        "out_counter": "peer_10_253_1_14_out_vpn",
        "out_counter_db_baseline_bytes_column": "last_tx_bytes",
        "out_counter_db_baseline_packets_column": "last_tx_packets",
        "out_counter_semantics": "client_to_transit_vpn / tx baseline"
      },
      "current_counters": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "current_state": "idle",
      "delta_preview": {
        "rx_bytes": 0,
        "rx_packets": 0,
        "total_bytes": 0,
        "total_packets": 0,
        "tx_bytes": 0,
        "tx_packets": 0
      },
      "egress_class": "cs5",
      "forced": false,
      "peer_id": "e4adcfa1-6fbc-4471-b66b-8d7837f35f9d",
      "selector_class": "cs5",
      "stored_baseline": {
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0
      },
      "target_id": "cs5_vpn2",
      "tunnel_ip": "10.253.1.14",
      "would_not_update_db_in_this_step": true,
      "would_update_columns": {
        "last_activity_at": "unchanged",
        "last_rx_bytes": 0,
        "last_rx_packets": 0,
        "last_tx_bytes": 0,
        "last_tx_packets": 0,
        "reason": "activity_sampler_no_delta",
        "state": "idle",
        "updated_at": "now()"
      }
    }
  ],
  "contract_summary": {
    "active_preview_count": 1,
    "contract_rows": 5,
    "idle_preview_count": 4,
    "migration_required": false,
    "rows_with_selector_match": 5
  },
  "db_summary": {
    "active_leases": 0,
    "enabled_peers": 5,
    "forced_leases": 0,
    "idle_leases": 5,
    "lease_rows": 5,
    "pending_jobs": 0
  },
  "mode": "READONLY_CLOSE_ACTIVITY_SAMPLER_SCHEMA_CONTRACT_NO_MIGRATION_REQUIRED",
  "publish": {
    "local_report": "http://127.0.0.1:8099/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260709-142648_step044l_activity_sampler_schema_contract_close_readonly/",
    "public_index_rebuilt": true,
    "trycf_report": "https://helena-background-beam-harry.trycloudflare.com/r/e94a0859747d7b96f29c7fdafc2d0351ba603bb0a7e9e5a4/20260709-142648_step044l_activity_sampler_schema_contract_close_readonly/"
  },
  "schema": "router-step-facts-v1",
  "schema_contract": {
    "baseline_mapping": {
      "peer_10_253_1_X_in_vpn": {
        "db_bytes_column": "last_rx_bytes",
        "db_packets_column": "last_rx_packets",
        "semantics": "transit_vpn_to_client"
      },
      "peer_10_253_1_X_out_vpn": {
        "db_bytes_column": "last_tx_bytes",
        "db_packets_column": "last_tx_packets",
        "semantics": "client_to_transit_vpn"
      }
    },
    "delta_formula": {
      "active_now": "delta_packets >= 10 OR delta_bytes >= 16384",
      "delta_bytes": "delta_tx_bytes + delta_rx_bytes",
      "delta_packets": "delta_tx_packets + delta_rx_packets",
      "delta_rx_bytes": "current_in_bytes - last_rx_bytes",
      "delta_rx_packets": "current_in_packets - last_rx_packets",
      "delta_tx_bytes": "current_out_bytes - last_tx_bytes",
      "delta_tx_packets": "current_out_packets - last_tx_packets"
    },
    "migration_required": false,
    "settings": {
      "bytes_min": 16384,
      "cooldown_seconds": 900,
      "force_mode": "off",
      "idle_seconds": 900,
      "packets_min": 10,
      "rebalance_paused": "0",
      "sample_seconds": 120
    },
    "state_policy": {
      "active_delta": "state=active, last_activity_at=now(), update baselines",
      "forced": "assignment not changed; counters/baseline may still update",
      "no_delta_active": "remain active until idle_seconds timeout; later sampler/rebalancer may mark idle",
      "no_delta_idle": "state remains idle, update baselines if counters changed but below threshold"
    },
    "write_columns": [
      "last_tx_packets",
      "last_tx_bytes",
      "last_rx_packets",
      "last_rx_bytes",
      "state",
      "last_activity_at",
      "updated_at",
      "reason"
    ]
  },
  "step": "STEP_044L_ACTIVITY_SAMPLER_SCHEMA_CONTRACT_CLOSE_READONLY"
}
