fix(as-S4): reading measure — prose at 72ch, headings step by ~1.2

From the anti-slop run (design-dev, 2026-09-28). A rendered doc ran 110-120
characters a line and its h3 sat at 1.08x its body. Prose blocks in
.markdown-body are capped at 72ch (pre and tables keep the full width, where
they scroll), and h3/h2/h1 step at 1.2/1.44/1.73em. Measured in a real
browser: a long paragraph now reads under 76 characters across, and every
heading step is >= 1.18.

Contract: as_antislop S4. Falsifiers: antislop.toml 43/43 proved (S1-S4);
all 12 tables 323/323 proved on this tree.
This commit is contained in:
vh
2026-09-28 13:30:31 -07:00
parent 44b80e6d9a
commit 1d6821b732
4 changed files with 69 additions and 3 deletions
+16
View File
@@ -313,3 +313,19 @@ file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_board_head_stays_compact_on_a_phone"
old = """ .bench-head{flex-wrap:wrap}.bench-title{white-space:nowrap}.bench-note{flex:1 1 100%}}"""
new = """ }"""
# ---- S4: reading measure
[[mutation]]
label = "S4 prose runs the full width again"
file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_doc_prose_reads_at_a_book_measure"
old = """ .markdown-body > :is(p,ul,ol,blockquote,dl,h1,h2,h3,h4,h5,h6){max-width:72ch}"""
new = """"""
[[mutation]]
label = "S4 h3 flat against its body again (1.08em)"
file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_doc_headings_step_by_size"
old = """.markdown-body h3{font-size:1.2em;font-weight:600}"""
new = """.markdown-body h3{font-size:1.08em;font-weight:600}"""
+39
View File
@@ -115,3 +115,42 @@ def test_review_header_is_one_line_on_a_phone(browser, live):
assert page.locator(".topbar .tagline").evaluate("e => getComputedStyle(e).display") != "none", \
"the Desk keeps its tagline (negative control)"
page.close()
# ---- S4: reading measure --------------------------------------------------------
_DOC = "# The Booth\n\n## What it is\n\n### Stated once\n\n" + ("The Booth is the fleet's operator-review surface. Agents post work; the operator looks at it, judges it, and the judgment gets back to the agent. " * 4) + "\n"
def _doc_page(browser, live):
base, root = live
d = root / "d"
d.mkdir()
(d / "doc.md").write_text(_DOC)
page = browser.new_page(viewport={"width": 1280, "height": 900})
page.goto(f"{base}/b/d/view?f=doc.md", wait_until="load")
return page
def test_doc_prose_reads_at_a_book_measure(browser, live):
page = _doc_page(browser, live)
chars = page.locator(".markdown-body p").first.evaluate("""p => {
const probe = document.createElement('span');
probe.textContent = '0'.repeat(100);
probe.style.cssText = 'position:absolute;visibility:hidden;white-space:nowrap';
p.appendChild(probe);
const ch = probe.getBoundingClientRect().width / 100;
probe.remove();
return p.getBoundingClientRect().width / ch;
}""")
assert chars <= 76, f"a paragraph runs {chars:.0f} characters across"
page.close()
def test_doc_headings_step_by_size(browser, live):
page = _doc_page(browser, live)
size = lambda sel: page.locator(f".markdown-body {sel}").first.evaluate("e => parseFloat(getComputedStyle(e).fontSize)")
body, h3, h2, h1 = size("p"), size("h3"), size("h2"), size("h1")
for lo, hi, name in ((body, h3, "h3:body"), (h3, h2, "h2:h3"), (h2, h1, "h1:h2")):
assert hi / lo >= 1.18, f"{name} is {hi / lo:.2f} ({hi}px over {lo}px)"
page.close()