Answer stability round 1: 0 🔴, 7 🟡 (0 misread); parse the formula on load, require the scoring, share the bar rule and split add

This commit is contained in:
2026-11-16 03:07:39 +01:00
parent 727ed70ecb
commit cf1180734c
12 changed files with 109 additions and 71 deletions
+11 -6
View File
@@ -272,12 +272,17 @@ class CodeHealth(unittest.TestCase):
return SCORED.format(overall=overall).removeprefix("# Comprehension history\n\n").replace("2026-10-08T12", at).replace("PR #1 at aaaaaaa", read)
def test_a_plan_in_jira_weighs_the_goals_as_todo_md_does(self):
opted_out = "## review opt-out: the comprehension check\n\nCosts rounds.\n"
for decisions, history, floor in (("", SCORED.format(overall="6.99"), DEFAULT_FLOOR), ("", SCORED.format(overall="6.99"), decimal.Decimal("6.0")), (opted_out, "", DEFAULT_FLOOR)):
with self.subTest(decisions=decisions, history=history, floor=floor):
stated = ranking.config_scoring("V", 1, self.readme, decisions, history, floor)
read = ranking.read_scoring(self.todo, self.todo.split("\n"), self.readme, decisions, history, ranking.SHAPE, floor)
self.assertEqual(stated if isinstance(stated, Failure) else stated.weights, read if isinstance(read, Failure) else read.weights)
# As the two tests below: code health weighs 1 / 1.97 at or over the floor and four times that under it, goal 1 0.97 / 1.97.
for floor, code_health in ((DEFAULT_FLOOR, 4 / 1.97), (decimal.Decimal("6.0"), 1 / 1.97)):
with self.subTest(floor=floor):
stated = ranking.config_scoring("V", 1, self.readme, "", SCORED.format(overall="6.99"), floor)
assert not isinstance(stated, Failure), stated
self.assertEqual(set(stated.weights), {"code health", "1"})
self.assertAlmostEqual(stated.weights["code health"], code_health)
self.assertAlmostEqual(stated.weights["1"], 0.97 / 1.97)
opted_out = ranking.config_scoring("V", 1, self.readme, "## review opt-out: the comprehension check\n\nCosts rounds.\n", "", DEFAULT_FLOOR)
assert isinstance(opted_out, Failure), opted_out
self.assertTrue(opted_out.reason.startswith("docs/decisions.md opts out of the comprehension check"), opted_out.reason)
def test_ranks_code_health_first_among_the_achieve_goals_at_an_overall_of_7_or_above(self):
# Code health, then goal 1: weights 1 / 1.97 and 0.97 / 1.97, an item moving one by 1 at S 1 scoring 50 times its weight.