Document the LF frontmatter rule and pin it with a test
The checker already rejects CRLF frontmatter; the contract now says so and a fixture mutation keeps that statement honest. Use the parsed schema version for the schema 2 and 3 checks, and rewrap the contract. Refs #20 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ddf95ded04
commit
f872770dc9
3 files changed
+9
-8
No files matched your search
@@ -74,8 +74,8 @@ metadata:
|
|||||||
makes the package manual-only. Every key other than `metadata` is written
|
makes the package manual-only. Every key other than `metadata` is written
|
||||||
`key: value` with a non-empty value. `metadata:` stands alone on its line,
|
`key: value` with a non-empty value. `metadata:` stands alone on its line,
|
||||||
followed by exactly those two keys, each indented two spaces. The block has no
|
followed by exactly those two keys, each indented two spaces. The block has no
|
||||||
blank or comment lines. Any other key, such as `tools` or `allowed-tools`,
|
blank or comment lines, and its lines end in LF, not CRLF. Any other key, such
|
||||||
fails the check.
|
as `tools` or `allowed-tools`, fails the check.
|
||||||
|
|
||||||
## Identity and archive
|
## Identity and archive
|
||||||
|
|
||||||
@@ -87,10 +87,10 @@ by Unicode code point, the UTF-8 path and the file bytes.
|
|||||||
The release archive is an uncompressed ZIP containing the repository
|
The release archive is an uncompressed ZIP containing the repository
|
||||||
`LICENSE` and `NOTICE.md`, then every package file under `<package-name>/`,
|
`LICENSE` and `NOTICE.md`, then every package file under `<package-name>/`,
|
||||||
sorted segment by segment (so `a/b.md` precedes `a-b/c.md`, unlike the
|
sorted segment by segment (so `a/b.md` precedes `a-b/c.md`, unlike the
|
||||||
whole-string order the identity uses). Every entry carries the timestamp 1980-01-01 00:00:00 and
|
whole-string order the identity uses). Every entry carries the timestamp
|
||||||
mode `0644`. ZIP headers also record the creating system, so release
|
1980-01-01 00:00:00 and mode `0644`. ZIP headers also record the creating
|
||||||
digests are computed on a POSIX host, as this repository's CI does; on such a
|
system, so release digests are computed on a POSIX host, as this repository's
|
||||||
host the archive digest depends only on those bytes.
|
CI does; on such a host the archive digest depends only on those bytes.
|
||||||
|
|
||||||
RelayView's `scripts/verify-first-party-skills-source.py` recomputes both
|
RelayView's `scripts/verify-first-party-skills-source.py` recomputes both
|
||||||
values from a tagged release and compares them with its
|
values from a tagged release and compares them with its
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ class RoleStepRejectionTests(unittest.TestCase):
|
|||||||
def test_rejects_unsafe_or_undeclared_content(self):
|
def test_rejects_unsafe_or_undeclared_content(self):
|
||||||
cases = (
|
cases = (
|
||||||
("BOM", lambda copy: copy.write_file("SKILL.md", b"\xef\xbb\xbf" + (copy.path / "SKILL.md").read_bytes()), "invalid text"),
|
("BOM", lambda copy: copy.write_file("SKILL.md", b"\xef\xbb\xbf" + (copy.path / "SKILL.md").read_bytes()), "invalid text"),
|
||||||
|
("CRLF frontmatter", lambda copy: copy.write_file("SKILL.md", (copy.path / "SKILL.md").read_bytes().replace(b"\n", b"\r\n")), "incompatible skill metadata"),
|
||||||
("NUL", lambda copy: copy.write_file("notes.md", "a\x00b\n"), "invalid text"),
|
("NUL", lambda copy: copy.write_file("notes.md", "a\x00b\n"), "invalid text"),
|
||||||
("invalid UTF-8", lambda copy: copy.write_file("notes.md", b"\xff\xfe\n"), "invalid UTF-8"),
|
("invalid UTF-8", lambda copy: copy.write_file("notes.md", b"\xff\xfe\n"), "invalid UTF-8"),
|
||||||
("empty resource", lambda copy: copy.write_file("notes.md", b""), "text bounds"),
|
("empty resource", lambda copy: copy.write_file("notes.md", b""), "text bounds"),
|
||||||
|
|||||||
+2
-2
@@ -74,14 +74,14 @@ def check_package(path):
|
|||||||
_fail(f"{path}: invalid source identity")
|
_fail(f"{path}: invalid source identity")
|
||||||
if not isinstance(manifest["role"], str) or ROLE_STEPS.get(manifest["role"]) != manifest["step"]:
|
if not isinstance(manifest["role"], str) or ROLE_STEPS.get(manifest["role"]) != manifest["step"]:
|
||||||
_fail(f"{path}: incompatible role or step")
|
_fail(f"{path}: incompatible role or step")
|
||||||
if manifest["schemaVersion"] == 2:
|
if version == 2:
|
||||||
claim = manifest["issueClaim"]
|
claim = manifest["issueClaim"]
|
||||||
label = claim.get("statusLabel") if isinstance(claim, dict) else None
|
label = claim.get("statusLabel") if isinstance(claim, dict) else None
|
||||||
if (manifest["role"], manifest["step"]) != ("planner", "planning") or not isinstance(claim, dict) or set(claim) != {"statusLabel"} or (
|
if (manifest["role"], manifest["step"]) != ("planner", "planning") or not isinstance(claim, dict) or set(claim) != {"statusLabel"} or (
|
||||||
label is not None and (not isinstance(label, str) or not re.fullmatch(r"status/[a-z][a-z0-9-]{0,63}", label) or label == "status/ready-for-agent")
|
label is not None and (not isinstance(label, str) or not re.fullmatch(r"status/[a-z][a-z0-9-]{0,63}", label) or label == "status/ready-for-agent")
|
||||||
):
|
):
|
||||||
_fail(f"{path}: invalid issue claim policy")
|
_fail(f"{path}: invalid issue claim policy")
|
||||||
if manifest["schemaVersion"] == 3 and (manifest["treatment"] != "communication_context" or manifest["role"] == "designer"):
|
if version == 3 and (manifest["treatment"] != "communication_context" or manifest["role"] == "designer"):
|
||||||
_fail(f"{path}: invalid communication treatment")
|
_fail(f"{path}: invalid communication treatment")
|
||||||
files = manifest["files"]
|
files = manifest["files"]
|
||||||
if not isinstance(files, list) or not 1 <= len(files) <= 16:
|
if not isinstance(files, list) or not 1 <= len(files) <= 16:
|
||||||
|
|||||||
Reference in new issue
Block a user