Files
relayview-skills/tests/test_release_status.py
T
adminandClaude Opus 5.5 bdf6b47e8e
Check instruction packages / check (push) Successful in 5s
Check instruction packages / check (pull_request) Successful in 5s
Address review pass 3: verifier bundle list, method descriptions, proposed match
- Contract step 4 again says a new bundle joins the verifier's BUNDLES list.
- v0.15.0 notes describe the earlier method descriptions accurately, and the
  v0.17.0 intro says what the shared commit means.
- tests/test_release_status.py counts "proposed" only directly beside a
  published tag, since the documents also name RelayView's proposed owner
  rules, and drops a redundant heading loop.

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

111 lines
5.2 KiB
Python

"""Keep the documents' release status in step with the published tags.
Add a release to PUBLISHED when its tag is pushed; a published tag is never
moved or rebuilt. The list is written out because CI checks out a shallow
clone without tags. Documents may describe a release as proposed or not yet
tagged only while it is absent from PUBLISHED."""
import re
import unittest
from tests.test_overriding import CONTRACT, ROOT, codes, section, table_rows
PUBLISHED = ("v0.15.0", "v0.16.0", "v0.17.0", "v0.18.0")
DOCUMENTS = ("README.md", "OVERRIDING.md", "RELEASE-NOTES.md", "docs/authoritative/instruction-package-contract.md")
# "Not yet tagged" or "not yet published" within this many characters of a
# published tag, in either order, describes that tag as unpublished.
# "Proposed" also names RelayView's proposed owner rules, so it counts only
# directly beside the tag ("proposed `v0.17.0`", "`v0.18.0`, proposed").
NEARBY = 40
UNPUBLISHED = r"not[- ]yet[- ](?:tagged|published)"
ADJACENT = r"[\s`,]{0,3}"
# Any text within one sentence or table cell: a period ends the span only
# when it ends a sentence, so other version strings may sit in between.
SPAN = rf"(?:(?!\. )[^;|]){{0,{NEARBY}}}"
VERSION_HEADING = re.compile(r"^## (v\d+\.\d+\.\d+)$", re.M)
def flat(text):
return " ".join(text.split())
def flat_document(path):
return flat((ROOT / path).read_text())
def contract_section(heading):
return section(CONTRACT.read_text(), heading)
def package_matrix():
return {codes(row[0])[0]: row for row in table_rows(section((ROOT / "OVERRIDING.md").read_text(), "Package matrix"))}
class ReleaseStatusTests(unittest.TestCase):
def test_documents_never_call_a_published_release_unpublished(self):
for document in DOCUMENTS:
text = flat_document(document)
for tag in PUBLISHED:
escaped = re.escape(tag)
pattern = (rf"(?:{UNPUBLISHED}){SPAN}{escaped}|{escaped}{SPAN}(?:{UNPUBLISHED})"
rf"|proposed{ADJACENT}{escaped}|{escaped}{ADJACENT}proposed")
with self.subTest(document=document, tag=tag):
self.assertIsNone(re.search(pattern, text, re.I))
def test_package_matrix_names_published_releases_plainly(self):
for name, row in package_matrix().items():
release = codes(row[6])[0]
if release in PUBLISHED:
with self.subTest(package=name):
self.assertEqual(row[6], f"`{release}`")
def test_contract_adoption_table_marks_releases_published(self):
for row in table_rows(contract_section("RelayView adoption of the Tester and Coordinator pairs")):
release = codes(row[0])[0]
if release in PUBLISHED:
with self.subTest(release=release):
self.assertEqual(row[0], f"`{release}`, published")
def test_contract_explains_the_shared_v0_16_0_and_v0_17_0_commit(self):
releases = flat(contract_section("Releases are immutable"))
self.assertIn("`v0.16.0` and `v0.17.0` tag the same commit", releases)
self.assertIn("A bundle for either tag takes only the packages that declare it.", releases)
def test_release_notes_cover_each_published_release_without_a_pending_marker(self):
notes = (ROOT / "RELEASE-NOTES.md").read_text()
headings = VERSION_HEADING.findall(notes)
for tag in PUBLISHED:
with self.subTest(tag=tag):
self.assertIn(tag, headings)
self.assertEqual(headings, sorted(headings, key=lambda tag: tuple(map(int, tag[1:].split("."))), reverse=True))
class DesignerAdoptionTests(unittest.TestCase):
"""RelayView pins v0.15.0 and assigns specification-designer-default."""
def test_package_matrix_names_the_pinned_specification_designer_default(self):
rows = package_matrix()
self.assertTrue(rows["specification-designer-default"][7].startswith("Pinned Designer default"))
self.assertFalse(rows["issue-designer-default"][7].startswith("Pinned Designer default"))
def test_documents_drop_the_pending_designer_adoption(self):
for document in ("README.md", "OVERRIDING.md"):
with self.subTest(document=document):
self.assertIsNone(re.search(r"until it pins `?v0\.15\.0|not yet pinned", flat_document(document)))
def test_contract_describes_the_designer_adoption(self):
adoption = flat(contract_section("RelayView adoption of the Specification Designer default"))
self.assertIn("RelayView pins `v0.15.0` in `first-party-skills/v0.15.0/`", adoption)
self.assertIn("New Designer Chats receive `specification-designer-default`.", adoption)
self.assertIn("captures one only when an Operator assigns it", adoption)
def test_pair_adoption_names_the_bundled_subset(self):
adoption = flat(contract_section("RelayView adoption of the Tester and Coordinator pairs"))
self.assertIn("its `v0.15.0` bundle holds only the Designer packages", adoption)
self.assertIn("Before RelayView bundles a package declaring either pair", adoption)
self.assertIn("add a new bundle to `BUNDLES` in `scripts/verify-first-party-skills-source.py`", adoption)
if __name__ == "__main__":
unittest.main()