"""Measure how long a commune drop actually survives on disk before core ingests it.

No wake marker in the body, so nothing arms and no boundary can fire — this measures the
window the detector has to look in, and nothing else.
"""
import os
import time

DROP = r"C:\Users\decid\Documents\projects\spt-claude-code\.claude\perri-commune.md"
BODY = "<project-context>\ningest-latency probe %d — no marker, nothing to arm.\n</project-context>\n"

for i in range(3):
    with open(DROP, "w", encoding="utf-8", newline="\n") as f:
        f.write(BODY % i)
    t0 = time.time()
    while time.time() - t0 < 120:
        if not os.path.exists(DROP):
            print(f"probe {i}: ingested after {time.time() - t0:.1f}s")
            break
        time.sleep(0.25)
    else:
        print(f"probe {i}: STILL PRESENT after 120s")
        os.remove(DROP)
    time.sleep(2)
