#!/usr/bin/env python3
"""Compare same-tweet-id text/engagement across the last 3 daily snapshots (edit detection)."""
import json
days = ["2026-10-29", "2026-10-30", "2026-10-31"]
RAW = "/home/kiro/trend-engine/trends/x/raw"
snaps = {}
for d in days:
    try:
        snaps[d] = json.load(open(f"{RAW}/scan_results_{d}_FULL.json"))["raw"]
    except FileNotFoundError:
        pass

TARGET_IDS = {
    "2115408786756337811": "Flova 10-28 11:42 Launch Special",
    "2115064815941243125": "Flova 10-27 12:55 Launch Special",
    "2115929160447393797": "Higgsfield 10-29 22:09 Unlimited Seedance",
}
for tid, label in TARGET_IDS.items():
    print(f"\n### {label} ({tid})")
    for d in days:
        found = None
        for h, tw in snaps.get(d, {}).items():
            for t in tw:
                if str(t.get("id")) == tid:
                    found = (h, t)
                    break
            if found:
                break
        if found:
            h, t = found
            print(f"  {d}: @{h} {t.get('likeCount')}L/{t.get('viewCount')}V | {(t.get('text') or '')[:150].replace(chr(10),' / ')}")
        else:
            print(f"  {d}: not in fetched set")
