Answer stability round 2: 0 🔴, 0 🟡 (0 misread); weigh each chain's first achieve goal 1 under an epic without one

This commit is contained in:
2026-11-18 17:03:26 +01:00
parent 74766df97a
commit a9074901ca
2 changed files with 8 additions and 6 deletions
+3 -3
View File
@@ -62,7 +62,7 @@ def ranked(items: list[EpicItem], formula: str, epic_goals: str, repos: dict[str
def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, own: RepoRanking | None) -> ranking.Scoring | Failure:
"""How an item in repo scores: the chain's goals, and what each achieve goal weighs. The bar is 0, since a bar decides what is filed, and the order holds every item that was.
goal_weights scales a chain's weights to sum to 1. Here they are scaled so that the epic's achieve goals sum to 1 instead, in every chain, which makes the scores of items in different repos comparable.
goal_weights scales a chain's weights to sum to 1. Here they are scaled so that the epic's achieve goals sum to 1 instead, in every chain, or the chain's first achieve goal weighs 1 where the epic has none, which makes the scores of items in different repos comparable.
Code health and a maintain goal weigh by the rules every project's plan follows, which an epic doesn't change: code health weighs four times its place while its repo is unmeasured or under its readability floor, and plan/ranking.py's weight_of weighs a maintain goal. Either may then outweigh an achieve goal of the epic. "The epic wins" in the decision settles the epic's goals against a repo's, and code health is neither's: it is every project's, and a repo that is hard to read costs each epic item worked in it."""
goals = chain(epic_goals, repo, own)
@@ -80,8 +80,8 @@ def chain_scoring(formula: ast.Expression, epic_goals: str, repo: str | None, ow
return weights
achieve = [goal for goal, mark in goals if mark == "Achieve"]
of_epic = len([goal for goal in achieve if goal.startswith(EPIC_GOAL)])
# An epic without an achieve goal leaves each chain summing to 1.
scale = total(len(achieve)) / total(of_epic) if of_epic else 1
# Under an epic without an achieve goal, the first achieve goal of each chain weighs 1.
scale = total(len(achieve)) / (total(of_epic) or 1)
return ranking.Scoring(SHAPE, formula, 0, 0, dict(goals), {goal: weight * scale for goal, weight in weights.items()})
+5 -3
View File
@@ -90,10 +90,12 @@ class RankedTest(unittest.TestCase):
for (_, value), expected in zip(found, (9.7 / TOTAL, 9.7 / TOTAL, 10 * 0.97**2 / TOTAL)):
self.assertAlmostEqual(value, expected)
def test_an_epic_without_an_achieve_goal_leaves_each_repos_weights_summing_to_1(self) -> None:
found = ranked([item(1, "repo 1 by 10")], "V", "1. **Maintain:** Leak no customer data.\n", {"billing-api": VOIDED})
def test_an_epic_without_an_achieve_goal_weighs_each_repos_first_achieve_goal_1(self) -> None:
two = dataclasses.replace(VOIDED, goals_text=VOIDED.goals_text + "2. **Achieve:** Small images.\n")
found = ranked([item(1, "repo 1 by 10"), item(2, "repo 1 by 10", repo="web"), item(3, "repo 2 by 10", repo="web")], "V", "1. **Maintain:** Leak no customer data.\n", {"billing-api": VOIDED, "web": two})
assert not isinstance(found, Failure), found
self.assertAlmostEqual(found[0][1], 10)
for (_, value), expected in zip(found, (10, 10, 9.7)):
self.assertAlmostEqual(value, expected)
def test_an_item_without_a_score_fails_naming_it(self) -> None:
unscored = EpicItem(dataclasses.replace(item(4, "").item, scores={}), None)