Address review pass 1: method capture, bundled subset, release notes
- The contract says new Designer Chats receive only the default; a manual method is captured when an Operator assigns it. - The pair-adoption precondition names bundling a package, since RelayView's v0.15.0 bundle holds only the Designer packages. - The shared v0.16.0/v0.17.0 commit is stated as current truth. - RELEASE-NOTES.md gains v0.17.0 and v0.15.0 sections. - tests/test_release_status.py reuses the shared helpers and checks wording near any published tag rather than the removed sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e923bb56a0
commit
40cdbbb12b
4 files changed
+168
-45
No files matched your search
@@ -1,42 +1,41 @@
|
||||
"""Keep the documents' release status in step with the published tags.
|
||||
|
||||
A release is listed in PUBLISHED once its tag is pushed; a published tag is
|
||||
never moved or rebuilt. Documents may describe a release as proposed or not
|
||||
yet tagged only while it is absent from PUBLISHED."""
|
||||
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 pathlib import Path
|
||||
|
||||
from tests.test_overriding import codes, section, table_rows
|
||||
from tests.test_overriding import CONTRACT, ROOT, codes, section, table_rows
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
CONTRACT = ROOT / "docs/authoritative/instruction-package-contract.md"
|
||||
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")
|
||||
# An unpublished marker within this many characters of a published tag, in
|
||||
# either order, describes that tag as unpublished.
|
||||
NEARBY = 40
|
||||
UNPUBLISHED = r"not[- ]yet[- ](?:tagged|published)|proposed"
|
||||
|
||||
|
||||
def flat(path):
|
||||
return " ".join((ROOT / path).read_text().split())
|
||||
def flat(text):
|
||||
return " ".join(text.split())
|
||||
|
||||
|
||||
def read(path):
|
||||
return flat((ROOT / path).read_text())
|
||||
|
||||
|
||||
class ReleaseStatusTests(unittest.TestCase):
|
||||
def test_documents_never_call_a_published_release_unpublished(self):
|
||||
for document in DOCUMENTS:
|
||||
text = flat(document)
|
||||
text = read(document)
|
||||
for tag in PUBLISHED:
|
||||
escaped = re.escape(tag)
|
||||
unpublished = (
|
||||
rf"not[- ]yet[- ]tagged `?{escaped}",
|
||||
rf"`?{escaped}`?,? \(?not yet tagged",
|
||||
rf"proposed `?{escaped}",
|
||||
rf"`?{escaped}`?, proposed",
|
||||
rf"`?{escaped}`? release and are not yet tagged",
|
||||
rf"`?{escaped}`?, a proposed release",
|
||||
)
|
||||
for pattern in unpublished:
|
||||
with self.subTest(document=document, tag=tag, pattern=pattern):
|
||||
self.assertIsNone(re.search(pattern, text, re.I))
|
||||
pattern = (rf"(?:{UNPUBLISHED})[^.;|]{{0,{NEARBY}}}{escaped}"
|
||||
rf"|{escaped}[^.;|]{{0,{NEARBY}}}(?:{UNPUBLISHED})")
|
||||
with self.subTest(document=document, tag=tag):
|
||||
self.assertIsNone(re.search(pattern, text, re.I))
|
||||
|
||||
def test_package_matrix_names_published_releases_plainly(self):
|
||||
rows = table_rows(section((ROOT / "OVERRIDING.md").read_text(), "Package matrix"))
|
||||
@@ -48,18 +47,23 @@ class ReleaseStatusTests(unittest.TestCase):
|
||||
|
||||
def test_contract_adoption_table_marks_releases_published(self):
|
||||
adoption = section(CONTRACT.read_text(), "RelayView adoption of the Tester and Coordinator pairs")
|
||||
releases = [row[0] for row in table_rows(adoption)]
|
||||
self.assertEqual(releases, ["`v0.15.0`, published", "`v0.17.0`, published", "`v0.18.0`, published"])
|
||||
for row in table_rows(adoption):
|
||||
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 = " ".join(section(CONTRACT.read_text(), "Releases are immutable").split())
|
||||
releases = flat(section(CONTRACT.read_text(), "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_headings_carry_no_pending_marker(self):
|
||||
notes = (ROOT / "RELEASE-NOTES.md").read_text()
|
||||
headings = re.findall(r"^## (.+)$", notes, re.M)
|
||||
self.assertEqual(headings[:2], ["v0.18.0", "v0.16.0"])
|
||||
def test_release_notes_cover_each_published_release_without_a_pending_marker(self):
|
||||
headings = re.findall(r"^## (.+)$", (ROOT / "RELEASE-NOTES.md").read_text(), re.M)
|
||||
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):
|
||||
@@ -73,15 +77,22 @@ class DesignerAdoptionTests(unittest.TestCase):
|
||||
|
||||
def test_documents_drop_the_pending_designer_adoption(self):
|
||||
for document in ("README.md", "OVERRIDING.md"):
|
||||
text = flat(document)
|
||||
for phrase in ("until it pins `v0.15.0`", "until it pins v0.15.0", "not yet pinned",
|
||||
"RelayView still pins `issue-designer-default`", "keeps assigning `issue-designer-default`"):
|
||||
with self.subTest(document=document, phrase=phrase):
|
||||
self.assertNotIn(phrase, text)
|
||||
adoption = section(CONTRACT.read_text(), "RelayView adoption of the Specification Designer default")
|
||||
with self.subTest(document=document):
|
||||
self.assertIsNone(re.search(r"until it pins `?v0\.15\.0|not yet pinned", read(document)))
|
||||
adoption = flat(section(CONTRACT.read_text(), "RelayView adoption of the Specification Designer default"))
|
||||
self.assertNotIn("Before RelayView pins", adoption)
|
||||
self.assertIn("first-party-skills/v0.15.0/", adoption)
|
||||
|
||||
def test_designer_methods_are_captured_only_when_assigned(self):
|
||||
adoption = flat(section(CONTRACT.read_text(), "RelayView adoption of the Specification Designer default"))
|
||||
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(section(CONTRACT.read_text(), "RelayView adoption of the Tester and Coordinator pairs"))
|
||||
self.assertIn("Before RelayView bundles a package declaring either pair", adoption)
|
||||
self.assertNotIn("Before RelayView pins a release containing either pair", adoption)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user