The firefox-N release body points at the README's install block instead of restating it (#365)

The body of every firefox-N release carried its own `pip install invisible-playwright`, a second copy of the README's install command that nothing kept in step with it. It now links to the README's Install section, so a release always teaches what the README teaches.

scripts/gen_release_notes.py is run by the engine's publish workflow; tests/test_release_notes_install.py checks the body restates no install command and the README has the section it links to. No package change, no version bump.
This commit is contained in:
Federico Elia authored and GitHub committed 2026-10-17 16:34:04 +02:00
1 parent 632f023b8c
commit 9927c974da
2 files changed
+50 -3

No files matched your search

+8 -3
View File
@@ -37,6 +37,13 @@ import urllib.error
# Conventional-commit prefixes that never belong in user-facing release notes.
_SKIP = re.compile(r"^(docs|chore|ci|test|style|build)(\(|:)", re.I)
#: Where the install commands live. ⛔ NOT RESTATED HERE: the body used to carry
#: its own `pip install invisible-playwright`, a second copy of the README's
#: install block that nothing kept in step with it. A command written in two
#: places is two commands the day one of them changes; the release points at the
#: one the README keeps.
INSTALL_DOC = "https://github.com/feder-cr/invisible_playwright#install"
def _api(url: str, token: str | None) -> dict:
headers = {"Accept": "application/vnd.github+json",
@@ -105,9 +112,7 @@ def build_body(tag: str, current_sha: str, bullets: list[str],
"Builds: Linux x86_64, Linux arm64, Windows x86_64.",
"",
"Most people won't grab these by hand. The wrapper fetches the right one for "
"your platform on first run:",
"",
" pip install invisible-playwright",
"your platform on first run; how to install it is in " + INSTALL_DOC + ".",
"",
"If you do download manually, `checksums.txt` has the SHA256s.",
]
+42
View File
@@ -0,0 +1,42 @@
"""The firefox-N release body points at the README's install block and restates
no install command of its own.
Known bad: until this the body carried `pip install invisible-playwright`, a
second copy of the README's command that nothing kept in step with it.
`scripts/gen_release_notes.py` writes the body of every firefox-N release (the
engine's publish workflow checks this repository out to run it).
"""
from __future__ import annotations
import importlib.util
import re
from pathlib import Path
import pytest
pytestmark = pytest.mark.unit
ROOT = Path(__file__).resolve().parents[1]
def _module():
spec = importlib.util.spec_from_file_location("gen_release_notes",
ROOT / "scripts" / "gen_release_notes.py")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod
def test_the_body_points_at_the_readme_install_block_and_restates_no_command():
mod = _module()
body = mod.build_body("firefox-50", "0123456789abcdef", ["A change"], "151.0")
assert mod.INSTALL_DOC in body
assert not re.search(r"(?m)^\s*(pip|uv|uvx|pipx)\s", body), body
def test_the_readme_has_the_install_section_the_body_points_at():
mod = _module()
anchor = mod.INSTALL_DOC.rsplit("#", 1)[1]
readme = (ROOT / "README.md").read_text(encoding="utf-8")
assert re.search(r"(?m)^## %s\s*$" % re.escape(anchor.capitalize()), readme), (
"the README has no section the release body's link lands on")