Require inline frontmatter values and correct the package contract
Reject a top-level frontmatter key without "key: value" form, so "disable-model-invocation:yes" can no longer bypass the boolean check. Assert each rejection's reason in the new-pair tests. In the contract, mark the Tester and Coordinator releases as proposed, list RelayView's role-level changes, and state the path-depth bound and the identity and archive sort orders exactly. Refs #20 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c7d967efd
commit
1e9e46bc09
4 files changed
+69
-54
No files matched your search
+32
-28
@@ -159,28 +159,28 @@ class RoleStepRejectionTests(unittest.TestCase):
|
||||
self.assertRejected(copy, "invalid issue claim policy")
|
||||
|
||||
def test_rejects_schema_and_treatment_mismatches(self):
|
||||
fields, treatment = "unsupported manifest fields", "invalid communication treatment"
|
||||
cases = {
|
||||
"tester-fixture": [
|
||||
{"treatment": "communication_context"},
|
||||
{"schemaVersion": 3},
|
||||
{"schemaVersion": True},
|
||||
{"schemaVersion": "1"},
|
||||
{"schemaVersion": 1.5},
|
||||
{"schemaVersion": 4},
|
||||
({"treatment": "communication_context"}, fields),
|
||||
({"schemaVersion": 3}, fields),
|
||||
({"schemaVersion": True}, fields),
|
||||
({"schemaVersion": "1"}, fields),
|
||||
({"schemaVersion": 1.5}, fields),
|
||||
({"schemaVersion": 4}, fields),
|
||||
],
|
||||
"coordinator-communication-fixture": [
|
||||
{"treatment": "context"},
|
||||
{"treatment": None},
|
||||
{"schemaVersion": 1},
|
||||
{"schemaVersion": True},
|
||||
({"treatment": "context"}, treatment),
|
||||
({"treatment": None}, treatment),
|
||||
({"schemaVersion": 1}, fields),
|
||||
({"schemaVersion": True}, fields),
|
||||
],
|
||||
}
|
||||
for name, changes in cases.items():
|
||||
for change in changes:
|
||||
for change, message in changes:
|
||||
with self.subTest(name=name, change=change), FixtureCopy(name) as copy:
|
||||
copy.write_manifest(dict(copy.manifest, **change))
|
||||
with self.assertRaises(PackageError):
|
||||
check_package(copy.path)
|
||||
self.assertRejected(copy, message)
|
||||
with FixtureCopy("tester-communication-fixture") as copy:
|
||||
manifest = copy.manifest
|
||||
del manifest["treatment"]
|
||||
@@ -214,24 +214,28 @@ class RoleStepRejectionTests(unittest.TestCase):
|
||||
self.assertRejected(copy, "changed file")
|
||||
|
||||
def test_rejects_forbidden_frontmatter(self):
|
||||
metadata, boolean = "unsupported skill metadata", "must be a boolean"
|
||||
cases = (
|
||||
("metadata:\n", "tools: [shell]\nmetadata:\n", metadata),
|
||||
("metadata:\n", "allowed-tools: Bash\nmetadata:\n", metadata),
|
||||
("metadata:\n", "model: any\nmetadata:\n", metadata),
|
||||
("metadata:\n", "role: coordinator\nmetadata:\n", metadata),
|
||||
("metadata:\n", "metadata: {}\n", metadata),
|
||||
("metadata:\n", "metadata:\n relayview-tools: shell\n", metadata),
|
||||
("metadata:\n", "metadata:\n relayview-role: tester\n", metadata),
|
||||
("metadata:\n", "name: other-name\nmetadata:\n", metadata),
|
||||
("metadata:\n", "disable-model-invocation: yes\nmetadata:\n", boolean),
|
||||
("metadata:\n", "disable-model-invocation:yes\nmetadata:\n", metadata),
|
||||
("metadata:\n", "disable-model-invocation:\nmetadata:\n", metadata),
|
||||
)
|
||||
for name in NEW_PAIR_FIXTURES:
|
||||
for old, new in (
|
||||
("metadata:\n", "tools: [shell]\nmetadata:\n"),
|
||||
("metadata:\n", "allowed-tools: Bash\nmetadata:\n"),
|
||||
("metadata:\n", "model: any\nmetadata:\n"),
|
||||
("metadata:\n", "role: coordinator\nmetadata:\n"),
|
||||
("metadata:\n", "metadata: {}\n"),
|
||||
("metadata:\n", "metadata:\n relayview-tools: shell\n"),
|
||||
("metadata:\n", "metadata:\n relayview-role: tester\n"),
|
||||
("metadata:\n", "name: other-name\nmetadata:\n"),
|
||||
("metadata:\n", "disable-model-invocation: yes\nmetadata:\n"),
|
||||
):
|
||||
if "disable-model-invocation" in new and name == "coordinator-manual-fixture":
|
||||
old, new = "disable-model-invocation: true\n", "disable-model-invocation: yes\n"
|
||||
for old, new, message in cases:
|
||||
with self.subTest(name=name, new=new), FixtureCopy(name) as copy:
|
||||
if name == "coordinator-manual-fixture":
|
||||
# Drop the fixture's own key so an inserted one is not merely a duplicate.
|
||||
copy.replace_in_skill("disable-model-invocation: true\n", "")
|
||||
copy.replace_in_skill(old, new)
|
||||
with self.assertRaises(PackageError):
|
||||
check_package(copy.path)
|
||||
self.assertRejected(copy, message)
|
||||
|
||||
def test_rejects_unsafe_or_undeclared_content(self):
|
||||
cases = (
|
||||
|
||||
Reference in new issue
Block a user