Answer round 1: check the model against the ladder, keep faults together, fix prose
CI / tests (pull_request) Successful in 2m36s

This commit is contained in:
2026-11-18 10:28:39 +01:00
parent b34d1087ca
commit b93d3799c3
5 changed files with 43 additions and 22 deletions
+6 -6
View File
@@ -17,7 +17,7 @@ from plan.ranking import variables
PROJECTS = ".claude-projects"
CONFIG = "config.toml"
# The folder of do-epic's machine-wide settings, which names no checkout. No project may use it as its key.
# The key of do-epic's machine-wide settings: the folder's config.toml has no `checkout`, so no project may use the key.
DO_EPIC = "do-epic"
# A Jira Cloud or Confluence Cloud site's address: only https, so the credentials are never sent in the clear.
SITE = r"https://[A-Za-z0-9.-]+(?::[0-9]+)?"
@@ -294,13 +294,13 @@ def name_of(value: object) -> str | None:
def epic_of(value: object) -> Epic | None:
"""The epic a setting's value spells; None where it spells none. Only https, so the credentials are never sent in the clear."""
"""The epic a setting's value spells; None where it spells none."""
spelt = isinstance(value, str) and re.fullmatch(rf"{JIRA}({SITE})/browse/([A-Z][A-Z0-9_]*-[0-9]+)", value)
return Epic(spelt.group(1), spelt.group(2)) if spelt else None
def page_of(value: object) -> Page | None:
"""The page a setting's value spells; None where it spells none. Only https, as for an epic."""
"""The page a setting's value spells; None where it spells none."""
spelt = isinstance(value, str) and re.fullmatch(rf"{CONFLUENCE}({SITE})/wiki/spaces/[^/?#]+/pages/([0-9]+)(?:/[^/?#]*)?", value)
return Page(spelt.group(1), spelt.group(2), spelt.string) if spelt else None
@@ -351,18 +351,18 @@ def held(folder: pathlib.Path, home: pathlib.Path) -> ProjectConfig | Failure |
def configs(home: pathlib.Path) -> list[pathlib.Path]:
"""Every project's config file under home, in key order. do-epic's is no project's."""
"""Every project's config file under home, in key order. do-epic's machine-wide config is not a project's."""
return sorted(file for file in (home / PROJECTS).glob(f"*/{CONFIG}") if file.parent.name != DO_EPIC)
def env_files(home: pathlib.Path) -> list[pathlib.Path]:
"""Every config's env-file, do-epic's included, read without the checks load makes, so a config that fails them still keeps its credentials guarded; a config that cannot be read names none."""
"""Every config's env-file, do-epic's included. Each is read without the checks load makes, so a config that fails them still keeps its credentials guarded. A config that can't be read doesn't name one."""
values = [parsed(file) for file in (*configs(home), home / PROJECTS / DO_EPIC / CONFIG)]
return [path for found in values if not isinstance(found, Failure) and (path := anywhere(found.get(ENV_FILE), home))]
def parsed(file: pathlib.Path) -> dict[str, object] | Failure:
"""The TOML values file holds."""
"""The TOML values in file; a Failure where file can't be read or parsed."""
try:
return tomllib.loads(file.read_text(encoding="utf-8"))
except (OSError, UnicodeDecodeError, tomllib.TOMLDecodeError) as failure: