Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

docs: the docs recipe links a new page under docs/ from one a reader comes through

xbshenge86ce1c77e4e
diff --git a/docs/workflows/docs-notes.md b/docs/workflows/docs-notes.md
index aa089cb52..cc4548f92 100644
--- a/docs/workflows/docs-notes.md
+++ b/docs/workflows/docs-notes.md
@@ -14,6 +14,12 @@
which is how three of them were found sitting unread. That section is a claim as well: an entry filed there
says its model has no list, so once the list lands the link moves into the row, where
`index_notes_with_their_own_list` wants it.
+- A new page under `docs/`, in a folder of its own too, is linked from a page a reader comes through:
+ `CONTRIBUTING.md`, `README.md`, `AGENTS.md`, or a page in `docs/` that is already linked.
+ `tests/test_docs_pages_reachable.py` walks every page below `docs/` and fails on one nothing links to
+ (`pages under docs/ that nothing links to: docs/<the new page>.md`); a path inside a code block is an
+ example, not a link. That is how `docs/DOS-AND-DONTS.md` was found, a page whose own rule is "no
+ screenshots or reports in `docs/` that nothing links to" and which nothing in the repository named.
- Several tests pin facts in `docs/devices/` notes, `PROMPT.md` and `docs/TROUBLESHOOTING.md` (the
`tests/test_*_note.py` files). If you reword one of those passages, run the suite and keep the fact.
- Docs and the README stay in step: a new list gets its `tv.json` (the TV tables are generated from it), and a
diff --git a/tests/test_docs_notes_recipe_index.py b/tests/test_docs_notes_recipe_index.py
index 10a462040..902775a5f 100644
--- a/tests/test_docs_notes_recipe_index.py
+++ b/tests/test_docs_notes_recipe_index.py
@@ -1,4 +1,4 @@
-"""The docs recipe asks for the link that keeps a new docs/devices/ note findable.
+"""The docs recipe asks for the links that keep a new docs page findable.
`docs/workflows/docs-notes.md` is the page AGENTS.md's workflow list and CONTRIBUTING's routing table
send a contributor to for "a troubleshooting entry, a fix to PROMPT.md, or any other docs change", and
@@ -10,11 +10,16 @@ the row of its folder in `examples/README.md` when the model has a list of its o
as it read left the suite red: `docs/devices/<name>.md : notes nothing links to (add them to
examples/README.md, either to the row of their list or to the notes index)`.
-Nothing here copies the rule: the section heading the index is read by, the row rule and the
-repo-wide sweep all come from `tests/test_device_notes_index.py`, and two tests below run that
-checker over a tree written here - a note nothing links has to be reported, and the same note linked
-from `examples/README.md` has to be quiet - so a checker that stops enforcing fails this pair instead
-of letting the page pass silently.
+It said nothing either about the page a docs change is when it is not a device note: a page added
+below `docs/` is held to `tests/test_docs_pages_reachable.py`, which reported
+`pages under docs/ that nothing links to: docs/hdmi-cec-notes.md` for a page written beside them, and
+the recipe is where a contributor is told what a docs change needs.
+
+Nothing here copies either rule: the section heading the index is read by, the row rule and the
+repo-wide sweeps all come from `tests/test_device_notes_index.py` and `tests/test_docs_pages_reachable.py`,
+and four tests below run those checkers over trees written here - a page nothing links has to be
+reported, and the same page linked from a page a reader comes through has to be quiet - so a checker
+that stops enforcing fails these pairs instead of letting the page pass silently.
Run from the repository root: python3 -m unittest discover -s tests -v
"""
@@ -31,12 +36,14 @@ from test_device_notes_index import ( # noqa: E402
index_notes_with_their_own_list,
unlinked_notes,
)
+from test_docs_pages_reachable import unlinked_docs # noqa: E402
ROOT = Path(__file__).resolve().parents[1]
PAGE = ROOT / "docs" / "workflows" / "docs-notes.md"
BULLET = re.compile(r"^-\s+(.*)$")
CHECK = "tests/test_device_notes_index.py"
+PAGES_CHECK = "tests/test_docs_pages_reachable.py"
def bullets(text):
@@ -166,5 +173,57 @@ class TheBulletReaderTest(unittest.TestCase):
self.assertEqual(index_bullets(text), [])
+def page_bullets(text):
+ """The bullets that keep a new page under `docs/` findable: the ones naming its check."""
+ return [b for b in bullets(text) if PAGES_CHECK in b]
+
+
+class RecipeLinksANewDocsPageTest(unittest.TestCase):
+ """The page's other half: a docs change that is a new page, not a device note.
+
+ `docs/workflows/docs-notes.md` is the page AGENTS.md's workflow list and CONTRIBUTING's routing
+ table send a contributor to for "any other docs change", and its second bullet is what sends
+ brand knowledge into `docs/devices/`. Adding a page beside those notes - a `docs/hdmi-cec.md`, say -
+ left the suite red on `tests/test_docs_pages_reachable.py`, and the page said nothing about it.
+ """
+
+ def test_one_bullet_names_the_page_check(self):
+ found = page_bullets(page_text())
+ self.assertEqual(
+ len(found), 1,
+ f"{PAGE.name} has {len(found)} bullets naming {PAGES_CHECK}: the bullet that sends a new page "
+ f"into docs/ has to say where it is linked from, or a page written from the page fails that "
+ f"check. Bullets naming it today: {found}",
+ )
+
+ def test_the_bullet_says_where_a_new_page_is_linked_from(self):
+ bullet = page_bullets(page_text())[0]
+ self.assertIn("link", bullet.lower(),
+ "the bullet has to say the page is linked, which is what the check reads")
+ for page in ("CONTRIBUTING.md", "README.md", "AGENTS.md"):
+ self.assertIn(page, bullet,
+ f"the bullet has to name {page} as a page a new docs page can be linked from")
+
+
+class ThePageCheckerStillBitesTest(unittest.TestCase):
+ def tree(self, files):
+ tmp = tempfile.TemporaryDirectory()
+ self.addCleanup(tmp.cleanup)
+ root = Path(tmp.name)
+ for name, text in files.items():
+ (root / name).parent.mkdir(parents=True, exist_ok=True)
+ (root / name).write_text(text, encoding="utf-8")
+ return root
+
+ def test_a_page_nothing_links_is_reported(self):
+ root = self.tree({"README.md": "# readme\n", "docs/hdmi-cec.md": "# notes\n"})
+ self.assertEqual(["docs/hdmi-cec.md"], unlinked_docs(root))
+
+ def test_the_same_page_linked_from_a_page_is_quiet(self):
+ root = self.tree({"CONTRIBUTING.md": "Read [the HDMI notes](docs/hdmi-cec.md).\n",
+ "docs/hdmi-cec.md": "# notes\n"})
+ self.assertEqual([], unlinked_docs(root))
+
+
if __name__ == "__main__":
unittest.main()