Answer stability round 2: 0 🔴, 2 🟡 (0 misread); keep Python's reason in the unreadable-template message and pin fragments of the messages
CI / tests (pull_request) Has been cancelled

This commit is contained in:
Lilleman
2026-11-20 11:07:02 +01:00
parent c39d23a1b3
commit e0b2068230
3 changed files with 10 additions and 9 deletions
+3 -3
View File
@@ -86,14 +86,14 @@ def label_repo_faults(table: object) -> list[str]:
def summary_template_faults(template: object) -> list[str]:
"""What is wrong with the SUB_TASK_SUMMARY template: a value that isn't one line, that holds a brace Python can't read, a field other than `{label}` and `{Summary}`, a format after a field's name, or no `{Summary}`."""
"""What is wrong with the SUB_TASK_SUMMARY template: a value that isn't one line, that Python can't read as a template, a field other than `{label}` and `{Summary}`, a format after a field's name, or no `{Summary}`."""
example = "`\"{label}: {Summary}\"`"
if not isinstance(template, str) or "\n" in template:
return [f"`{SUB_TASK_SUMMARY}` is {template!r}, not one line of text such as {example}"]
try:
fields = [(name, spec, conversion) for _, name, spec, conversion in string.Formatter().parse(template) if name is not None]
except ValueError:
return [f"`{SUB_TASK_SUMMARY}` is {template!r}, which has a brace that stands alone; write a brace that is plain text as {{{{ or }}}}"]
except ValueError as failure:
return [f"`{SUB_TASK_SUMMARY}` is {template!r}, which Python can't read as a template ({failure}); write a brace that is plain text as {{{{ or }}}}"]
names = [name for name, _, _ in fields]
return [
*(f"`{SUB_TASK_SUMMARY}` names {{{name}}}, and only {{label}} and {{Summary}} are known" for name in dict.fromkeys(names) if name not in ("label", "Summary")),
+6 -5
View File
@@ -76,11 +76,12 @@ class ConfigTest(unittest.TestCase):
for line, fault in (
("sub-task-summary = 4", "`sub-task-summary` is 4, not one line of text"),
('sub-task-summary = "a\\nb {Summary}"', "not one line of text"),
('sub-task-summary = "{label}"', "`sub-task-summary` lacks {Summary}, so no sub-task's summary would say what changes in it, such as `\"{label}: {Summary}\"`"),
('sub-task-summary = "{label}: {Summary} {repo}"', "`sub-task-summary` names {repo}, and only {label} and {Summary} are known"),
('sub-task-summary = "{Summary:>9}"', "`sub-task-summary` writes {Summary:>9} with something after the name; write {Summary} alone"),
('sub-task-summary = "{Summary} {label!r}"', "`sub-task-summary` writes {label!r} with something after the name; write {label} alone"),
('sub-task-summary = "{Summary"', "`sub-task-summary` is '{Summary', which has a brace that stands alone; write a brace that is plain text as {{ or }}"),
('sub-task-summary = "{label}"', "`sub-task-summary` lacks {Summary}"),
('sub-task-summary = "{label}: {Summary} {repo}"', "names {repo}, and only {label} and {Summary} are known"),
('sub-task-summary = "{Summary:>9}"', "writes {Summary:>9} with something after the name; write {Summary} alone"),
('sub-task-summary = "{Summary} {label!r}"', "writes {label!r} with something after the name; write {label} alone"),
('sub-task-summary = "{Summary!}"', "`sub-task-summary` is '{Summary!}', which Python can't read as a template ("),
('sub-task-summary = "{Summary"', "`sub-task-summary` is '{Summary', which Python can't read as a template ("),
):
with self.subTest(line=line):
self.write(SETTINGS + line + "\n")
+1 -1
View File
@@ -189,7 +189,7 @@ class Planning(DoEpicTest):
fake = FakeEffects(claude=[says({"parts": []}), says({"pick": "unclear", "question": "api or web?"})], inputs=["api", "backend"])
found, _, _ = self.plan(fake)
self.assertEqual(found, [issue("ABC-20", "backend")])
self.assertIn("`api` is none of those labels; the repo api's label is `backend`\n", self.asked.getvalue())
self.assertIn("the repo api's label is `backend`", self.asked.getvalue())
def test_asks_the_human_for_the_label_of_an_issue_the_rule_leaves_unclear_until_one_is_typed(self) -> None:
self.issues = [issue("ABC-20")]