Answer stability round 1: 1 🔴, 6 🟡 (2 misread); read the scoring rule from the clone, hand windows XDG_DATA_HOME, retry the home check where nobody watches, tell an unreadable sign-in status and settings file apart, and bound the claude commands that build the home
CI / tests (pull_request) Successful in 4m35s

This commit is contained in:
2026-12-04 02:45:02 +01:00
parent 71865e0479
commit 3519922f01
19 changed files with 153 additions and 69 deletions
+10 -20
View File
@@ -21,6 +21,7 @@ from build_epic.config import load
from build_epic.backend.fake import MemoryEpic
from plan.todo_table import parse_moves
from build_epic import planning
from loop_state.paths import RELEASE_ROOT
RANKED = "## Goals\n1. **Achieve:** Ship the import.\n\n## Audience\nThe client's team.\n\n## Scoring\n`Score = V`\n"
GOALS = "## Goals\n\n**Void:** code health, since it is a one-off script.\n\n1. **Achieve:** Serve the API.\n\n## Audience\nIts callers.\n"
@@ -54,11 +55,6 @@ class Planning(BuildEpicTest):
issues, stopped = planning.planned(epic, read)
return issues if stopped is None else stopped, store, out.getvalue()
def rule(self) -> None:
"""Writes the rule every plan item is scored by."""
(self.home / planning.RULE).parent.mkdir(parents=True, exist_ok=True)
(self.home / planning.RULE).write_text("L is how much the item changes.\n", encoding="utf-8")
def repo(self, name: str) -> None:
"""Checks out the repo called name, whose goals file voids code health and states one achieve goal."""
checkout = self.home / "code" / name
@@ -378,7 +374,9 @@ class Planning(BuildEpicTest):
self.assertEqual(self.plan(FakeEffects())[0], self.issues)
def test_scores_each_bare_issue_whoever_filed_it_and_tells_its_team_without_ranking_a_persons(self) -> None:
self.rule()
# The person's own Claude home may hold an older release's rule, which the scoring doesn't read.
(self.home / ".claude/rules").mkdir(parents=True)
(self.home / ".claude/rules/todo-items.md").write_text("An older release's rule.\n", encoding="utf-8")
self.description = RANKED
self.issues = [scored("ABC-20", "epic 1 by 2", "build-epic-claude", by_loop=False), issue("ABC-21", "build-epic-claude")]
# An earlier run made the folder the scoring runs in.
@@ -392,12 +390,12 @@ class Planning(BuildEpicTest):
self.assertEqual(out, "<1790000000> scoring ABC-21\n<1790000000> ABC-21 is scored L 2, E 1, I 2, S 3, Moves epic 1 by 9\n")
self.assertEqual(planning.start_order(self.epic, found), ["ABC-21", "ABC-20"])
(asked,) = fake.made("claude")
for part in ("L is how much the item changes.", "Write the comment in English", "An item moves only these: `epic 1`.", "## Item ABC-21: Do ABC-21", "Labels: build-epic-claude"):
self.assertNotIn("An older release's rule.", asked[1])
for part in ((RELEASE_ROOT / "rules/todo-items.md").read_text(encoding="utf-8"), "Write the comment in English", "An item moves only these: `epic 1`.", "## Item ABC-21: Do ABC-21", "Labels: build-epic-claude"):
self.assertIn(part, asked[1])
self.assertIn("--json-schema", asked[0])
def test_scores_no_human_task_and_no_issue_that_is_the_only_one_to_start(self) -> None:
self.rule()
self.description = RANKED
self.issues = [issue("ABC-20", "build-epic-claude"), issue("ABC-21", "build-epic-human")]
fake = FakeEffects()
@@ -407,7 +405,6 @@ class Planning(BuildEpicTest):
def test_scores_no_issue_whose_work_has_landed(self) -> None:
with (self.home / ".config/build-release/build-epic/config.toml").open("a", encoding="utf-8") as config:
config.write('\njira-unblocking-statuses = ["Release Ready"]\n')
self.rule()
self.description = RANKED
self.issues = [issue("ABC-20", "build-epic-claude", status="release ready"), issue("ABC-21", "build-epic-claude"), scored("ABC-22", "epic 1 by 2", "build-epic-claude")]
fake = FakeEffects(claude=[says(ANSWER)])
@@ -417,7 +414,6 @@ class Planning(BuildEpicTest):
self.assertEqual(planning.start_order(self.epic, found), ["ABC-21", "ABC-22"])
def test_names_an_issue_whose_scoring_fails_and_scores_the_next(self) -> None:
self.rule()
self.description = RANKED
self.issues = [issue("ABC-20", "build-epic-claude"), issue("ABC-21", "build-epic-claude"), issue("ABC-22", "build-epic-claude"), issue("ABC-23", "build-epic-claude")]
fake = FakeEffects(claude=[says({"L": "big"}), says(ANSWER | {"moves": "epic 7 by 5"}), says(ANSWER | {"L": 99}), says(ANSWER)])
@@ -432,7 +428,6 @@ class Planning(BuildEpicTest):
self.assertEqual(planning.start_order(self.epic, found), ["ABC-23"])
def test_names_each_issue_whose_goals_cannot_be_read_and_asks_claude_about_none(self) -> None:
self.rule()
self.description = RANKED.replace("1. **Achieve:** ", "")
self.issues = [issue("ABC-20", "build-epic-claude"), issue("ABC-21", "build-epic-claude")]
fake = FakeEffects()
@@ -442,7 +437,6 @@ class Planning(BuildEpicTest):
self.assertEqual(fake.made("claude"), [])
def test_the_scoring_call_runs_in_the_epics_state_folder(self) -> None:
self.rule()
self.issues = [issue("ABC-20", "build-epic-claude"), issue("ABC-21", "build-epic-claude")]
effects, folders = FakeEffects(claude=[says(ANSWER), says(ANSWER)]).effects(), []
@@ -455,7 +449,6 @@ class Planning(BuildEpicTest):
planning.planned(epic, list(self.issues))
self.assertEqual(folders, [str(self.folder)] * 2)
self.rule()
self.description = RANKED
self.issues = [issue("ABC-20", "build-epic-claude"), issue("ABC-21", "build-epic-claude")]
fake = FakeEffects(claude=[subprocess.CompletedProcess([], 0, json.dumps(LIMIT), "")])
@@ -464,7 +457,6 @@ class Planning(BuildEpicTest):
self.assertEqual((store.writes, len(fake.made("claude"))), ([], 1))
def test_names_a_score_the_tracker_refuses(self) -> None:
self.rule()
self.description = RANKED
self.issues = [issue("ABC-20", "build-epic-claude"), issue("ABC-21", "build-epic-human"), scored("ABC-22", "epic 1 by 2", "build-epic-claude")]
store = MemoryEpic("ABC-12", list(self.issues))
@@ -478,13 +470,12 @@ class Planning(BuildEpicTest):
self.assertEqual((found, stopped, out.getvalue()), (self.issues, None, "<1790000000> scoring ABC-20\n<1790000000> ABC-20 is not scored: Jira answered 503\n"))
def test_scores_no_issue_without_the_scoring_rule_or_the_epics_formula(self) -> None:
# A clone without the rule, here the test's home folder.
rule = planning.scoring_rule(self.home)
assert isinstance(rule, Failure), rule
self.assertIn(f"cannot read the scoring rule {self.home}/rules/todo-items.md, so no issue is scored: ", rule.reason)
self.issues = [issue("ABC-20", "build-epic-claude"), issue("ABC-21", "build-epic-claude")]
self.description = RANKED
fake = FakeEffects()
found, _, _ = self.plan(fake)
assert isinstance(found, Failure), found
self.assertIn(f"cannot read the scoring rule {self.home}/.claude/rules/todo-items.md, so no issue is scored: ", found.reason)
self.rule()
self.description = "## Goals\n1. **Achieve:** Ship the import.\n\n## Audience\nThe client's team.\n\n## Scoring\n"
found, _, _ = self.plan(fake)
assert isinstance(found, Failure), found
@@ -492,7 +483,6 @@ class Planning(BuildEpicTest):
self.assertEqual(fake.made("claude"), [])
def test_scores_a_sub_task_on_its_own_against_its_repos_goals_in_the_epics_language(self) -> None:
self.rule()
self.repo("api")
self.description = RANKED + "\n**Language:** Swedish\n"
self.issues = [issue("ABC-20", "split-by-repo"), issue("ABC-30", "repo:api", parent="ABC-20"), scored("ABC-21", "epic 1 by 2", "build-epic-claude")]