Retro records name the rulebook they ran under

Each retro record carries rules: a 12-hex sha256 of the loaded core rulebook plus the project's rules, its char count and its rule-line count, so work before and after a rule change can be compared.

Known: tests/test_core.py test_the_product_stays_small now fails (2293 lines vs the 2283 budget; this adds 10 lines).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-12-01 15:16:52 -07:00
1 parent 5e39baaa30
commit 2083bbbd78
2 files changed
+28 -2

No files matched your search

+16
View File
@@ -147,6 +147,22 @@ class Core(unittest.TestCase):
self.assertIn("Ask one question with options", book) # for all projects: in the rulebook itself
self.assertEqual(len(self.read(self.data, "retro.jsonl").splitlines()), 2)
def test_every_retro_record_names_the_rulebook_it_ran_under_and_a_new_rule_changes_it(self):
self.hook("tick")
self.hook("prompt", prompt="add the export")
self.done()
self.tool("Edit")
self.sisi("retro", *GAP, "--improve", "Compare row counts before and after every export change", sid="s1")
book = self.read(self.data, "generated", "core.md")
first = self.records()[-1]["rules"]
self.assertEqual(first, {"hash": hashlib.sha256(book.encode()).hexdigest()[:12], "chars": len(book),
"lines": sum(l.startswith("- ") for l in book.splitlines())})
self.assertEqual(self.sisi("learn", "Always name the rulebook in every retro record", sid="s1")[0], 0)
self.sisi("retro", *GAP, "--improve", "Name the rulebook in every retro record", sid="s1")
second = self.records()[-1]["rules"]
self.assertNotEqual(second["hash"], first["hash"])
self.assertGreater(second["lines"], first["lines"])
def test_a_retro_needs_real_sentences_and_no_gap_needs_its_evidence(self):
self.hook("tick")
self.done()