#!/usr/bin/env python3 """gen_drift_value_truth.py — factory batch 10 truth battery (live oracle).""" import json import sys from pathlib import Path REPO = Path(__file__).resolve().parent.parent sys.path.insert(0, str(REPO / "src")) sys.path.insert(0, str(REPO / "src" / "rune")) import drift_core as dc # noqa: E402 NOW = "2026-10-08T00:30:00+00:00" def main(): entries = [ # fresh, low everything {"wash_count": 0, "importance": 0.5, "text": "unproven entry", "rock_status": "washable"}, # high proven, recent access {"wash_count": 25, "importance": 0.9, "text": "proven entry", "rock_status": "washable", "last_accessed": "2026-10-07T20:00:00+00:00"}, # proven but stale (30+ days) {"wash_count": 30, "importance": 0.8, "text": "stale entry", "rock_status": "washable", "last_accessed": "2026-08-01T10:00:00+00:00"}, # already rock {"wash_count": 40, "importance": 0.9, "text": "rocked", "rock_status": "rock"}, # bad timestamp (degrade path) {"wash_count": 22, "importance": 0.7, "text": "bad ts", "rock_status": "washable", "last_accessed": "not-a-date"}, # goal relevance hit {"wash_count": 21, "importance": 0.6, "text": "the curator gates memory writes", "rock_status": "washable", "last_accessed": "2026-10-06T00:00:00+00:00"}, ] goals = ["curator memory writes", "gate the pipeline"] cases = [] for i, e in enumerate(entries): cases.append({ "fn": "value", "name": f"value_{i}", "input": {"entry": e}, "expected": {"value": dc._py_compute_value(e, None, NOW)}, }) cases.append({ "fn": "promo", "name": f"promo_{i}", "input": {"entry": e}, "expected": {"eligible": dc._py_check_promotion_eligibility(e, NOW)[0], "reason": dc._py_check_promotion_eligibility(e, NOW)[1]}, }) # goal-relevance path cases.append({ "fn": "value", "name": "with_goals", "input": {"entry": entries[5], "goals": goals}, "expected": {"value": dc._py_compute_value(entries[5], goals, NOW)}, }) out = {"oracle": "drift_core._py_* oracles", "generated": "2026-10-08", "frozen_now": NOW, "cases": cases} (REPO / "src/go/drift-core" / "truth_value.json").write_text( json.dumps(out, indent=1) + "\n") print(f"wrote {len(cases)} cases") if __name__ == "__main__": main()