Update Planner and Reviewer packages for proof translation, typed escalation, and guardrails (v0.16.0)
planner-scope (schema 2, issueClaim unchanged) now translates the Specification Designer's requested proof, fast-test completeness, and declared test resources into Implementer fast checks and Building Inspector verification goals in Plan v1. A new escalation.md resolves Implementer needs_operator_decision and scope_exceeded flags inside the approved specification or promotes them, and escalates directly with one typed Layer C reason and a short risk summary, never downgrading operator_review_required. code-review-auto and code-review share a Trust Pyramid "Propose a guardrail" section (architecture/API boundary, then static check or fast regression test, then verification harness, then a candidate prose skill as last resort) and a typed "Escalate" section. planner-communication and reviewer-communication (schema 3) frame escalations and Review Packets. RELEASE-NOTES.md gives each package's before and after for fork maintainers; OVERRIDING.md and README.md record the new versions and seams. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d3b057510
commit
7c89205e06
17 files changed
+450
-45
No files matched your search
+8
-14
@@ -111,14 +111,6 @@ class PackageTests(unittest.TestCase):
|
||||
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, {"verification_incomplete", "behavioral_tradeoff", "unique_resource_needed"})
|
||||
|
||||
def test_automatic_review_is_only_extracted_presentation(self):
|
||||
package = ROOT / "packages/code-review-auto"
|
||||
check_package(package)
|
||||
text = (package / "SKILL.md").read_text()
|
||||
self.assertIn("path-aware, and actionable", text)
|
||||
self.assertNotIn("Report both axes", text)
|
||||
self.assertNotIn("subagent", text)
|
||||
|
||||
def test_handoff_clarification_method(self):
|
||||
package = ROOT / "packages/implementer-handoff"
|
||||
check_package(package)
|
||||
@@ -223,15 +215,15 @@ class PackageTests(unittest.TestCase):
|
||||
|
||||
def test_maintained_guidance_covers_distinct_role_steps(self):
|
||||
expected = {
|
||||
"planner-scope": ("planner", "planning", "scope.md", "Plan"),
|
||||
"implementer-handoff": ("implementer", "implementation", "handoff.md", "documentation"),
|
||||
"planner-scope": ("planner", "planning", "scope.md", "Plan", "v0.16.0"),
|
||||
"implementer-handoff": ("implementer", "implementation", "handoff.md", "documentation", "v0.13.0"),
|
||||
}
|
||||
for name, (role, step, resource, marker) in expected.items():
|
||||
for name, (role, step, resource, marker, release) in expected.items():
|
||||
with self.subTest(name=name):
|
||||
package = ROOT / "packages" / name
|
||||
manifest = json.loads((package / "relayview-skill.json").read_text())
|
||||
self.assertEqual((manifest["role"], manifest["step"]), (role, step))
|
||||
self.assertEqual(manifest["source"], {"kind": "first-party", "reference": "v0.13.0"})
|
||||
self.assertEqual(manifest["source"], {"kind": "first-party", "reference": release})
|
||||
self.assertIn(resource, [item["path"] for item in manifest["files"]])
|
||||
self.assertIn(marker, (package / "SKILL.md").read_text() + (package / resource).read_text())
|
||||
|
||||
@@ -304,13 +296,15 @@ class PackageTests(unittest.TestCase):
|
||||
def test_rejects_owner_incompatible_frontmatter_values(self):
|
||||
for old, new in (
|
||||
("metadata:\n", "disable-model-invocation: yes\nmetadata:\n"),
|
||||
("description: Check assigned issue scope, neighboring work, and verification before drafting a Plan.", "description: "),
|
||||
(r"^description: .+$", "description: "),
|
||||
):
|
||||
with self.subTest(new=new), tempfile.TemporaryDirectory() as directory:
|
||||
package = Path(directory) / "planner-scope"
|
||||
shutil.copytree(ROOT / "packages/planner-scope", package)
|
||||
skill = package / "SKILL.md"
|
||||
skill.write_text(skill.read_text().replace(old, new))
|
||||
changed = re.sub(old, new, skill.read_text(), count=1, flags=re.M)
|
||||
self.assertNotEqual(changed, skill.read_text())
|
||||
skill.write_text(changed)
|
||||
manifest = package / "relayview-skill.json"
|
||||
data = json.loads(manifest.read_text())
|
||||
next(item for item in data["files"] if item["path"] == "SKILL.md")["sha256"] = hashlib.sha256(skill.read_bytes()).hexdigest()
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
"""Pin the v0.16.0 Planner and Reviewer guidance: proof translation, typed
|
||||
Layer C escalation, and Trust Pyramid Guardrail Proposals."""
|
||||
|
||||
import json
|
||||
import re
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from tools.packages import check_package
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
VERSION = "0.16.0"
|
||||
|
||||
# name: (role, step, schema, sidecar extra, manual, declared files)
|
||||
PACKAGES = {
|
||||
"planner-scope": ("planner", "planning", 2, {"issueClaim": {"statusLabel": "status/in-progress"}}, False,
|
||||
["SKILL.md", "scope.md", "escalation.md"]),
|
||||
"planner-communication": ("planner", "planning", 3, {"treatment": "communication_context"}, False, ["SKILL.md"]),
|
||||
"code-review-auto": ("reviewer", "review", 1, {}, False, ["SKILL.md"]),
|
||||
"code-review": ("reviewer", "review", 1, {}, True, ["SKILL.md"]),
|
||||
"reviewer-communication": ("reviewer", "review", 3, {"treatment": "communication_context"}, False, ["SKILL.md"]),
|
||||
}
|
||||
|
||||
DIRECT_REASONS = ("boundary_crossed", "spec_ambiguity", "verification_incomplete",
|
||||
"behavioral_tradeoff", "convergence_exceeded")
|
||||
IMPLEMENTER_FLAGS = ("needs_operator_decision", "scope_exceeded")
|
||||
REVIEW_PACKAGES = ("code-review-auto", "code-review")
|
||||
|
||||
# The Trust Pyramid rungs, lowest (most deterministic) first.
|
||||
GUARDRAIL_LADDER = ("architecture or API boundary", "static check or lint rule",
|
||||
"verification harness", "candidate prose skill")
|
||||
|
||||
|
||||
def read(name):
|
||||
package = ROOT / "packages" / name
|
||||
manifest = json.loads((package / "relayview-skill.json").read_text())
|
||||
skill = (package / "SKILL.md").read_text()
|
||||
frontmatter, body = skill.split("---\n", 2)[1:]
|
||||
resources = "".join((package / item["path"]).read_text() for item in manifest["files"] if item["path"] != "SKILL.md")
|
||||
return manifest, frontmatter, body + resources
|
||||
|
||||
|
||||
def guardrail_section(text):
|
||||
match = re.search(r"^## Propose a guardrail\n.*?(?=^## |\Z)", text, re.M | re.S)
|
||||
if not match:
|
||||
raise AssertionError("no '## Propose a guardrail' section")
|
||||
return match.group(0)
|
||||
|
||||
|
||||
class PlannerReviewerReleaseTests(unittest.TestCase):
|
||||
def test_packages_release_together_and_keep_their_schemas(self):
|
||||
for name, (role, step, schema, extra, manual, 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"]), (role, step, 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.assertEqual("disable-model-invocation: true" in frontmatter, manual)
|
||||
|
||||
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 PlannerScopeTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.text = read("planner-scope")[2]
|
||||
|
||||
def test_translates_specification_proof_into_plan_v1(self):
|
||||
for phrase in ("Specification Designer", "requested proof artifact", "fast-test completeness",
|
||||
"declared test resource", "Plan v1", "Implementer fast check",
|
||||
"Building Inspector", "verification goal", "`requires_runtime_or_human_judgment`",
|
||||
"fast_checks:", "verification_goals:", "test_resources:"):
|
||||
with self.subTest(phrase=phrase):
|
||||
self.assertIn(phrase.lower(), self.text.lower())
|
||||
|
||||
def test_triages_implementer_flags(self):
|
||||
for flag in IMPLEMENTER_FLAGS:
|
||||
self.assertIn(f"`{flag}`", self.text)
|
||||
self.assertIn("strictly inside the approved specification", self.text)
|
||||
self.assertIn("promote", self.text)
|
||||
|
||||
def test_direct_escalation_discipline(self):
|
||||
for reason in DIRECT_REASONS:
|
||||
with self.subTest(reason=reason):
|
||||
self.assertIn(f"`{reason}`", self.text)
|
||||
for phrase in ("risk summary", "just to be safe", "never downgrade `operator_review_required`"):
|
||||
with self.subTest(phrase=phrase):
|
||||
self.assertIn(phrase, self.text)
|
||||
|
||||
|
||||
class ReviewerGuardrailTests(unittest.TestCase):
|
||||
def test_review_packages_share_one_guardrail_ladder(self):
|
||||
sections = {name: guardrail_section(read(name)[2]) for name in REVIEW_PACKAGES}
|
||||
self.assertEqual(sections["code-review-auto"], sections["code-review"])
|
||||
section = sections["code-review"]
|
||||
positions = [section.lower().index(rung.lower()) for rung in GUARDRAIL_LADDER]
|
||||
self.assertEqual(positions, sorted(positions), "rungs run from most to least deterministic")
|
||||
for phrase in ("lowest viable", "repeatable defect class", "root-cause", "fast regression test",
|
||||
"Feature Map", "last resort", "Operator approves"):
|
||||
with self.subTest(phrase=phrase):
|
||||
self.assertIn(phrase, section)
|
||||
|
||||
def test_review_escalation_uses_typed_reasons(self):
|
||||
for name in REVIEW_PACKAGES:
|
||||
text = read(name)[2]
|
||||
for reason in DIRECT_REASONS:
|
||||
with self.subTest(package=name, reason=reason):
|
||||
self.assertIn(f"`{reason}`", text)
|
||||
self.assertIn("never downgrade `operator_review_required`", text)
|
||||
self.assertIn("just to be safe", text)
|
||||
|
||||
def test_reviewer_prose_stays_out_of_owner_schemas(self):
|
||||
for name in REVIEW_PACKAGES + ("reviewer-communication", "planner-communication"):
|
||||
with self.subTest(package=name):
|
||||
text = read(name)[2]
|
||||
self.assertNotIn("```", text)
|
||||
self.assertNotIn("{", text)
|
||||
|
||||
def test_automatic_review_keeps_manual_inspection_out(self):
|
||||
text = read("code-review-auto")[2]
|
||||
self.assertIn("path-aware, and actionable", text)
|
||||
for phrase in ("Report both axes", "subagent"):
|
||||
self.assertNotIn(phrase, text)
|
||||
|
||||
|
||||
class CommunicationTests(unittest.TestCase):
|
||||
def test_planner_communication_frames_specification_and_escalation(self):
|
||||
text = read("planner-communication")[2]
|
||||
for phrase in ("Specification Designer", "typed reason", "risk summary", "proportional",
|
||||
"acknowledgement", "Markdown"):
|
||||
with self.subTest(phrase=phrase):
|
||||
self.assertIn(phrase, text)
|
||||
|
||||
def test_reviewer_communication_frames_review_packet_and_escalation(self):
|
||||
text = read("reviewer-communication")[2]
|
||||
for phrase in ("Review Packet", "typed reason", "risk summary", "Guardrail Proposal",
|
||||
"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")
|
||||
section = match.group(0)
|
||||
for name in PACKAGES:
|
||||
with self.subTest(package=name):
|
||||
entry = re.search(rf"^### `{name}`\n.*?(?=^### |\Z)", section, re.M | re.S)
|
||||
self.assertIsNotNone(entry, f"no entry for {name}")
|
||||
self.assertRegex(entry.group(0), r"\*\*Before \(\d+\.\d+\.\d+\):\*\*")
|
||||
self.assertIn("**After:**", entry.group(0))
|
||||
self.assertIn("**Fork:**", entry.group(0))
|
||||
self.assertIn("(RELEASE-NOTES.md)", (ROOT / "OVERRIDING.md").read_text())
|
||||
self.assertIn("(RELEASE-NOTES.md)", (ROOT / "README.md").read_text())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user