2026-11-26 09:40:16 -05:00
|
|
|
"""Keep the documents' release status in step with the published tags.
|
|
|
|
|
|
2026-11-26 09:44:15 -05:00
|
|
|
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."""
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import unittest
|
|
|
|
|
|
2026-11-26 09:44:15 -05:00
|
|
|
from tests.test_overriding import CONTRACT, ROOT, codes, section, table_rows
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
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")
|
2026-11-26 09:49:23 -05:00
|
|
|
# "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").
|
2026-11-26 09:44:15 -05:00
|
|
|
NEARBY = 40
|
2026-11-26 09:49:23 -05:00
|
|
|
UNPUBLISHED = r"not[- ]yet[- ](?:tagged|published)"
|
|
|
|
|
ADJACENT = r"[\s`,]{0,3}"
|
2026-11-26 09:47:11 -05:00
|
|
|
# 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)
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
|
2026-11-26 09:44:15 -05:00
|
|
|
def flat(text):
|
|
|
|
|
return " ".join(text.split())
|
|
|
|
|
|
|
|
|
|
|
2026-11-26 09:47:11 -05:00
|
|
|
def flat_document(path):
|
2026-11-26 09:44:15 -05:00
|
|
|
return flat((ROOT / path).read_text())
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
|
2026-11-26 09:47:11 -05:00
|
|
|
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"))}
|
|
|
|
|
|
|
|
|
|
|
2026-11-26 09:40:16 -05:00
|
|
|
class ReleaseStatusTests(unittest.TestCase):
|
|
|
|
|
def test_documents_never_call_a_published_release_unpublished(self):
|
|
|
|
|
for document in DOCUMENTS:
|
2026-11-26 09:47:11 -05:00
|
|
|
text = flat_document(document)
|
2026-11-26 09:40:16 -05:00
|
|
|
for tag in PUBLISHED:
|
|
|
|
|
escaped = re.escape(tag)
|
2026-11-26 09:49:23 -05:00
|
|
|
pattern = (rf"(?:{UNPUBLISHED}){SPAN}{escaped}|{escaped}{SPAN}(?:{UNPUBLISHED})"
|
|
|
|
|
rf"|proposed{ADJACENT}{escaped}|{escaped}{ADJACENT}proposed")
|
2026-11-26 09:44:15 -05:00
|
|
|
with self.subTest(document=document, tag=tag):
|
|
|
|
|
self.assertIsNone(re.search(pattern, text, re.I))
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
def test_package_matrix_names_published_releases_plainly(self):
|
2026-11-26 09:47:11 -05:00
|
|
|
for name, row in package_matrix().items():
|
2026-11-26 09:40:16 -05:00
|
|
|
release = codes(row[6])[0]
|
|
|
|
|
if release in PUBLISHED:
|
2026-11-26 09:47:11 -05:00
|
|
|
with self.subTest(package=name):
|
2026-11-26 09:40:16 -05:00
|
|
|
self.assertEqual(row[6], f"`{release}`")
|
|
|
|
|
|
|
|
|
|
def test_contract_adoption_table_marks_releases_published(self):
|
2026-11-26 09:47:11 -05:00
|
|
|
for row in table_rows(contract_section("RelayView adoption of the Tester and Coordinator pairs")):
|
2026-11-26 09:44:15 -05:00
|
|
|
release = codes(row[0])[0]
|
|
|
|
|
if release in PUBLISHED:
|
|
|
|
|
with self.subTest(release=release):
|
|
|
|
|
self.assertEqual(row[0], f"`{release}`, published")
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
def test_contract_explains_the_shared_v0_16_0_and_v0_17_0_commit(self):
|
2026-11-26 09:47:11 -05:00
|
|
|
releases = flat(contract_section("Releases are immutable"))
|
2026-11-26 09:40:16 -05:00
|
|
|
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)
|
|
|
|
|
|
2026-11-26 09:44:15 -05:00
|
|
|
def test_release_notes_cover_each_published_release_without_a_pending_marker(self):
|
2026-11-26 09:47:11 -05:00
|
|
|
notes = (ROOT / "RELEASE-NOTES.md").read_text()
|
|
|
|
|
headings = VERSION_HEADING.findall(notes)
|
2026-11-26 09:44:15 -05:00
|
|
|
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))
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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):
|
2026-11-26 09:47:11 -05:00
|
|
|
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"))
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
def test_documents_drop_the_pending_designer_adoption(self):
|
|
|
|
|
for document in ("README.md", "OVERRIDING.md"):
|
2026-11-26 09:44:15 -05:00
|
|
|
with self.subTest(document=document):
|
2026-11-26 09:47:11 -05:00
|
|
|
self.assertIsNone(re.search(r"until it pins `?v0\.15\.0|not yet pinned", flat_document(document)))
|
2026-11-26 09:40:16 -05:00
|
|
|
|
2026-11-26 09:47:11 -05:00
|
|
|
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)
|
2026-11-26 09:44:15 -05:00
|
|
|
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):
|
2026-11-26 09:47:11 -05:00
|
|
|
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)
|
2026-11-26 09:44:15 -05:00
|
|
|
self.assertIn("Before RelayView bundles a package declaring either pair", adoption)
|
2026-11-26 09:49:23 -05:00
|
|
|
self.assertIn("add a new bundle to `BUNDLES` in `scripts/verify-first-party-skills-source.py`", adoption)
|
2026-11-26 09:44:15 -05:00
|
|
|
|
2026-11-26 09:40:16 -05:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
unittest.main()
|