fix(u6): fold the cold code-review panel — four-arm convergence on three surface clauses
/heid-code-review panel 01M35CK8YKEKMV7T15JXEF6A8N, verdict NOT drift-zero. Three findings arrived from all four arms independently, and they share a shape: a contract clause written as prose and never converted into an assertion. That is the lens working. - The panel dropped the added date the contract promised to show. - `bench ls` printed no ids, and the URL it printed was truncated to 52 columns so the line was not pasteable into `bench state|rm`. The test's docstring claimed it printed ids and asserted nothing of the kind. - `bench import` printed the description instead of the raw URL beside each normalized id, hiding the collapse the clause exists to expose. - An IPv6 literal lost its brackets: http://[::1]:8080/a normalized to http://::1:8080/a, a broken identity that no re-post can match. Bracketed literals are re-wrapped; an unbracketed one is refused rather than guessed. - A deeply-nested JSON RecursionError escaped read_benches' except pair. The byte cap does not help -- 200k open brackets is 200 KB. - An empty board hid the whole benches panel, registration form included. - The link refusal classified by captured-text emptiness, which bash can erase; it now answers with a B:/N sentinel so no name reads as "not a booth". INV-4's tie-break falsifier could not fail: _write_all serializes with sort_keys=True, so both insertion orders came back already id-sorted and removing the tie-break left the test green. It now calls order_benches directly. Same class as the five vacuous U4 falsifiers, found by a cold reader rather than by us. Also from the arms' per-invariant vacuity pass: INV-6 had no vector pinning a non-default port as part of the identity; INV-3 asserted only that links/ was absent; INV-8's hashed sequence omitted a read verb; INV-9's AST walk is defeated by a string import. All closed. Contract amended where the code was right: `updated` means last mutation, the id cap is write-only because the id is the locator controls post back, INV-8's file list includes the lock sidecar it always mandated. Every line number is out of the prose -- the panel found two already stale. 565 -> 593 tests. Nothing declined.
This commit is contained in:
+26
-1
@@ -358,6 +358,7 @@ REFUSED = 2
|
||||
# decides what a booth URL is, and these are the rows the CLI must agree on.
|
||||
# A second `/b/` check inlined in the shell for speed goes red HERE.
|
||||
from test_benches import BOOTH_URL_TABLE # noqa: E402
|
||||
from booth.benches import normalize_bench_url as normalize_bench_url_cli # noqa: E402
|
||||
|
||||
|
||||
@pytest.mark.parametrize("url,is_booth", [(u, e is not None) for u, e in BOOTH_URL_TABLE])
|
||||
@@ -378,9 +379,14 @@ def test_a_refused_link_writes_nothing_at_all(booth):
|
||||
data, _ = booth
|
||||
board = data / "links"
|
||||
assert not board.exists()
|
||||
before = sorted(p.name for p in data.iterdir())
|
||||
r = run(data, "link", "http://10.100.10.50:8090/b/some-booth/", "nope")
|
||||
assert r.returncode == REFUSED
|
||||
assert not board.exists(), f"a refused link left {sorted(p.name for p in board.iterdir())}"
|
||||
assert not board.exists(), "a refused link created the board directory"
|
||||
# NOTHING AT ALL, not just no board. Asserting only `links/`'s absence let
|
||||
# a refusal that touched `.benches.lock` (or any other sidecar) on its way
|
||||
# out stay green — the cold panel's vacuity pass named exactly that.
|
||||
assert sorted(p.name for p in data.iterdir()) == before, "a refused link wrote something"
|
||||
|
||||
|
||||
def test_the_refusal_names_the_alternative(booth):
|
||||
@@ -410,6 +416,18 @@ def test_bench_add_is_an_upsert(booth):
|
||||
r = run(data, "bench", "ls")
|
||||
assert r.returncode == OK, r.stderr
|
||||
assert r.stdout.count("talk v") == 1 and "talk v2" in r.stdout
|
||||
# THE ID, WHOLE AND UNTRUNCATED, because it is the locator `bench state`
|
||||
# and `bench rm` take. An earlier version of this test had a docstring
|
||||
# claiming `bench ls` prints ids and asserted nothing of the kind, while
|
||||
# the code printed a url truncated to 52 columns — a claim standing in for
|
||||
# evidence, which is how the drift would have survived CI. Found by all
|
||||
# four cold arms independently.
|
||||
bid = normalize_bench_url_cli("https://talk.nh3.phasefinal.com:8092/")
|
||||
assert bid in r.stdout, r.stdout
|
||||
# and what ls prints is addressable, end to end
|
||||
line = [l for l in r.stdout.splitlines() if "talk v2" in l][0]
|
||||
printed_id = line.split()[-1]
|
||||
assert run(data, "bench", "state", printed_id, "promoted").returncode == OK
|
||||
|
||||
|
||||
def test_bench_verbs_round_trip(booth):
|
||||
@@ -476,6 +494,12 @@ def test_import_classifies_into_three_groups(booth):
|
||||
assert "gone" in out # the booth row, skipped
|
||||
assert "talk" in out # a candidate
|
||||
assert "ftp://x.test/f" in out # refused, with its reason
|
||||
# THE RAW URL BESIDE THE NORMALIZED ID, which is the entire point of the
|
||||
# proposal: five rows of `talk` collapsing to one is only checkable if you
|
||||
# can see which raw URLs produced the one id. This printed the description
|
||||
# instead, so the collapse was invisible in the one place it had to be
|
||||
# visible. All four cold arms found it.
|
||||
assert out.count("https://talk.nh3.phasefinal.com:8092/") >= 2, out
|
||||
|
||||
|
||||
def test_import_apply_collapses_the_repost(booth):
|
||||
@@ -503,6 +527,7 @@ def test_nothing_in_the_unit_touches_links_md(booth):
|
||||
run(data, "bench", "import", "--apply")
|
||||
run(data, "bench", "add", "http://new.test/", "new")
|
||||
run(data, "bench", "state", "http://new.test/", "retired")
|
||||
run(data, "bench", "ls") # a read verb can truncate too
|
||||
run(data, "bench", "rm", "http://new.test/")
|
||||
after = hashlib.sha256((board / "links.md").read_bytes()).hexdigest()
|
||||
assert before == after
|
||||
|
||||
Reference in New Issue
Block a user