Screen tree, register rows in the master list, and bot runs coded from the picks that were played
CI / test (pull_request) Canceled after 0s

- analysis/tree/build_tree.py -> data/public/tree.json, analysis/reports/TREE.md: every screen the bot has seen,
  every option, where each led (fixed or dice, with ranges), best known picks per colour chosen cautiously, where
  any picks end, and the untested options. solver.js screenPick(): least-tried and Thompson picks from the tree.
- The bot logs a pick it then overrode as a step: 37 runs were coded with choices they never made. Importer and
  graph.js now use the played steps only.
- runs_clean.csv: the Unofficial Dragon Register's 288 bonded dragons are in the master list as outcome-only
  rows, flagged (no analysis uses them).
- Cycle, refresh and the bot kit rebuild and carry the tree; tests check every generated report is current.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jqCC2LZ4x1WHQ1V57nTsv
This commit is contained in:
ekcSchiano
2026-11-16 15:50:12 +00:00
co-authored by Claude Fable 5.2
parent d01ec46fcc
commit f8e4f575f4
25 changed files with 3613 additions and 163 deletions
+17 -1
View File
@@ -157,12 +157,28 @@ class Handoff(unittest.TestCase):
with self.assertRaises(RuntimeError):
extract.pack_local(spec, empty)
def test_overridden_picks_are_not_played(self):
from collection.etl import runs
steps = [{"scene": "a", "to": "BURNED", "optionText": "west"}, {"scene": "a", "to": "b", "optionText": "centre"},
{"scene": "b", "to": "BURNED", "optionText": "last"}]
self.assertEqual([s["optionText"] for s in runs.played(steps)], ["centre", "last"])
self.assertEqual(runs.played(steps[1:]), steps[1:]) # a last step that ends the run is kept
def test_register_rows_are_outcome_only_and_flagged(self):
import csv
with open(ROOT / "data/public/runs_clean.csv", encoding="utf-8", newline="") as f:
reg = [r for r in csv.DictReader(f) if r["source"] == "register"]
self.assertTrue(reg)
for r in reg:
self.assertEqual((r["outcome"], r["company"], r["scream"]), ("Bonded", "Unknown", "Unknown"))
self.assertIn("outcome only", r["data_flags"])
def test_bot_kit(self):
import zipfile
from collection.etl import handoff
zpath = handoff.export_bot_kit(str(TMP / "exports"))
with zipfile.ZipFile(zpath) as z:
self.assertEqual(sorted(z.namelist()), ["README.txt", "experiments.json", "graph.js", "policy.json", "solver.js"])
self.assertEqual(sorted(z.namelist()), ["README.txt", "experiments.json", "graph.js", "policy.json", "solver.js", "tree.json"])
self.assertEqual(z.read("solver.js"), (ROOT / "core/solver.js").read_bytes())
self.assertEqual(json.loads(z.read("policy.json"))["id"],
json.loads((ROOT / "data/public/policy.json").read_text(encoding="utf-8"))["id"])