From 34092613f1776d17a54e2cac4788ddf826a7de77 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Martineau Date: Sun, 6 Sep 2026 00:10:31 -0400 Subject: [PATCH] The tests read the About pages as written, not as scaffolded The four pages were scaffolds when their test was written: three headings apiece standing in for a shape not yet settled, and under each one a muted placeholder line in the app's empty-state voice. All four have been written since, and six assertions were still describing the scaffold -- a suite that fails on the work being finished is a suite nobody can read a real regression out of. The headings are now one list, PAGE_HEADINGS, because two tests ask two things of the same fact -- that they render in order, and that each is a stop the sticky heading can pin -- and a page that grows a section should not be able to satisfy one while drifting from the other. That list is the pages as they stand: the author page's four, and the platform and future sections About MeshTerm gained. The placeholder test loses its subject entirely, so it goes. Its neighbour, the one holding prose to its indent block, was *passing* on the same absence -- it looked for placeholder lines that had escaped to column 0 and found no placeholders at all. It now asks the question directly: on the support page, which carries neither of the two blocks that are page frame rather than body, nothing but a heading may sit flush. The licence check still wanted MIT. It reads Apache 2.0 now, and also holds the page to the trademark sentence -- the part that says what the licence does not cover, which is the half a fork most needs to have been told. Co-Authored-By: Claude Opus 5 (1M context) --- meshterm/ui/about.py | 9 ++-- tests/test_about.py | 100 ++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 53 deletions(-) diff --git a/meshterm/ui/about.py b/meshterm/ui/about.py index 76690a2..22d42ef 100644 --- a/meshterm/ui/about.py +++ b/meshterm/ui/about.py @@ -13,11 +13,10 @@ for what each construct becomes). Filling a page in means editing its ``.md`` fi no screen, menu row, or CLI face has to follow — and everything markdown offers is available while doing it: sections, sub-headings, lists, quotes, links, tables. -Every page is **scaffolding** today. The headings are the real shape — that is the part -worth settling first — and each carries one lowercase muted ``placeholder — …`` line -where its prose will go, in the same empty-state voice the rest of the app uses, so an -unwritten page reads as deliberately unwritten rather than as a screen that failed to -load. +All four are written. The ``##`` headings are the shape each page was written into, +and they are load-bearing beyond the eye: the screen records where each one landed while +rendering, which is what lets it pin the heading a reader is under and step the section +jump from one to the next — so a page is navigable the way a grouped list is. What is *not* written into those files: the version, the author, and the copyright span. Each page names them with a ``{version}`` / ``{author}`` / ``{copyright}`` placeholder diff --git a/tests/test_about.py b/tests/test_about.py index 01c0df1..ca45352 100644 --- a/tests/test_about.py +++ b/tests/test_about.py @@ -2,10 +2,9 @@ The pages carry no state and no controls, so what is worth pinning is what they *say* and how they are framed: the live package facts they must never drift from, the -empty-state voice their unwritten sections speak in, the derived footer that only names -the pager when there is something to page, the landmarks their written sections leave -for the sticky heading and the section jump, and the section they hang under in the main -menu. How markdown itself is drawn is ``test_markdown``'s subject; width discipline on +indent block their prose hangs in, the derived footer that only names the pager when +there is something to page, the landmarks their sections leave for the sticky heading +and the section jump, and the section they hang under in the main menu. How markdown itself is drawn is ``test_markdown``'s subject; width discipline on both platforms is the gallery's (``test_gallery``). """ @@ -48,54 +47,59 @@ def test_about_author_names_the_author_from_the_package() -> None: assert __author__ in _page(about_author) -@pytest.mark.parametrize( - ("builder", "headings"), - [ - (about_meshterm, ("What it is", "Where it came from", "Licence")), - (about_author, ("Who", "On the mesh", "Elsewhere")), +#: Every ``##`` a written page carries, in the order the reader meets them. These are +#: the page's landmarks, so one list answers both questions asked of them below: that +#: they render in order, and that each one is a stop the sticky heading can pin. +PAGE_HEADINGS = [ + ( + about_meshterm, ( - support_project, - ("Why it needs support", "Chip in", "Other ways to help"), + "What it is", + "Where it came from", + "Platform-specific developments", + "What the future holds", + "Licence", ), - ], -) + ), + ( + about_author, + ( + "Who am I IRL", + "Who am I on the mesh", + "On the subject of AI assisted development", + "How to reach me", + ), + ), + (support_project, ("Why it needs support", "Chip in", "Other ways to help")), +] + + +@pytest.mark.parametrize(("builder", "headings"), PAGE_HEADINGS) def test_each_page_shows_its_sections(builder, headings) -> None: # noqa: ANN001 - """The headings are the settled part of a scaffolded page — they render, in order.""" + """The headings are the shape a page is written into — they render, in order.""" text = _page(builder) at = [text.index(heading) for heading in headings] assert at == sorted(at), f"{headings} are out of order in the rendered page" -@pytest.mark.parametrize("builder", [about_author, support_project]) -def test_unwritten_sections_speak_the_empty_state_voice(builder) -> None: # noqa: ANN001 - """Placeholders read as deliberately unwritten: lowercase, em-dashed, unparenthesized. - - The app's empty-state rule (see the UX standards in ``CLAUDE.md``) is what keeps a - scaffolded page from looking like a screen that failed to load. *About MeshTerm* is - written now and so has none; these two are still scaffolding. - """ - text = _page(builder) - placeholders = [line for line in text.splitlines() if "placeholder" in line] - - assert placeholders, "a scaffolded page must say so" - for line in placeholders: - body = line.strip() - assert body.startswith("placeholder — "), body - assert "(" not in body and ")" not in body, body - - def test_prose_wraps_into_its_own_indented_block() -> None: - """A wrapped placeholder hangs under its heading rather than falling to column 0.""" + """A wrapped paragraph hangs under its heading rather than falling to column 0. + + *Support MeshTerm* is the page to ask: every one of its sections is plain prose and + it carries neither of the two blocks that are page frame rather than body (the + standfirst and the colophon, which sit flush by design), so the only thing entitled + to column 0 there is a ``##`` heading. + """ screen = AboutPage("Support MeshTerm", support_project()) screen.note_viewport(40) - # Narrow enough to force every placeholder to wrap at least once. + # Narrow enough to force every paragraph to wrap several times. lines = plain(screen.render_body(28)).splitlines() - wrapped = [line for line in lines if line.strip() and not line.startswith(" ")] - assert all( - "placeholder" not in line for line in wrapped - ), "prose escaped its indent block" + headings = {lines[at].strip() for at, _ in screen._sticky_headers} + flush = [line.strip() for line in lines if line.strip() and not line.startswith(" ")] + assert flush, "the page rendered nothing at all" + assert all(line in headings for line in flush), "prose escaped its indent block" def test_footer_names_the_pager_only_when_there_is_something_to_page() -> None: @@ -123,8 +127,15 @@ def test_the_licence_section_states_the_terms_and_the_credit_it_owes() -> None: """ prose = " ".join(_page(about_meshterm).split()) - for owed in ("MIT licence", "MeshCore", "OpenStreetMap contributors", "ODbL"): - assert owed in prose, owed + owed = ( + "Apache License, Version 2.0", + "MeshTerm and its logo are trademarks", + "MeshCore", + "OpenStreetMap contributors", + "ODbL", + ) + for credit in owed: + assert credit in prose, credit def test_the_discord_page_carries_the_invite_link_and_a_code_to_scan_it_with() -> None: @@ -152,14 +163,7 @@ def test_no_package_placeholder_survives_into_the_rendered_page() -> None: assert "{" not in text and "}" not in text, text -@pytest.mark.parametrize( - ("builder", "headings"), - [ - (about_meshterm, ("What it is", "Where it came from", "Licence")), - (about_author, ("Who", "On the mesh", "Elsewhere")), - (support_project, ("Why it needs support", "Chip in", "Other ways to help")), - ], -) +@pytest.mark.parametrize(("builder", "headings"), PAGE_HEADINGS) def test_each_section_heading_is_a_landmark_the_page_can_pin(builder, headings) -> None: # noqa: ANN001 """A page is a document, so its ``##`` headings pin and its ^PgUp/^PgDn steps by them.