#!/usr/bin/env python3
"""Verify published aggregate rows for desk log OAM-RKPI-20260822.

This script checks the first-party CSV only. It does not reconstruct the
rewrite-versus-standing-pack run, and it is not a third-party reproduction.
"""

from __future__ import annotations

import csv
import pathlib
import sys

EXPECTED = [
    {
        "state": "rewrite_sql_weekly",
        "same_goal_week_2": "0",
        "active_store_sentence_held": "0",
        "number_allowed_to_move": "1",
    },
    {
        "state": "standing_bound_goal",
        "same_goal_week_2": "1",
        "active_store_sentence_held": "1",
        "number_allowed_to_move": "1",
    },
]


def main() -> int:
    csv_path = pathlib.Path(__file__).with_name(
        "aggregate-OAM-RKPI-20260822.csv"
    )
    with csv_path.open(newline="", encoding="utf-8") as handle:
        rows = list(csv.DictReader(handle))
    if rows != EXPECTED:
        print("FAIL: published aggregate rows do not match the desk log.", file=sys.stderr)
        return 1
    print("OK: published aggregate rows match desk log OAM-RKPI-20260822.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
