diff --git a/bin/deploy_release/cut.py b/bin/deploy_release/cut.py index 0ee55f03..8910d21e 100644 --- a/bin/deploy_release/cut.py +++ b/bin/deploy_release/cut.py @@ -9,6 +9,7 @@ import sys import tempfile from release_plan.release_standing import chunk_item, Cut, default_plan, Next, ReadyToCut, ReviewDue, Unplanned +from project_config.settings import DEFAULT_FLOOR from git_cli.git_repo import default_ref, git from deploy_release.deploy import deploy from failure import Failure @@ -109,9 +110,9 @@ def same_origin(clone: str, checkout: str) -> Failure | None: def clone_plan(clone: str) -> FilePlan: - """The clone's plan, at the path this repo keeps it. ready_release only reads it; FilePlan also takes the files a write would rank it against.""" + """The clone's plan, at the path this repo keeps it. ready_release only reads it; FilePlan also takes the files and the floor a write would rank it against, and the clone has no config to set the floor.""" goals, decisions, history = (FileStore(pathlib.Path(clone, path), path) for path in ("README.md", "docs/decisions.md", "docs/comprehension-history.md")) - return FilePlan(pathlib.Path(clone, "todo.md"), "todo.md", goals, decisions, history) + return FilePlan(pathlib.Path(clone, "todo.md"), "todo.md", goals, decisions, history, DEFAULT_FLOOR) def ready_release(clone: str, ref: str) -> Release | Failure: diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 17819b82..17bfd05d 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -162,7 +162,7 @@ class Seats(unittest.TestCase): def test_checkout_plan_fails_on_a_missing_or_tableless_todo(self): with tempfile.TemporaryDirectory() as checkout: path = pathlib.Path(checkout, "todo.md") - plan = FilePlan(path, "todo.md", FileStore(pathlib.Path(checkout, "README.md"), None), MemoryStore(), MemoryStore()) + plan = FilePlan(path, "todo.md", FileStore(pathlib.Path(checkout, "README.md"), None), MemoryStore(), MemoryStore(), DEFAULT_FLOOR) with self.subTest("missing"): self.assertEqual(checkout_plan(plan).reason, f"the project's plan: {path}: not found; every project keeps a todo.md, and rank_todo.py --help shows one") with self.subTest("no items table"): @@ -844,6 +844,11 @@ class LarvReviewTool(unittest.TestCase): self.assertEqual(ran.returncode, 0, ran.stderr) self.assertIn("\nMeans: ", ran.stdout) self.assertNotIn("Floor:", ran.stdout) + self.config.write_text(PROJECT_CONFIG + "readability-floor = 6.8\n") + ran = self.run_tool("record-scoring", self.seats_file(f"PR #3 at {self.start}\n" + seats), "1") + self.assertEqual(ran.returncode, 0, ran.stderr) + self.assertIn("\nFloor: Locality 6.50, Self-sufficiency 6.50 under the floor of 6.8.\nNext: file one floor item,", ran.stdout) + self.assertIn("until every mean reaches 6.8,", ran.stdout) def test_records_a_scoring_run_with_its_means(self): line = "Navigation 7, Locality 6.5, Shape 7, Self-sufficiency 6.5, Overall 7" diff --git a/bin/plan_store/stores.py b/bin/plan_store/stores.py index 26a209fc..c8eeedb3 100644 --- a/bin/plan_store/stores.py +++ b/bin/plan_store/stores.py @@ -9,7 +9,7 @@ import pathlib import typing from release_plan.todo_table import BLOCKED_BY, Item, item_details, items, MOVES, NoItemsTable, renames -from project_config.settings import DEFAULT_FLOOR, ProjectConfig +from project_config.settings import ProjectConfig from failure import Failure from git_cli.git_repo import file_at, git, Git from record_store.stores import goals_store, store as record_store, RecordStore @@ -78,8 +78,8 @@ class FilePlan: goals: RecordStore decisions: RecordStore history: RecordStore - # The project's readability floor, at which ranking weighs code health. - floor: decimal.Decimal = DEFAULT_FLOOR + # The project's readability floor: while the comprehension overall is under it, ranking weighs code health 4 times as much. + floor: decimal.Decimal @property def label(self) -> str: diff --git a/bin/plan_store/test_stores.py b/bin/plan_store/test_stores.py index eda82eb4..36070937 100644 --- a/bin/plan_store/test_stores.py +++ b/bin/plan_store/test_stores.py @@ -8,7 +8,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from project_config.settings import Epic, ProjectConfig, SETTINGS +from project_config.settings import DEFAULT_FLOOR, Epic, ProjectConfig, SETTINGS from failure import Failure from record_store.stores import FileStore from plan_store.contract import FIRST, MOVES, PlanStoreContract, SECOND @@ -35,7 +35,7 @@ class FilePlanContract(PlanStoreContract, unittest.TestCase): def new_store(self) -> stores.FilePlan: (self.folder / "todo.md").write_text(EMPTY) (self.folder / "README.md").write_text(README) - return stores.FilePlan(self.folder / "todo.md", "todo.md", FileStore(self.folder / "README.md", None), MemoryStore(), MemoryStore()) + return stores.FilePlan(self.folder / "todo.md", "todo.md", FileStore(self.folder / "README.md", None), MemoryStore(), MemoryStore(), DEFAULT_FLOOR) class FilePlan(FilePlanContract): @@ -151,7 +151,7 @@ class FilePlan(FilePlanContract): def test_ranks_every_write_with_its_floor(self): - # At an overall of 6.50 code health weighs 4 times under the default floor of 7.0, and once under 6.0. + # At an overall of 6.50 code health weighs 4 times under the default floor of 7.0, and once at a floor of 6.0. def health_row(floor): store = dataclasses.replace(self.new_store(), history=MemoryStore(SCORED.format(overall="6.50")), floor=decimal.Decimal(floor)) (self.folder / "README.md").write_text(README.replace(VOID, "")) diff --git a/bin/project_config/settings.py b/bin/project_config/settings.py index 421c11ed..42d3d365 100644 --- a/bin/project_config/settings.py +++ b/bin/project_config/settings.py @@ -19,11 +19,11 @@ SETTINGS = ("plan", "working-rules", "decisions", "score-anchors", "comprehensio SPELLING = '"checkout:" for a path in the checkout, "folder:" for one in the config\'s folder, or a path that starts with / or ~/' # A path setting a project may leave out: the file of KEY=value credentials its tools read. It has no default either: a project without it asks for no credentials, and never reads another project's. ENV_FILE = "env-file" -# The optional boolean setting: whether `chunk-pr merge` waits for a human's approval of the pull request. False where left out. +# An optional boolean setting: whether `chunk-pr merge` waits for a human's approval of the pull request. False where left out. WAIT_FOR_APPROVAL = "wait-for-approval" -# The optional boolean setting that lets the loop run the project's language runtime, package manager and task runner on the host, for a project with no container setup. False where left out. +# An optional boolean setting: whether the loop may run the project's language runtime, package manager, tests and task runner on the host, for a project with no container setup. False where left out. TOOLING_ON_HOST = "tooling-on-host" -# The optional number setting: the comprehension panel's overall score under which code health is very important, since legacy code scores low. Readers seated as the human who writes the config picked both names, 2 of 3 each. +# An optional number setting: the comprehension score under which code health is very important. A legacy project, whose code scores low, may lower it. READABILITY_FLOOR = "readability-floor" # The floor where the config leaves it out, which every dimension and the overall should reach; docs/decisions.md → "comprehension floor" says it doesn't block anything. DEFAULT_FLOOR = decimal.Decimal("7.0") @@ -149,7 +149,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo *(["`goals-and-audience` names a Jira epic, so `plan` must name one too"] if epics["goals-and-audience"] and not epics["plan"] else []), *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not {OUTSIDE}"] if misplaced else []), *(f"`{name}` is {value!r}, not true or false" for name, value in ((WAIT_FOR_APPROVAL, waits), (TOOLING_ON_HOST, on_host)) if not isinstance(value, bool)), - *([f"`{READABILITY_FLOOR}` is {values[READABILITY_FLOOR]!r}, not a number from 1 to 10, such as 7.0"] if floor is None else []), + *([f"`{READABILITY_FLOOR}` is {values[READABILITY_FLOOR]!r}, not a number from 1 to 10; write a bare number, such as `{READABILITY_FLOOR} = 7.0`"] if floor is None else []), *(f"`{name}` is {values[name]!r}, {fault}" for name, check in checks.items() if name in values and (fault := check(values[name]))), ] if faults: @@ -167,7 +167,8 @@ def epic_of(value: object) -> Epic | None: def floor_of(value: object) -> decimal.Decimal | None: """The floor value spells, an integer or a float from 1 to 10; None where it spells none. Not a string, nor a boolean, which Python counts as an integer, nor TOML's nan or inf.""" - if isinstance(value, bool) or not isinstance(value, int | float) or not math.isfinite(value): + # An integer too large for a float makes math.isfinite raise, so only a float is checked. + if isinstance(value, bool) or not isinstance(value, int | float) or (isinstance(value, float) and not math.isfinite(value)): return None floor = decimal.Decimal(str(value)) return floor if 1 <= floor <= 10 else None diff --git a/bin/project_config/test_project_config.py b/bin/project_config/test_project_config.py index d195281b..e924381b 100644 --- a/bin/project_config/test_project_config.py +++ b/bin/project_config/test_project_config.py @@ -312,13 +312,13 @@ class LoadTest(ConfigCase): def test_a_readability_floor_that_is_no_number_from_1_to_10_fails_naming_it(self) -> None: folder = self.write("acme", CLIENT) - for spelled in ('"7.0"', "0.5", "11", "true", "nan", "inf"): + for spelled in ('"7.0"', "0.5", "11", "true", "nan", "inf", "1" + "0" * 400): with self.subTest(spelled): (folder / "config.toml").write_text(CLIENT + f"readability-floor = {spelled}\n") found = load(self.checkout, self.checkout, self.home) assert isinstance(found, Failure), found self.assertIn("`readability-floor` is ", found.reason) - self.assertIn(", not a number from 1 to 10, such as 7.0", found.reason) + self.assertIn(", not a number from 1 to 10; write a bare number, such as `readability-floor = 7.0`", found.reason) def test_the_language_and_the_templates_are_optional_and_default_to_english_bare_summaries_and_item_branches(self) -> None: folder = self.write("acme", CLIENT) diff --git a/bin/release_plan/ranking.py b/bin/release_plan/ranking.py index 100c9d32..df985a38 100644 --- a/bin/release_plan/ranking.py +++ b/bin/release_plan/ranking.py @@ -10,7 +10,6 @@ import typing from release_plan.todo_table import BLOCKED_BY, cells, CODE_HEALTH, DETAILS, Exempt, HEADER_START, Item, item_details, items_table, MOVES, OLD_SHAPE, parse_row, renames, risk, Shape, SHAPE, shape_of, Table, table_rows from release_plan.blockers import blocked_through, blockers_first from release_plan.citations import check_citations -from project_config.settings import DEFAULT_FLOOR from release_plan.formula import evaluate, parse_formula from failure import Failure from release_plan.goals_file import goal_weights, Mark, ranked_goals @@ -46,7 +45,7 @@ class Ranked: notes: list[str] -def rank(text: str, goals_text: str, decisions: str, history: str, floor: decimal.Decimal = DEFAULT_FLOOR) -> Ranked | Failure: +def rank(text: str, goals_text: str, decisions: str, history: str, floor: decimal.Decimal) -> Ranked | Failure: """floor is the project's readability floor, which its config sets.""" lines = text.split("\n") table = read_table(lines) diff --git a/bin/release_plan/test_blockers.py b/bin/release_plan/test_blockers.py index 0a0ad213..f6680cd6 100644 --- a/bin/release_plan/test_blockers.py +++ b/bin/release_plan/test_blockers.py @@ -6,13 +6,14 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from release_plan.test_ranking import DECISIONS, README, TODO +from project_config.settings import DEFAULT_FLOOR from failure import Failure from release_plan import ranking, todo_table class Blockers(unittest.TestCase): def ranked(self, todo): - return ranking.rank(todo, README, DECISIONS, "") + return ranking.rank(todo, README, DECISIONS, "", DEFAULT_FLOOR) def test_ranks_each_blocker_just_above_the_first_item_it_blocks(self): ranked = self.ranked(TODO.replace("| 3 | 0.1.0 | |", "| 3 | 0.1.0 | 5, 2 |")) diff --git a/bin/release_plan/test_formula.py b/bin/release_plan/test_formula.py index 02e2dbdb..2250c2ca 100644 --- a/bin/release_plan/test_formula.py +++ b/bin/release_plan/test_formula.py @@ -5,13 +5,14 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from release_plan.test_ranking import DECISIONS, README, TODO +from project_config.settings import DEFAULT_FLOOR from failure import Failure from release_plan import ranking class Formula(unittest.TestCase): def ranked(self, todo): - return ranking.rank(todo, README, DECISIONS, "") + return ranking.rank(todo, README, DECISIONS, "", DEFAULT_FLOOR) def test_refuses_a_formula_that_is_more_than_arithmetic_over_the_scores(self): for formula in ("__import__('os')", "R.real", "X + 1", "C + 1", "A + V", "G + V", "W * V", "R ^ 2", "R +", "R / (S - 2)", "R\x00", "1" * 400, " + ".join(["R"] * 300), "-" * 100000 + "R", "10 ** 10 ** 10", "(-8) ** (1 / 3)", "0 ** -1"): diff --git a/bin/release_plan/test_ranking.py b/bin/release_plan/test_ranking.py index f7dedfb3..f96bb301 100644 --- a/bin/release_plan/test_ranking.py +++ b/bin/release_plan/test_ranking.py @@ -109,7 +109,7 @@ def numbered_goals(goals_text): class Rank(unittest.TestCase): def ranked(self, todo=TODO, readme=README, decisions=DECISIONS): - return ranking.rank(todo, readme, decisions, "") + return ranking.rank(todo, readme, decisions, "", DEFAULT_FLOOR) def test_scores_and_sorts_by_release_then_security_then_score_and_orders_the_details_to_match(self): ranked = self.ranked() @@ -264,7 +264,7 @@ class CodeHealth(unittest.TestCase): todo = TODO.split("| 1 | 0.2.0", 1)[0].replace("`Bar = 2`", "`Bar = 0.1`") + "| 1 | 0.1.0 | | | **Read easier.** | 1 | 1 | 1 | 1 | 1 | code health by 1 | 0 |\n| 2 | 0.1.0 | | | **Do A.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 0 |\n" def scores(self, history, readme=readme): - ranked = ranking.rank(self.todo, readme, "", history) + ranked = ranking.rank(self.todo, readme, "", history, DEFAULT_FLOOR) return ranked if isinstance(ranked, Failure) else {line.split(" | ")[0]: line.rsplit(" | ", 1)[1].rstrip(" |") for line in ranked.text.splitlines() if line.startswith("| ") and " 0.1.0 " in line} def entry(self, overall, at="2026-10-08T12", read="PR #1 at aaaaaaa"): @@ -322,7 +322,7 @@ class CodeHealth(unittest.TestCase): def test_drops_code_health_where_readme_voids_it(self): voided = "## Goals\n\n**Void:** code health, since it is a one-off script.\n\n1. **Achieve:** A.\n" self.assertEqual(self.scores("", voided), Failure("item 1 names code health, which the goals file voids; drop it from the item's Moves, or the void from the goals file")) - ranked = ranking.rank(self.todo.replace("code health by 1", "1 by 2"), voided, "", "") + ranked = ranking.rank(self.todo.replace("code health by 1", "1 by 2"), voided, "", "", DEFAULT_FLOOR) self.assertIn("| **Read easier.** | 1 | 1 | 1 | 1 | 1 | 1 by 2 | 100.0 |", ranked.text) def test_weighs_a_defects_maintain_goal_as_code_health_four_times_over_under_an_overall_of_7(self): @@ -330,18 +330,18 @@ class CodeHealth(unittest.TestCase): todo = self.todo.replace("| 2 | 0.1.0 | | | **Do A.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 |", "| 2 | 0.1.0 | | defect | **Restore B.** | 1 | 1 | 1 | 1 | 1 | 2 by 1 |") for history, value in (("", "101.5"), (SCORED.format(overall="7.00"), "25.4")): with self.subTest(history=history): - self.assertIn(f"| **Restore B.** | 1 | 1 | 1 | 1 | 1 | 2 by 1 | {value} |", ranking.rank(todo, readme, "", history).text) + self.assertIn(f"| **Restore B.** | 1 | 1 | 1 | 1 | 1 | 2 by 1 | {value} |", ranking.rank(todo, readme, "", history, DEFAULT_FLOOR).text) def test_refuses_a_plan_whose_project_opts_out_of_the_comprehension_check_yet_keeps_code_health(self): opted_out = "## review opt-out: the architect and the comprehension check\n\nCosts rounds.\n" - self.assertEqual(ranking.rank(self.todo, self.readme, opted_out, ""), Failure("docs/decisions.md opts out of the comprehension check, so code health has no signal; void it in the goals file's ## Goals with `**Void:** code health, since .`, as ~/.claude/CLAUDE.md → 'Shared goal' says")) - self.assertIsInstance(ranking.rank(self.todo, self.readme, opted_out.replace(" and the comprehension check", ""), ""), ranking.Ranked) + self.assertEqual(ranking.rank(self.todo, self.readme, opted_out, "", DEFAULT_FLOOR), Failure("docs/decisions.md opts out of the comprehension check, so code health has no signal; void it in the goals file's ## Goals with `**Void:** code health, since .`, as ~/.claude/CLAUDE.md → 'Shared goal' says")) + self.assertIsInstance(ranking.rank(self.todo, self.readme, opted_out.replace(" and the comprehension check", ""), "", DEFAULT_FLOOR), ranking.Ranked) voided = "## Goals\n\n**Void:** code health, since nobody reads the probes.\n\n1. **Achieve:** A.\n" - self.assertIsInstance(ranking.rank(self.todo.replace("code health by 1", "1 by 2"), voided, opted_out, ""), ranking.Ranked) + self.assertIsInstance(ranking.rank(self.todo.replace("code health by 1", "1 by 2"), voided, opted_out, "", DEFAULT_FLOOR), ranking.Ranked) def test_ranks_a_project_that_voids_code_health_whatever_its_history_holds(self): voided = "## Goals\n\n**Void:** code health, since it is a one-off script.\n\n1. **Achieve:** A.\n" - self.assertIsInstance(ranking.rank(self.todo.replace("code health by 1", "1 by 2"), voided, "", SCORED.format(overall="high")), ranking.Ranked) + self.assertIsInstance(ranking.rank(self.todo.replace("code health by 1", "1 by 2"), voided, "", SCORED.format(overall="high"), DEFAULT_FLOOR), ranking.Ranked) def test_refuses_a_void_of_anything_but_code_health(self): self.assertEqual(self.scores("", "## Goals\n\n**Void:** speed, since nobody waits.\n\n1. **Achieve:** A.\n"), Failure("the goals file's ## Goals voids `speed, since nobody waits.`; only code health may be voided, as `**Void:** code health, since .`")) @@ -371,7 +371,7 @@ class CodeHealth(unittest.TestCase): self.assertIn("| code health by 1 | 25.4 |", todo.read_text()) def test_ranks_and_checks_with_the_floor_the_config_sets(self): - # At an overall of 6.50, code health weighs 4 times under the default floor of 7.0, and once under 6.0. + # At an overall of 6.50, code health weighs 4 times under the default floor of 7.0, and once at a floor of 6.0. with tempfile.TemporaryDirectory() as temp: todo = pathlib.Path(temp, "todo.md") todo.write_text(self.todo) @@ -391,7 +391,7 @@ class CodeHealth(unittest.TestCase): class Risk(unittest.TestCase): """R is L + E + I - 2, which rank_todo.py writes, at least 7 when I is 5 and at least 5 when I is 4.""" def ranked(self, todo): - return ranking.rank(todo, README, DECISIONS, "") + return ranking.rank(todo, README, DECISIONS, "", DEFAULT_FLOOR) def test_writes_r_from_l_e_and_i_over_a_stale_or_missing_r(self): ranked = self.ranked(TODO).text @@ -440,7 +440,7 @@ class Risk(unittest.TestCase): class OldShape(unittest.TestCase): """A table with A, G and Goals, from before the Moves column, ranks by the formula and goal weights it states until its project reshapes it.""" def ranked(self, todo=OLD_SHAPE, readme=README): - return ranking.rank(todo, readme, DECISIONS, "") + return ranking.rank(todo, readme, DECISIONS, "", DEFAULT_FLOOR) def test_scores_by_the_stated_weights_and_says_to_reshape(self): ranked = self.ranked() @@ -467,7 +467,7 @@ class OldShape(unittest.TestCase): def test_ranks_a_table_from_before_c_joined_and_says_to_reshape_it(self): legacy = OLD_SHAPE.split("## Items")[0] + "## Items\n\n| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |\n|---|---|---|---|---|---|---|---|---|---|\n| 2 | 0.1.0 | | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |\n" - self.assertEqual(ranking.rank(legacy, README, "", "").notes, [ranking.RESHAPE]) + self.assertEqual(ranking.rank(legacy, README, "", "", DEFAULT_FLOOR).notes, [ranking.RESHAPE]) def test_refuses_a_table_with_both_moves_and_goals(self): both = OLD_SHAPE.replace("| Goals | Score |\n|---|", "| Goals | Moves | Score |\n|---|---|").replace(" | 0 |\n", " | 1 by 1 | 0 |\n") @@ -477,7 +477,7 @@ class OldShape(unittest.TestCase): def test_names_the_goals_column_a_table_misspells_by_its_shape(self): misspelt = TODO.replace("| S | Moves |", "| S | Move |") - self.assertEqual(ranking.rank(misspelt, README, DECISIONS, ""), Failure("todo.md's items table has no Moves column; rank_todo.py --help shows a valid one")) + self.assertEqual(ranking.rank(misspelt, README, DECISIONS, "", DEFAULT_FLOOR), Failure("todo.md's items table has no Moves column; rank_todo.py --help shows a valid one")) self.assertEqual(todo_table.items(misspelt), Failure("todo.md's items table has no Moves column; rank_todo.py --help shows a valid one")) self.assertEqual(self.ranked(OLD_SHAPE.replace("| G | Goals |", "| G | Goal |")), Failure("todo.md's items table has no Goals column; rank_todo.py --help shows a valid one")) @@ -492,15 +492,15 @@ class Renamed(unittest.TestCase): self.assertIsInstance(todo_table.renames(f"## Renamed\n\n{bad}\n"), Failure) def test_fails_on_a_renamed_section_that_does_not_parse(self): - failed = ranking.rank(TODO + "\n## Renamed\n\nsoon\n", README, DECISIONS, "") + failed = ranking.rank(TODO + "\n## Renamed\n\nsoon\n", README, DECISIONS, "", DEFAULT_FLOOR) self.assertIsInstance(failed, Failure) self.assertIn("## Renamed", failed.reason) def test_ranks_a_plan_with_a_valid_renamed_section(self): - self.assertIsInstance(ranking.rank(TODO + "\n## Renamed\n\n- 0.3.0 renamed to 0.4.0\n", README, DECISIONS, ""), ranking.Ranked) + self.assertIsInstance(ranking.rank(TODO + "\n## Renamed\n\n- 0.3.0 renamed to 0.4.0\n", README, DECISIONS, "", DEFAULT_FLOOR), ranking.Ranked) def test_fails_on_an_item_filed_under_a_release_the_plan_marks_renamed(self): - live = ranking.rank(TODO + "\n## Renamed\n\n- 0.2.0 renamed to 0.3.0\n", README, DECISIONS, "") + live = ranking.rank(TODO + "\n## Renamed\n\n- 0.2.0 renamed to 0.3.0\n", README, DECISIONS, "", DEFAULT_FLOOR) self.assertIsInstance(live, Failure) self.assertIn("marks release 0.2.0 renamed but files item 1 under it", live.reason) @@ -509,5 +509,5 @@ class Renamed(unittest.TestCase): class ThisRepo(unittest.TestCase): def test_todo_md_is_ranked_with_nothing_under_the_bar(self): text = (ROOT / "todo.md").read_text(encoding="utf-8") - ranked = ranking.rank(text, *((ROOT / name).read_text(encoding="utf-8") for name in ("README.md", "docs/decisions.md", "docs/comprehension-history.md"))) + ranked = ranking.rank(text, *((ROOT / name).read_text(encoding="utf-8") for name in ("README.md", "docs/decisions.md", "docs/comprehension-history.md")), DEFAULT_FLOOR) self.assertEqual(ranked, ranking.Ranked(text, [], [])) diff --git a/bin/release_plan/test_release_standing.py b/bin/release_plan/test_release_standing.py index a0de4d48..5158b0f2 100644 --- a/bin/release_plan/test_release_standing.py +++ b/bin/release_plan/test_release_standing.py @@ -14,7 +14,7 @@ from record_store.stores import FileStore from test_env import isolated_env from record_store.fakes import MemoryStore from release_plan.todo_table import NoItemsTable -from project_config.settings import ProjectConfig, SETTINGS +from project_config.settings import DEFAULT_FLOOR, ProjectConfig, SETTINGS from release_plan import release_standing from release_plan import todo_table from release_plan.release import version @@ -26,7 +26,7 @@ ROW = "| {id} | {release} | | | **Do {id}.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10 def plan_at(path: pathlib.Path, tracked: str | None) -> FilePlan: """The markdown plan at path, which these tests only read.""" - return FilePlan(path, tracked, FileStore(path.parent / "README.md", None), MemoryStore(), MemoryStore()) + return FilePlan(path, tracked, FileStore(path.parent / "README.md", None), MemoryStore(), MemoryStore(), DEFAULT_FLOOR) def plan_in(repo: str) -> FilePlan: diff --git a/bin/todo_item/test_todo_item.py b/bin/todo_item/test_todo_item.py index e58ea34b..48ae1f54 100644 --- a/bin/todo_item/test_todo_item.py +++ b/bin/todo_item/test_todo_item.py @@ -9,6 +9,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent)) from project_config.test_project_config import configured from release_plan.test_ranking import DECISIONS, README, TODO +from project_config.settings import DEFAULT_FLOOR from todo_item import edits, main from failure import Failure from project_config.main import located @@ -41,7 +42,7 @@ class TodoItem(unittest.TestCase): (self.folder / "README.md").write_text(README) (self.folder / "docs").mkdir() (self.folder / "docs" / "decisions.md").write_text(DECISIONS) - ranked = ranking.rank(TODO, README, DECISIONS, "") + ranked = ranking.rank(TODO, README, DECISIONS, "", DEFAULT_FLOOR) assert not isinstance(ranked, ranking.Failure) self.todo.write_text(ranked.text)