Files
relayview-skills/tests/test_implementer.py
T
adminandClaude Opus 5.5 3e7d96dcc3
Check instruction packages / check (push) Successful in 9s
Check instruction packages / check (pull_request) Successful in 9s
Address review pass 2: one home for report items, complete trigger docs
implementer-handoff's SKILL.md now defers its report items to handoff.md's
review content, which gains the documentation disposition and manual-evidence
observer, so forking handoff.md changes the report as OVERRIDING.md says.
SKILL.md's flag sentence points at the guide's triggers. OVERRIDING lists the
unsettled-tradeoff trigger, and the release notes describe all three SKILL.md
sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 23:31:15 -05:00

161 lines
8.2 KiB
Python

"""Pin the v0.16.0 Implementer guidance: tight inner-loop convergence on fast
checks before sealing, and indirect escalation through the Planner."""
import re
import unittest
from tests.test_planner_reviewer import DIRECT_REASONS, IMPLEMENTER_FLAGS, ROOT, VERSION, read
from tools.packages import check_package
# name: (schema, sidecar extra, declared files)
PACKAGES = {
"implementer-handoff": (1, {}, ["SKILL.md", "handoff.md"]),
"implementer-communication": (3, {"treatment": "communication_context"}, ["SKILL.md"]),
}
class ImplementerReleaseTests(unittest.TestCase):
def test_packages_move_to_v0_16_0_with_unchanged_schemas(self):
for name, (schema, extra, files) in PACKAGES.items():
with self.subTest(package=name):
check_package(ROOT / "packages" / name)
manifest, frontmatter, _ = read(name)
self.assertEqual(manifest["source"], {"kind": "first-party", "reference": f"v{VERSION}"})
self.assertEqual((manifest["role"], manifest["step"], manifest["schemaVersion"]),
("implementer", "implementation", schema))
for key, value in extra.items():
self.assertEqual(manifest[key], value)
self.assertEqual([item["path"] for item in manifest["files"]], files)
self.assertIn(f"relayview-version: {VERSION}", frontmatter)
self.assertNotIn("disable-model-invocation", frontmatter)
def test_prose_stays_out_of_owner_report_and_flag_schemas(self):
# No JSON objects or code fences, and no snake_case, camelCase, or
# PascalCase identifiers beyond the two flag names and the existing
# documentation disposition value.
for name in PACKAGES:
with self.subTest(package=name):
text = read(name)[2]
self.assertNotIn("```", text)
self.assertNotIn("{", text)
identifiers = set(re.findall(r"\b\w+_\w+\b|\b[a-z]+[A-Z]\w*\b|\b[A-Z][a-z]+[A-Z]\w*\b", text))
self.assertLessEqual(identifiers, set(IMPLEMENTER_FLAGS) | {"not_required"})
def test_packages_use_specification_designer_terminology(self):
for name in PACKAGES:
with self.subTest(package=name):
self.assertNotRegex(read(name)[2], r"(?i)issue designer")
class InnerLoopTests(unittest.TestCase):
def setUp(self):
self.text = read("implementer-handoff")[2]
def test_converges_fast_checks_before_sealing(self):
for phrase in ("fast check", "seconds, not minutes", "types, lint, static analysis",
"unit and integration tests", "Plan", "Planner feedback",
"before sealing", "Building Inspector", "until they pass",
"the exact candidate you seal"):
with self.subTest(phrase=phrase):
self.assertIn(phrase.lower(), self.text.lower())
def test_does_not_seal_a_failing_candidate_as_ready(self):
# A fast check that cannot pass is reported, never presented as ready.
self.assertIn("do not present the candidate as ready", self.text)
# Sealing is the owner's gate: the prose guides the Implementer toward
# it rather than restating it, so a check that can never pass still
# ends in a report instead of a step that cannot finish.
for gate in ("Seal a candidate only when", "complete when the fast checks pass"):
with self.subTest(gate=gate):
self.assertNotIn(gate, self.text)
# A failing check is a scope flag only when the fix leaves the Plan.
self.assertIn("raise `scope_exceeded` only when", self.text)
def test_handoff_guide_owns_the_forkable_rules(self):
# Like planner-scope's escalation guide, the resource carries the
# rules, so forking handoff.md alone changes the inner loop and flags.
handoff = (ROOT / "packages/implementer-handoff/handoff.md").read_text()
skill = (ROOT / "packages/implementer-handoff/SKILL.md").read_text()
for rule in ("seconds, not minutes", "types, lint, static analysis", "genuine specification ambiguity",
"Do not page the Operator", "silently improvise", "test-resource readiness", "known gaps",
"documentation disposition"):
with self.subTest(rule=rule):
self.assertIn(rule, handoff)
self.assertNotIn(rule, skill)
def test_reports_test_resource_readiness_and_known_gaps(self):
for phrase in ("declared test-resource", "readiness", "known gap", "verification goal",
"remaining manual Operator check"):
with self.subTest(phrase=phrase):
self.assertIn(phrase.lower(), self.text.lower())
def test_keeps_existing_clarification_method(self):
handoff = (ROOT / "packages/implementer-handoff/handoff.md").read_text()
self.assertIn("blocked after reasonable investigation", handoff)
self.assertIn("scope changes require owner authority", handoff)
class IndirectEscalationTests(unittest.TestCase):
def setUp(self):
self.text = read("implementer-handoff")[2]
def test_flags_go_to_the_planner_not_the_operator(self):
for flag in IMPLEMENTER_FLAGS:
with self.subTest(flag=flag):
self.assertIn(f"`{flag}`", self.text)
for phrase in ("to the Planner", "Do not page the Operator", "silently improvise",
"genuine specification ambiguity", "unexpected sensitive boundary", "scope creep",
"just to be safe", "flag interface the owner assigns",
"Where none is assigned"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, self.text)
def test_implementer_never_escalates_directly(self):
# Typed Layer C reasons belong to the Planner, Reviewer, and Tester; the
# Implementer only flags, so no direct reason appears in its packages.
for name in PACKAGES:
text = read(name)[2]
for reason in DIRECT_REASONS:
with self.subTest(package=name, reason=reason):
self.assertNotIn(reason, text)
class CommunicationTests(unittest.TestCase):
def test_communication_frames_handoffs_and_flags(self):
text = read("implementer-communication")[2]
for phrase in ("Specification Designer", "fast check", "candidate", "known gap",
"`needs_operator_decision`", "`scope_exceeded`", "Planner",
"options", "evidence", "meanwhile",
"proportional", "acknowledgement", "Markdown"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, text)
class ReleaseNotesTests(unittest.TestCase):
def test_release_notes_give_before_and_after_for_each_package(self):
notes = (ROOT / "RELEASE-NOTES.md").read_text()
match = re.search(rf"^## v{re.escape(VERSION)}\b.*?(?=^## |\Z)", notes, re.M | re.S)
self.assertIsNotNone(match, "no v0.16.0 section")
for name in PACKAGES:
with self.subTest(package=name):
entry = re.search(rf"^### `{name}`\n.*?(?=^### |\Z)", match.group(0), re.M | re.S)
self.assertIsNotNone(entry, f"no entry for {name}")
self.assertIn("**Before (0.13.0):**", entry.group(0))
self.assertIn("**After:**", entry.group(0))
self.assertIn("**Fork:**", entry.group(0))
def test_overriding_names_the_implementer_seams(self):
text = (ROOT / "OVERRIDING.md").read_text()
match = re.search(r"^### Implementer inner-loop and flag packages\n.*?(?=^##)", text, re.M | re.S)
self.assertIsNotNone(match, "no Implementer section in OVERRIDING.md")
for phrase in ("`implementer-handoff`", "`handoff.md`", "`implementer-communication`",
"`needs_operator_decision`", "`scope_exceeded`", "(RELEASE-NOTES.md)",
"genuine specification ambiguity", "unexpected sensitive boundary",
"visible tradeoff", "scope creep"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, match.group(0))
if __name__ == "__main__":
unittest.main()