Files
relayview-skills/tests/test_feature_map.py
T
adminandClaude Opus 5.5 dfa875ad5a
Check instruction packages / check (push) Successful in 5s
Check instruction packages / check (pull_request) Successful in 7s
Add Feature Map verification and release verification packages (v0.18.0)
implementer-handoff maps modified paths to the repository's Feature Map
entries, runs the mapped fast checks in the inner loop and the mapped
Verification Driver checks on the exact candidate before sealing, and
reports Feature Map coverage. tester-inspection drives inspection through
Feature Map entrypoints and the Verification Driver and adds exact Feature
Map coverage to the Verification Proof Bundle beside the remaining manual
checks. The new manual coordinator-release-verify plans and launches a
bounded, isolated release or exploratory run through the owner's command
and returns repro-backed candidate bug drafts for triage. Each package
falls back to its earlier behavior when a repository has no Feature Map.
OVERRIDING, README, the package contract, and release notes describe the
seams and the proposed owner boundary.

Refs #29

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

244 lines
13 KiB
Python

"""Pin the v0.18.0 Feature Map verification guidance: mapped inner-loop checks
for the Implementer, Feature Map-driven inspection and coverage for the Tester,
and the manual outer-loop release verification method for the Coordinator."""
import json
import re
import unittest
from tests.test_overriding import section as guide_section, table_rows
from tests.test_planner_reviewer import DIRECT_REASONS, IMPLEMENTER_FLAGS, ROOT, read
from tools.packages import check_package
VERSION = "0.18.0"
TESTER_REASONS = ("verification_incomplete", "behavioral_tradeoff", "unique_resource_needed")
# name: (role, step, schema, manual, declared files, previous version or None for a new package)
PACKAGES = {
"implementer-handoff": ("implementer", "implementation", 1, False, ["SKILL.md", "handoff.md"], "0.16.0"),
"tester-inspection": ("tester", "testing", 1, False, ["SKILL.md", "inspection.md"], "0.15.0"),
"coordinator-release-verify": ("coordinator", "coordination", 1, True, ["SKILL.md"], None),
}
IDENTIFIER = r"\b\w+_\w+\b|\b[a-z]+[A-Z]\w*\b|\b[A-Z][a-z]+[A-Z]\w*\b"
def text_of(name, path):
return (ROOT / "packages" / name / path).read_text()
class ReleaseTests(unittest.TestCase):
def test_packages_move_to_v0_18_0_with_their_schemas(self):
for name, (role, step, schema, 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))
self.assertEqual(set(manifest), {"schemaVersion", "source", "role", "step", "files"})
self.assertEqual([item["path"] for item in manifest["files"]], files)
self.assertIn(f"relayview-version: {VERSION}", frontmatter)
self.assertEqual(bool(re.search(r"(?m)^disable-model-invocation: true$", frontmatter)), manual)
self.assertRegex(frontmatter, r"(?i)feature map")
def test_prose_stays_out_of_owner_schemas(self):
# No JSON objects or code fences, and no snake_case, camelCase, or
# PascalCase identifiers beyond each role's existing vocabulary: the
# Feature Map's own schema belongs to the owner, not to the prose.
allowed = {
"implementer-handoff": set(IMPLEMENTER_FLAGS) | {"not_required"},
"tester-inspection": set(TESTER_REASONS),
"coordinator-release-verify": set(),
}
for name, names in allowed.items():
with self.subTest(package=name):
text = read(name)[2]
self.assertNotIn("```", text)
self.assertNotIn("{", text)
self.assertLessEqual(set(re.findall(IDENTIFIER, text)), names)
def test_feature_map_guidance_falls_back_when_the_repository_has_none(self):
for name in PACKAGES:
with self.subTest(package=name):
text = read(name)[2]
self.assertIn("Feature Map", text)
self.assertIn("Verification Driver", text)
self.assertRegex(text, r"has no Feature Map")
self.assertNotRegex(text, r"(?i)issue designer")
def test_no_throwaway_verification_scripts(self):
for name in PACKAGES:
with self.subTest(package=name):
self.assertIn("throwaway", read(name)[2])
class ImplementerFeatureMapTests(unittest.TestCase):
def setUp(self):
self.handoff = text_of("implementer-handoff", "handoff.md")
self.skill = text_of("implementer-handoff", "SKILL.md")
def test_maps_modified_paths_and_runs_mapped_checks_in_the_inner_loop(self):
for phrase in ("modified path", "owning paths", "Feature Map entr", "mapped fast checks",
"Verification Driver", "after each change", "exact candidate", "before sealing"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, self.handoff)
def test_reports_feature_map_coverage_and_unmapped_paths(self):
review = self.handoff[self.handoff.index("## Review content"):]
for phrase in ("Feature Map coverage", "unmapped", "not run"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, review)
def test_does_not_edit_the_feature_map_outside_the_plan(self):
self.assertIn("Change the Feature Map only when the Plan", self.handoff)
def test_runtime_driver_checks_needing_a_missing_resource_go_to_the_inspector(self):
self.assertIn("leave it to the Building Inspector", self.handoff)
def test_the_handoff_guide_still_owns_the_rules(self):
for rule in ("owning paths", "mapped fast checks", "Feature Map coverage"):
with self.subTest(rule=rule):
self.assertIn(rule, self.handoff)
self.assertNotIn(rule, self.skill)
self.assertIn("Feature Map", self.skill)
def test_implementer_still_never_escalates_directly(self):
text = read("implementer-handoff")[2]
for reason in DIRECT_REASONS:
with self.subTest(reason=reason):
self.assertNotIn(reason, text)
class TesterFeatureMapTests(unittest.TestCase):
def setUp(self):
self.method = text_of("tester-inspection", "inspection.md")
self.text = read("tester-inspection")[2]
def test_drives_inspection_through_feature_map_entries_and_the_driver(self):
for phrase in ("Feature Map entr", "entrypoint", "Verification Driver", "multimodal",
"screenshot", "recording"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, self.text)
def test_verifies_independently_of_the_implementer(self):
self.assertIn("Run every check yourself on the sealed candidate", self.method)
self.assertIn("exit status alone is not an observation", self.method)
def test_bundle_reports_exact_feature_map_coverage_beside_manual_checks(self):
bundle = self.method[self.method.index("## Assemble the Verification Proof Bundle"):
self.method.index("## Escalate with a typed reason")]
for phrase in ("**Feature Map coverage:**", "exercised", "not exercised",
"remaining manual Operator check", "Feature Map gap"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, bundle)
self.assertLess(bundle.index("**Feature Map coverage:**"), bundle.index("**Remaining manual Operator checks:**"))
def test_never_edits_the_feature_map_or_driver(self):
self.assertIn("never edit the Feature Map or the Verification Driver", self.text)
def test_keeps_the_building_inspector_method(self):
for phrase in ("Building Inspector", "never substitute a mock", "Verification Proof Bundle",
"verified runtime observations", *TESTER_REASONS):
with self.subTest(phrase=phrase):
self.assertIn(phrase.lower(), self.text.lower())
class ReleaseVerifyTests(unittest.TestCase):
def setUp(self):
self.text = text_of("coordinator-release-verify", "SKILL.md")
def test_is_a_manual_coordinator_method(self):
for phrase in ("/skill:coordinator-release-verify", "release", "merge", "the Operator"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, self.text)
def test_runs_are_bounded_isolated_and_launched_through_the_owner(self):
for phrase in ("exact revision", "bound", "budget", "isolat", "never mutate",
"owner's release verification command", "Lease Registry",
"exploratory", "property", "seed",
"leave repository code and shell commands to the roles that own them"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, self.text)
# Without an owner command, the method proposes a run plan instead of improvising.
self.assertIn("no release verification command is assigned", self.text)
def test_drafts_repro_backed_candidate_bug_specifications(self):
for phrase in ("candidate bug draft", "Specification Designer", "reproduce", "repro steps",
"expected", "observed", "logs", "screenshots", "recordings",
"Feature Map entry", "duplicate"):
with self.subTest(phrase=phrase):
self.assertIn(phrase.lower(), self.text.lower())
# A defect is drafted only when it reproduced; a one-off failure is reported apart.
self.assertIn("Draft a defect only when it reproduced", self.text)
def test_never_files_or_changes_the_tracker(self):
for phrase in ("File no issue", "change no issue"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, self.text)
def test_returns_its_sections_in_order(self):
headings = ("Run Summary", "Candidate Bug Drafts", "Unconfirmed Signals", "Coverage Gaps")
order = [self.text.index(f"### {heading}") for heading in headings]
self.assertEqual(order, sorted(order))
self.assertIn("Check before finishing", self.text)
def test_stays_independent_of_other_coordinator_packages(self):
for phrase in ("coordinator-dispatch", "coordinator-recovery", "wave-selection",
"`portfolio_conflict`", "Coordinator Working Ledger"):
with self.subTest(phrase=phrase):
self.assertNotIn(phrase, self.text)
class DocumentationTests(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.18.0 section")
for name, (*_, previous) in PACKAGES.items():
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}")
before = f"**Before ({previous}):**" if previous else "**Before:** no package"
self.assertIn(before, entry.group(0))
self.assertIn("**After:**", entry.group(0))
self.assertIn("**Fork:**", entry.group(0))
def test_overriding_names_the_feature_map_seams(self):
text = (ROOT / "OVERRIDING.md").read_text()
match = re.search(r"^### Feature Map verification packages\n.*?(?=^##)", text, re.M | re.S)
self.assertIsNotNone(match, "no Feature Map section in OVERRIDING.md")
for phrase in ("`implementer-handoff`", "`handoff.md`", "`tester-inspection`", "`inspection.md`",
"`coordinator-release-verify`", "`/skill:coordinator-release-verify`",
"(RELEASE-NOTES.md)", "Feature Map coverage", "candidate bug draft"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, " ".join(match.group(0).split()))
def test_overriding_records_the_proposed_owner_boundary(self):
rows = [row for row in table_rows(guide_section((ROOT / "OVERRIDING.md").read_text(),
"What a skill controls and what the owner enforces"))
if row[0] == "Feature Map verification"]
self.assertEqual(len(rows), 1)
self.assertEqual(rows[0][3], "Proposed")
for phrase in ("Feature Map", "Verification Driver", "isolation", "bug draft"):
with self.subTest(phrase=phrase):
self.assertIn(phrase, rows[0][1] + rows[0][2])
def test_coordinator_customization_lists_release_verification(self):
text = " ".join(guide_section((ROOT / "OVERRIDING.md").read_text(),
"Customize the Technical Coordinator").split())
self.assertIn("`coordinator-release-verify`", text)
def test_contract_and_readme_name_the_v0_18_0_release(self):
contract = (ROOT / "docs/authoritative/instruction-package-contract.md").read_text()
adoption = guide_section(contract, "RelayView adoption of the Tester and Coordinator pairs")
self.assertIn("`v0.18.0`, proposed", adoption)
self.assertIn("`coordinator-release-verify`", adoption)
readme = (ROOT / "README.md").read_text()
for name in PACKAGES:
with self.subTest(package=name):
self.assertIn(f"`{name}`", readme[readme.index("v0.18.0"):])
if __name__ == "__main__":
unittest.main()