Answer stability round 1: 0 🔴, 4 🟡 (0 misread); keep goals in Jira to projects whose plan is there, test the reviewer header's Jira read, drop the repeated premises tests
This commit is contained in:
@@ -1199,6 +1199,17 @@ class LarvReviewTool(unittest.TestCase):
|
||||
self.config.write_text(PROJECT_CONFIG.replace('"checkout:README.md"', '"folder:goals.md"'))
|
||||
self.assertEqual(self.header_line("Goals and audience:", "principles"), f"Goals and audience: {self.config.parent}/goals.md")
|
||||
|
||||
def test_reviewer_header_fails_naming_the_epic_where_it_cannot_read_goals_kept_in_jira(self):
|
||||
# Port 1 on the loopback refuses the connection, so the read fails without leaving the machine.
|
||||
epic = "jira:https://127.0.0.1:1/browse/ABC-12"
|
||||
credentials = self.config.parents[2] / "acme.env"
|
||||
credentials.write_text("ATLASSIAN_EMAIL=me@example.com\nATLASSIAN_API_TOKEN=s3cret\n")
|
||||
credentials.chmod(0o600)
|
||||
self.config.write_text(PROJECT_CONFIG.replace('"checkout:todo.md"', f'"{epic}"').replace('"checkout:README.md"', f'"{epic}"') + 'env-file = "~/acme.env"\n')
|
||||
ran = self.run_tool("reviewer-header", "prose")
|
||||
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
|
||||
self.assertIn("cannot read the epic ABC-12", ran.stderr)
|
||||
|
||||
def test_reviewer_header_fails_with_the_configs_message_where_it_sets_no_principles_folder(self):
|
||||
self.config.write_text(PROJECT_CONFIG.replace('principles = "~/principles"\n', ""))
|
||||
ran = self.run_tool("reviewer-header", "prose")
|
||||
|
||||
@@ -19,7 +19,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from routing_figures import archive, state
|
||||
from routing_figures.calls import Call
|
||||
from loop_claude.project import checkout, model_choice, premises, records
|
||||
from loop_claude.project import checkout, model_choice, records
|
||||
from loop_claude.cycle import chunk_items
|
||||
from loop_claude.loop import chunk_start, close
|
||||
from project_config.test_project_config import configured
|
||||
@@ -916,37 +916,6 @@ class RoutingCheck(unittest.TestCase):
|
||||
self.assertTrue(sent.startswith(f"loop-claude in {self.loop(fake).root} asks:\n\nloop-claude's routing figures call for a routing change:\n- {new[0].sentence()}\n"), sent)
|
||||
|
||||
|
||||
class Premises(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.root = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
|
||||
self.home = configured(self, self.root).parents[1]
|
||||
self.readme = self.root / "README.md"
|
||||
|
||||
def read(self) -> str | Failure:
|
||||
return premises.read_premises(str(self.root), self.home)
|
||||
|
||||
def test_quotes_the_goals_and_audience_under_the_goals_files_name(self) -> None:
|
||||
self.readme.write_text("# P\n## Goals\n1. g\n## Audience\nme\n")
|
||||
self.assertEqual(self.read(), f"{self.readme}:\n## Goals\n1. g\n\n## Audience\nme")
|
||||
|
||||
def test_each_failure_says_why_and_that_there_are_no_premises(self) -> None:
|
||||
for text, said in ((None, f"{self.readme} is missing or empty - no premises."), ("# P\n## Goals\n1. g\n", f"{self.readme} has no ## Audience heading - no premises.")):
|
||||
with self.subTest(said):
|
||||
self.readme.unlink(missing_ok=True)
|
||||
if text is not None:
|
||||
self.readme.write_text(text)
|
||||
self.assertEqual(self.read(), Failure(said))
|
||||
self.readme.unlink()
|
||||
self.readme.mkdir()
|
||||
self.assertEqual(self.read(), Failure(f"cannot read {self.readme}: Is a directory - no premises."))
|
||||
|
||||
def test_fails_where_no_config_names_the_checkout(self) -> None:
|
||||
found = premises.read_premises(str(self.root), self.root)
|
||||
assert isinstance(found, Failure), found
|
||||
self.assertTrue(found.reason.startswith("no config names the checkout"), found.reason)
|
||||
self.assertTrue(found.reason.endswith(" - no premises."), found.reason)
|
||||
|
||||
|
||||
class ModelPrompt(unittest.TestCase):
|
||||
OFFERED = [("claude-opus-5-5", "Opus 5.5"), ("claude-haiku-4-5", "Haiku 4.5")]
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ COMMIT_TITLE = "commit-title"
|
||||
PULL_REQUEST_TITLE = "pull-request-title"
|
||||
BRANCH = "branch"
|
||||
OPTIONAL = (BRANCH, COMMIT_TITLE, ENV_FILE, LANGUAGE, PULL_REQUEST_TITLE, WAIT_FOR_APPROVAL)
|
||||
# What opens a setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. Only `plan` and `goals-and-audience` may name something other than a path; the same spelling serves both, since the setting says what of the epic is meant.
|
||||
# What opens a setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. The settings below may name an epic; each reads its own part of it.
|
||||
JIRA = "jira:"
|
||||
EPIC_SPELLINGS = {
|
||||
"plan": '"jira:https://<site>/browse/<epic\'s key>" for a plan kept as a Jira Cloud epic\'s child issues',
|
||||
"goals-and-audience": '"jira:https://<site>/browse/<epic\'s key>" for goals and audience kept in a Jira Cloud epic\'s description',
|
||||
"plan": '"jira:https://<site>/browse/<epic\'s key>" for a plan kept as a Jira Cloud epic\'s child issues',
|
||||
}
|
||||
OUTSIDE = "a path that starts with / or ~/ and lies outside the checkout and the config's folder, so that no git remote receives the credentials"
|
||||
|
||||
@@ -47,7 +47,7 @@ class Epic:
|
||||
|
||||
@property
|
||||
def spelling(self) -> str:
|
||||
"""The epic as a config's `plan` setting spells it."""
|
||||
"""The epic as a config spells it."""
|
||||
return f"{JIRA}{self.site}/browse/{self.key}"
|
||||
|
||||
|
||||
@@ -133,6 +133,8 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo
|
||||
*(f"`{name}` is {values[name]!r}, not {SPELLING}" for name, path in paths.items() if path is None and name not in EPIC_SPELLINGS),
|
||||
*(f"`{name}` is {values[name]!r}, not {SPELLING}, or {EPIC_SPELLINGS[name]}" for name in EPIC_SPELLINGS if name in values and paths[name] is None and epics[name] is None),
|
||||
*(f"`{name}` names a Jira epic, so `{ENV_FILE}` must name the file that holds its credentials" for name, epic in epics.items() if epic and ENV_FILE not in values),
|
||||
# rule-hook ranks a plan kept as a file before tool calls, inside the hook's time limit, which a read from Jira mustn't hold up.
|
||||
*(["`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"`{WAIT_FOR_APPROVAL}` is {waits!r}, not true or false"] if not isinstance(waits, bool) else []),
|
||||
*(f"`{name}` is {values[name]!r}, {fault}" for name, check in checks.items() if name in values and (fault := check(values[name]))),
|
||||
@@ -143,7 +145,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo
|
||||
|
||||
|
||||
def epic_of(value: object) -> Epic | None:
|
||||
"""The epic a `plan` 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. Only https, so the credentials are never sent in the clear."""
|
||||
spelt = isinstance(value, str) and re.fullmatch(rf"{JIRA}(https://[A-Za-z0-9.-]+(?::[0-9]+)?)/browse/([A-Z][A-Z0-9_]*-[0-9]+)", value)
|
||||
return Epic(spelt.group(1), spelt.group(2)) if spelt else None
|
||||
|
||||
|
||||
@@ -117,11 +117,11 @@ class LoadTest(ConfigCase):
|
||||
config.unlink()
|
||||
|
||||
def test_goals_and_audience_spelt_as_a_jira_epic_is_no_path(self) -> None:
|
||||
self.write("acme", CLIENT.replace("folder:goals.md", JIRA_PLAN) + 'env-file = "~/acme.env"\n')
|
||||
self.write("acme", JIRA_CLIENT.replace("folder:goals.md", "jira:https://acme.atlassian.net/browse/ABC-7"))
|
||||
found = load(self.checkout, self.checkout, self.home)
|
||||
assert isinstance(found, ProjectConfig), found
|
||||
self.assertEqual((found.goals_epic, found.epic), (Epic("https://acme.atlassian.net", "ABC-12"), None))
|
||||
self.assertEqual(found.places["goals-and-audience"], JIRA_PLAN)
|
||||
self.assertEqual(found.goals_epic, Epic("https://acme.atlassian.net", "ABC-7"))
|
||||
self.assertEqual(found.places["goals-and-audience"], "jira:https://acme.atlassian.net/browse/ABC-7")
|
||||
self.assertEqual(tuple(found.places), SETTINGS)
|
||||
self.assertNotIn("goals-and-audience", found.paths)
|
||||
|
||||
@@ -131,6 +131,10 @@ class LoadTest(ConfigCase):
|
||||
assert isinstance(found, ProjectConfig), found
|
||||
self.assertEqual(found.goals_epic, found.epic)
|
||||
|
||||
def test_goals_in_jira_need_the_plan_in_jira(self) -> None:
|
||||
self.write("acme", CLIENT.replace("folder:goals.md", JIRA_PLAN) + 'env-file = "~/acme.env"\n')
|
||||
self.assertIn("`goals-and-audience` names a Jira epic, so `plan` must name one too", self.failure())
|
||||
|
||||
def test_goals_kept_as_a_file_have_no_epic(self) -> None:
|
||||
folder = self.write("acme", CLIENT)
|
||||
found = load(self.checkout, self.checkout, self.home)
|
||||
|
||||
@@ -6,7 +6,7 @@ paths:
|
||||
|
||||
# Goals and Audience
|
||||
|
||||
A project's goals and audience live in its goals file (`~/.claude/CLAUDE.md` → "Vocabulary"): `README.md`, or a client project's `goals.md` in its config's folder.
|
||||
A project's goals and audience live in its goals file (`~/.claude/CLAUDE.md` → "Vocabulary"): `README.md`, or a client project's `goals.md` in its config's folder or its plan epic's description in Jira.
|
||||
|
||||
- **Goals** state the project's aim and intent, not promises: one numbered line each, like slogans, in priority order; a sub-goal is indented under its goal — "1. Blazing fast performance. 2. Correctness is more important than many features." A goal names no step of the work, such as a check to run first, and rarely an implementation. How a goal is met goes in a method section further down the goals file and names the goal it serves. BANNED as a goal: `Kill weak candidates early, with the cheap checks first.` GOOD: the goal `Keep research on a budget, so it scales in both time and cost.`, with the cheap checks moved to the method section, naming that goal.
|
||||
- **Mark each goal `**Maintain:**` or `**Achieve:**`.** A maintain goal is a state to hold: a change that breaks it is redesigned or dropped, whatever its value to other goals. An achieve goal is a direction to pursue, weighed against the other achieve goals. Under each achieve goal, three indented bullets: `Signal:` what moving towards it looks like, `Counter-signal:` what shows it is bought at a wrong price, and `Why:` one line on how the two connect. A goal with sub-goals states its own signal. A maintain goal has no bullets. BANNED: an unmarked goal; an achieve goal with no signal; `**Achieve:** Delivery speed.` with the signal `faster`. GOOD: `**Achieve:** Delivery speed.` with `Signal: hours from a chunk's start to its merge fall.`, `Counter-signal: 🔴 findings per chunk rise.` and `Why: speed bought by skipping review shows up as defects.`
|
||||
|
||||
Reference in New Issue
Block a user