AGENTS.md requires a milestone to prove five play profiles with explicit decision timestamps. The chapter simulator previously had only passive/active. tools/pacing_profiles.py now runs five genuinely different behaviours (normal, active, efficient, adversarial, returning) and records per-node arrival times, every decision timestamp, longest no-decision gap, active-input share, failures and offline efficiency. data/pacing_profiles.json holds the evidence; tools/check_pacing_profiles.py gates it; PRODUCTION/40 documents the results and the honest findings. The profiling exposed a real bug I introduced: the offline gold rate (0.02, a value I had picked without a contract basis) paid 19008 gold for 8h, leveling the first hero to Lv.17 when a normal clear ends at Lv.2-4. tools/tune_offline.py scans rates; 0.001 pays 950 gold (~Lv.4) and keeps returning players in range. The rate now lives in mvp_battle_rules.json progression and is read by both the Godot ProfileStore and the Python simulator, so the two cannot drift. The p3b test derives its expected values from the same shared rate. Two honest findings are recorded, not hidden: efficient is slower than active because weakness windows are not yet a settlement multiplier (tracked in PRODUCTION/39), and concentrated upgrades outperform spread ones in the CH cost curve. tools/run_p2_checks.sh now runs 21 gates; all pass.
87 lines
3.5 KiB
Python
87 lines
3.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Gate for the five-profile pacing evidence.
|
|
|
|
Checks the data/pacing_profiles.json report actually satisfies AGENTS.md's
|
|
milestone acceptance: all five profiles ran, each cleared the chapter, each
|
|
has explicit decision timestamps, and no profile has an unbounded no-decision
|
|
gap. Also flags the honest findings (efficient slower than active because
|
|
weakness windows are not yet a settlement mechanic) without failing on them.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
from typing import Any, Dict, List
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
REPORT = ROOT / "data/pacing_profiles.json"
|
|
REQUIRED = ["normal", "active", "efficient", "adversarial", "returning"]
|
|
MAX_GAP_SEC = 40.0 # generous for a 10-node chapter, catches a stuck run
|
|
MIN_DECISIONS = 5
|
|
|
|
|
|
def main() -> int:
|
|
data: Dict[str, Any] = json.loads(REPORT.read_text(encoding="utf-8"))
|
|
profiles = data.get("profiles", {})
|
|
problems: List[str] = []
|
|
|
|
for name in REQUIRED:
|
|
if name not in profiles:
|
|
problems.append(f"missing profile {name}")
|
|
continue
|
|
run = profiles[name]
|
|
metrics = run.get("metrics", {})
|
|
nodes = run.get("nodes", [])
|
|
decisions = run.get("decisions", [])
|
|
cleared = sum(1 for n in nodes if n.get("result") == "win" and n.get("type") != "event")
|
|
if cleared < 8:
|
|
problems.append(f"{name} cleared only {cleared}/8 combat nodes")
|
|
if len(decisions) < MIN_DECISIONS:
|
|
problems.append(f"{name} has only {len(decisions)} decisions")
|
|
for field in ("first_upgrade_sec", "first_event_choice_sec", "first_hero_unlock_sec"):
|
|
if field not in metrics:
|
|
problems.append(f"{name} missing {field}")
|
|
gap = float(metrics.get("longest_no_decision_sec", 1e9))
|
|
if gap > MAX_GAP_SEC:
|
|
problems.append(f"{name} has a {gap}s gap with no decision")
|
|
|
|
# Every decision must carry a timestamp.
|
|
for d in decisions:
|
|
if "time" not in d or "type" not in d or "detail" not in d:
|
|
problems.append(f"{name} has a malformed decision entry: {d}")
|
|
break
|
|
|
|
cross_notes: List[str] = []
|
|
active = profiles.get("active", {}).get("metrics", {})
|
|
efficient = profiles.get("efficient", {}).get("metrics", {})
|
|
adversarial = profiles.get("adversarial", {}).get("metrics", {})
|
|
normal = profiles.get("normal", {}).get("metrics", {})
|
|
returning = profiles.get("returning", {}).get("metrics", {})
|
|
|
|
if efficient.get("total_sec", 0) > active.get("total_sec", 0):
|
|
cross_notes.append(
|
|
"efficient is slower than active: weakness windows are presentation-only, "
|
|
"not yet a settlement multiplier (tracked in PRODUCTION/39)"
|
|
)
|
|
if adversarial.get("total_sec", 0) >= normal.get("total_sec", 0):
|
|
cross_notes.append("adversarial is not faster than normal (expected: it hoards gold)")
|
|
returning_gold = returning.get("offline_gold", 0)
|
|
if returning_gold > 0 and returning_gold <= 2000:
|
|
cross_notes.append(f"returning offline payout is bounded at {returning_gold} gold (calibrated)")
|
|
|
|
print(f"checked {len(REQUIRED)} profiles from {REPORT}")
|
|
for note in cross_notes:
|
|
print(f"NOTE {note}")
|
|
if problems:
|
|
print("PACING_PROFILES_FAIL")
|
|
for p in problems:
|
|
print(f" - {p}")
|
|
return 1
|
|
print("PACING_PROFILES_PASS all five profiles have decisions and bounded gaps")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|