Let a project's config allow its tooling on the host and set its readability floor
CI / tests (pull_request) Successful in 3m3s

This commit is contained in:
2026-11-14 21:43:51 +01:00
parent fc5e78ba88
commit c97e4ad21b
23 changed files with 212 additions and 68 deletions
+7 -4
View File
@@ -4,15 +4,16 @@ The config's `plan` setting names the backend. A path names a markdown file, tod
A tool that reads what a past commit held, such as `score-outcomes`, still parses that commit's todo.md itself, with `release_plan.todo_table`: only the markdown backend has commits, and todo.md's items 365, 366 and 368 port those tools to the other backends."""
import dataclasses
import decimal
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 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
from plan_store import markdown_edits
from project_config.settings import ProjectConfig
from release_plan import ranking
from release_plan.release import Release
from text_files.file_writes import replace_file
@@ -77,6 +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
@property
def label(self) -> str:
@@ -104,7 +107,7 @@ class FilePlan:
def kept(self, id_: int, text: str, texts: tuple[str, str, str, str]) -> Written | Failure:
"""Ranks text, the file with item id_ filed or edited, and writes it where the item scores at the bar or above."""
ranked = ranking.rank(text, *texts[1:])
ranked = ranking.rank(text, *texts[1:], self.floor)
if isinstance(ranked, Failure):
return ranked
# The write may lower another item under the bar, which the notes then say; the write is refused only where the written item itself scores under the bar.
@@ -119,7 +122,7 @@ class FilePlan:
text = markdown_edits.finished(texts[0], id_, self.label)
if isinstance(text, Failure):
return text
ranked = ranking.rank(text, *texts[1:])
ranked = ranking.rank(text, *texts[1:], self.floor)
return ranked if isinstance(ranked, Failure) else self.written(id_, ranked)
def written(self, id_: int, ranked: ranking.Ranked) -> Written | Failure:
@@ -159,7 +162,7 @@ def store(config: ProjectConfig) -> PlanStore:
def file_plan(config: ProjectConfig, path: pathlib.Path | None = None) -> FilePlan:
"""The markdown file config names as its plan, for a tool that works on the file itself, as ranking does. path stands in for the configured one where given."""
return FilePlan(path or config.paths["plan"], config.tracked("plan"), goals_store(config), record_store(config, "decisions"), record_store(config, "comprehension-history"))
return FilePlan(path or config.paths["plan"], config.tracked("plan"), goals_store(config), record_store(config, "decisions"), record_store(config, "comprehension-history"), config.readability_floor)
def held_at(revision: str, plan: PlanStore, cwd: str, run: Git = git) -> Plan | Failure: