Core: fix three coding bugs from the core review, with rule tests (#11)

1. Letting the Red pass. Only climbing down quickly puts you above the Red, so a tree run that
   passed on the Red and then met the Greens let it pass. Those 16 runs were coded as slow
   descents; they are now "Descend quickly: let the Red pass" and count for the Greens'
   encounter, so the route model's "let it pass" option rests on its own runs. A tree run with
   both the Red and the Greens attempted (impossible in one run) is now flagged.
2. Leaving your squadmates. The form only offered "> Left them" from 2026-10-27 (0 of 504 squad
   runs before chose it, 40 of 144 after). Earlier and undated squad runs are now unknown rather
   than "stayed together" (form.yaml: left_squadmates_asked_from).
3. Bot text. The wounded cadet's other two choices map onto the form; a test checks every choice
   the bot has logged maps onto a form variable (encounter answers excepted, not modelled yet).

Each rule has a test in tests/core/test_coding.py. Data rebuilt (runs, graph, policy, report);
the headline odds move by at most 0.02 points. The Methods tab describes both rules.


Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ekcSchiano
2026-11-03 21:12:34 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent cc86343668
commit 963b08c522
15 changed files with 974 additions and 926 deletions
+16
View File
@@ -82,6 +82,22 @@ class Rows(unittest.TestCase):
r = code(NEW, company="1 Squadmate > Left them")
self.assertEqual((r["company"], r["left_squadmates"]), ("1 Squadmate", True))
def test_left_squadmates_unknown_before_the_answer_existed(self):
# "> Left them" was only offered from 2026-10-27: earlier or undated squad runs are unknown, not "stayed"
self.assertIsNone(code(NEW, company="1 Squadmate", timestamp="2026-10-20 10:00:00")["left_squadmates"])
self.assertIsNone(code(NEW, company="2 Squadmates", timestamp="Data Import")["left_squadmates"])
self.assertIs(code(NEW, company="1 Squadmate", timestamp="2026-10-28 10:00:00")["left_squadmates"], False)
self.assertIs(code(NEW, company="Alone", timestamp="2026-10-20 10:00:00")["left_squadmates"], False)
def test_letting_the_red_pass(self):
# only climbing down quickly puts you above the Red; passing on it and meeting the Greens means you let it pass
r = code(OLD, hour="Climbed the tallest tree", enc_Red="Changed my mind", enc_Green="Bonded!")
self.assertEqual((r["branch"], r["outcome_color"]), ("Descend quickly: let the Red pass", "Green"))
def test_red_and_greens_both_attempted_is_flagged(self):
r = code(OLD, hour="Climbed the tallest tree", enc_Red="Incinerated", enc_Green="Incinerated")
self.assertIn("both the Red and the two Greens", r["data_flags"])
def test_old_cadet_answer_and_fight_move(self):
r = code(OLD, cadet="Bullies > Squadmate's revenge", combat="Bullies > Even the numbers (Rushed the smaller cadet)", post="West")
self.assertEqual((r["scream"], r["resolution"], r["combat_first"], r["post_path"]),