fix(as-S5a): fixup from booth-dev's gate — release asks, fail-closed words, ids that cannot collide

From booth-dev's hulda bug-hunt with heid's second voice (BRINGA, thread
01M3MVGQ7QSCCK8WT59TQ4J469):
- The booth page's "kept — release" asks by name, as the Desk's does.
- WORDS has no prototype: data-confirm="__proto__" or "constructor" is an
  unknown word, and asks, instead of throwing before preventDefault.
- The confirm helper moved into <head>: its capture listener exists
  before any form, so a click during load is asked too (the inline
  confirm() it replaced had that property).
- shown() also marks U+2028/U+2029 and the zero-width characters.
- Derived ids take ':' (bk-ask-<id>-<key>:prompt, bk-ask-<id>:title), which
  no id or key can contain; '-prompt' and '-title' collided with valid
  keys. booth-dev's chip test now looks its fragment up by [id=...].
- human_dur says "—" for a value that is not finite, instead of raising.
- The tile's copy of a note drops its id (booth-dev: mark-<id> is the
  panel's article).
- Four guards that asserted source patterns now also hold on computed
  effects: embed rings, rings inside clipping containers, the withdraw ×
  on both axes, and question-level notes fields.

Contract: as_antislop S5a (fixup). Falsifiers: antislop.toml 102/102 with
r2_flow.toml 24/24 proved; the full gate follows.
This commit is contained in:
vh
2026-09-28 13:58:52 -07:00
parent d4f64fd7ec
commit 7143fae6c7
9 changed files with 370 additions and 53 deletions
+127 -4
View File
@@ -473,15 +473,15 @@ new = """<div class="bk-ask-opts" aria-labelledby="""
label = "S5a the group names a prompt id that is not there"
file = "booth/templates/_ask_inline.html"
test = "tests/test_antislop.py::test_radio_groups_are_named_and_ids_are_unique"
old = """<p class="bk-ask-prompt" id="bk-ask-{{ a.id }}{% if q.key %}-{{ q.key }}{% endif %}-prompt">"""
new = """<p class="bk-ask-prompt">"""
old = '''<p class="bk-ask-prompt" id="bk-ask-{{ a.id }}{% if q.key %}-{{ q.key }}{% endif %}:prompt">'''
new = '''<p class="bk-ask-prompt">'''
[[mutation]]
label = "S5a a titled ask's title reuses the question's id"
file = "booth/templates/_ask_inline.html"
test = "tests/test_antislop.py::test_radio_groups_are_named_and_ids_are_unique"
old = """<p class="bk-ask-title" id="bk-ask-{{ a.id }}-title">"""
new = """<p class="bk-ask-title" id="bk-ask-{{ a.id }}">"""
old = '''<p class="bk-ask-title" id="bk-ask-{{ a.id }}:title">'''
new = '''<p class="bk-ask-title" id="bk-ask-{{ a.id }}">'''
[[mutation]]
label = "S5a a single-question fieldset without a legend"
@@ -643,3 +643,126 @@ file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_touch_and_scroll_behaviour"
old = """ @media (max-width:600px){.h1-slug{white-space:normal;overflow-wrap:anywhere}}"""
new = """ @media (max-width:600px){.h1-slug{}}"""
# ---- S5a fixup: booth-dev's gate (hulda + heid BRINGA, thread 01M3MVGQ7QSCCK8WT59TQ4J469)
[[mutation]]
label = "S5a fixup the booth page's release does not ask"
file = "booth/templates/booth.html"
test = "tests/test_antislop.py::test_release_on_the_booth_page_asks_by_name"
old = '''
data-booth="{{ name }}" data-confirm="release">'''
new = '''>'''
[[mutation]]
label = "S5a fixup the booth page's release does not ask (browser)"
file = "booth/templates/booth.html"
test = "tests/test_antislop_browser.py::test_release_on_the_booth_page_asks_in_the_browser"
old = '''
data-booth="{{ name }}" data-confirm="release">'''
new = '''>'''
[[mutation]]
label = "S5a fixup WORDS inherits from Object.prototype"
file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_a_prototype_word_still_asks"
old = ''' var WORDS = Object.create(null);'''
new = ''' var WORDS = {};'''
[[mutation]]
label = "S5a fixup the confirm helper leaves <head>"
file = "booth/templates/base.html"
test = "tests/test_antislop.py::test_the_confirm_helper_is_listening_before_the_body_exists"
old = '''<script>
/* as S5a: moved here from index.html'''
new = '''</head>
<script>
/* as S5a: moved here from index.html'''
[[mutation]]
label = "S5a fixup shown() lets line separators and zero-widths through"
file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_the_dialog_shows_hidden_breaks_and_zero_widths_visibly"
old = ''' return n.replace(/[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u2028\u2029\u202a-\u202e\u2060\u2066-\u2069\ufeff]/g, '\ufffd');'''
new = ''' return n.replace(/[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, '\ufffd');'''
[[mutation]]
label = "S5a fixup a question's prompt id collides with a key ending -prompt"
file = "booth/templates/_ask_inline.html"
test = "tests/test_antislop.py::test_no_id_repeats_on_any_page"
old = '''id="bk-ask-{{ a.id }}{% if q.key %}-{{ q.key }}{% endif %}:prompt"'''
new = '''id="bk-ask-{{ a.id }}{% if q.key %}-{{ q.key }}{% endif %}-prompt"'''
[[mutation]]
label = "S5a fixup the title's id collides with a key named title"
file = "booth/templates/_ask_inline.html"
test = "tests/test_antislop.py::test_no_id_repeats_on_any_page"
old = '''id="bk-ask-{{ a.id }}:title"'''
new = '''id="bk-ask-{{ a.id }}-title"'''
[[mutation]]
label = "S5a fixup the tile's note repeats the article's id"
file = "booth/templates/booth.html"
test = "tests/test_antislop.py::test_no_id_repeats_on_any_page"
old = ''' <div class="item-note">'''
new = ''' <div class="item-note" id="mark-{{ m.id }}">'''
[[mutation]]
label = "S5a fixup human_dur raises on nan"
file = "booth/app.py"
test = "tests/test_antislop.py::test_human_dur_never_raises"
old = ''' if not math.isfinite(seconds): # as S5a fixup: int(nan) raises; say nothing we cannot know
return "—"
'''
new = ''''''
[[mutation]]
label = "S5a fixup a question's notes field named only by its placeholder"
file = "booth/templates/_ask_inline.html"
test = "tests/test_antislop.py::test_fields_are_named"
old = '''aria-label="notes on this one" placeholder="notes on this one (optional)">'''
new = '''placeholder="notes on this one (optional)">'''
[[mutation]]
label = "S5a fixup the marks page's question notes named only by their placeholder"
file = "booth/templates/_marks.html"
test = "tests/test_antislop.py::test_fields_are_named"
old = '''aria-label="notes on this one" placeholder="notes on this one (optional)">'''
new = '''placeholder="notes on this one (optional)">'''
[[mutation]]
label = "S5a fixup the embed chip's ring is transparent"
file = "booth/static/embed.js"
test = "tests/test_antislop_browser.py::test_the_embed_draws_visible_rings"
old = '''outline:2px solid #fff;outline-offset:1px;box-shadow:0 0 0 4px #15191d}'''
new = '''outline:2px solid transparent;outline-offset:1px;box-shadow:0 0 0 4px #15191d}'''
[[mutation]]
label = "S5a fixup the embed submit's ring is transparent"
file = "booth/static/embed.js"
test = "tests/test_antislop_browser.py::test_the_embed_draws_visible_rings"
old = '''".bk-ask-go:focus-visible{outline:2px solid var(--bk-accent);outline-offset:2px}"'''
new = '''".bk-ask-go:focus-visible{outline:2px solid transparent;outline-offset:2px}"'''
[[mutation]]
label = "S5a fixup an image tile's ring is drawn outside its clip"
file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_rings_inside_clipping_containers_are_drawn_inside"
old = '''.theme button:focus-visible,.vtoggle button:focus-visible,.item a:focus-visible,'''
new = '''.theme button:focus-visible,.vtoggle button:focus-visible,'''
[[mutation]]
label = "S5a fixup a Desk panel's ring is drawn outside its clip (computed)"
file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_rings_inside_clipping_containers_are_drawn_inside"
old = ''' .desk-panel a:focus-visible{outline-offset:-2px}'''
new = ''' .desk-panel a:focus-visible{outline-offset:2px}'''
[[mutation]]
label = "S5a fixup the withdraw × narrower than 24px"
file = "booth/templates/base.html"
test = "tests/test_antislop_browser.py::test_withdraw_buttons_are_big_enough_to_hit"
old = ''' .mark-x{min-width:24px;min-height:24px}'''
new = ''' .mark-x{min-height:24px}'''