` elements writes them. So the pair the judge believes comes from the RUN's accounting, and the bundle text only confirms it. Every arm below is a way a document can put the sentence, or the whole block, into a bundle; the run's ledger holds ONE conversion and it is about other pictures, so the route is live and no arm may reach it. The known-positive at the end books the pair and shows the route still works. Thirteen arms. Eleven are PM's own list of ways the shape anchoring already refused, kept as a regression guard -- narrowing this rule later must not quietly widen one of them -- and two are the form that defeated it: a perfectly written pointer block the run never booked, once in the bundle's ordinary text and once naming the asset it points at exactly. """ never_carried = tmp_path / "figur.bmp" never_carried.write_bytes(_huge_bmp()) real = tmp_path / "ekte.png" real.write_bytes(_png_bytes(b"\x10\x20\x30")) before = gate._sha256(never_carried) after = gate._sha256(real) assets = {f"{after[:12]}-ekte.png": after} clause = f"converted from image/bmp sha256:{before} to image/png sha256:{after}" pointer = f"\nImage: ekte.png (1x1 px)" # The same clause with U+00A0 where the spaces are: PM's N6. nbsp_clause = clause.replace(" ", "\u00a0") other = "0" * 64 arms = { "plain body text": f"{pointer}\n\nProsess 84. {clause}. Se figuren over.\n", "a table cell": f"{pointer}\n\n| Krav | Kilde |\n| --- | --- |\n| 84-1 | {clause} |\n", "a figure caption": f"{pointer}\n\nFigur 84-1 -- {clause}\n", "a fenced code block": f"{pointer}\n\n```\n{clause}\n```\n", "link text with a URL": f"{pointer}\n\n[{clause}](https://example.invalid/x)\n", "the clause with non-breaking spaces": f"{pointer}\n\n{nbsp_clause}\n", "a clause naming another asset's digest": ( f"\n" f"Image: ekte.png (1x1 px) -- converted from image/bmp sha256:{before} " f"to image/png sha256:{other}\n" ), "a pointer block naming another asset": ( f"\nImage: annen.png (1x1 px) -- {clause}\n" f"{pointer}\n" ), "an Image: line of its own": f"{pointer}\n\nImage: figur.bmp (8x4 px) -- {clause}\n", "the whole block inside a code fence": ( f"{pointer}\n\n```\n\n" f"Image: figur.bmp (8x4 px) -- {clause}\n```\n" ), "the whole block on one line": ( f"{pointer}\n\n " f"Image: figur.bmp (8x4 px) -- {clause}\n" ), # The two that defeated the shape anchoring. Written exactly as the # code writes them, because that is the point: the form is not a # signature, and only the ledger can tell these from the real thing. "a whole pointer block the run never booked": ( f"{pointer}\n\n\n" f"Image: figur.bmp (8x4 px) -- {clause}\n" ), "that block alone in the bundle": ( f"\nImage: figur.bmp (8x4 px) -- {clause}\n" ), } # The run booked ONE conversion and it is about neither of these files, so # the route is live in every arm and nothing it could believe is true. live = _ledger(("f" * 64, "e" * 64)) for label, text in arms.items(): build = _build(assets=assets, bundle_text=text, accounting=live) assert gate.asset_holds(build, never_carried) is False, ( f"{label}: a document talked the judge into a carry that never happened" ) # KNOWN-POSITIVE on the same bytes: the last arm's text, believed once the # RUN books the pair. Without it every arm above would pass on a route # that had simply stopped working. booked = _ledger((before, after)) honest = _build( assets=assets, bundle_text=arms["that block alone in the bundle"], accounting=booked, ) assert gate.asset_holds(honest, never_carried) is True # THE ASSET BINDING, ON ITS OWN. The run booked this pair and the block # stating it points at a different picture -- a sentence nothing here # writes. Measured 2026-09-19: with the ledger in front of it, every arm # above passes whether or not the binding is checked, so without this the # mutant that removes it survives the whole suite. misplaced = _build( assets=assets, bundle_text=( f"\nImage: figur.bmp (8x4 px) -- {clause}\n" ), accounting=booked, ) assert gate.asset_holds(misplaced, never_carried) is False, ( "a clause in one asset's block spoke for another asset's digest" ) def test_the_build_never_writes_a_claim_the_document_supplied(tmp_path: Path) -> None: """PM's measured path, end to end through the real `okf build`. The judge reading only pointer blocks is half of it. The other half is that an image's own LABEL is document text written INSIDE a pointer block, so the door that puts it there must not let it emit the grammar the judge reads. This builds the forgery PM measured: a BMP that is refused and never carried, a real PNG that is, and an `alt` attribute claiming the first became the second. """ pytest.importorskip("llm_ingestion_guard") corpus = tmp_path / "inbox" (corpus / "graphics").mkdir(parents=True) never_carried = corpus / "graphics" / "figur.bmp" never_carried.write_bytes(_huge_bmp()) real = corpus / "graphics" / "ekte.png" real.write_bytes(_png_bytes(b"\x10\x20\x30")) before = gate._sha256(never_carried) after = gate._sha256(real) clause = f"converted from image/bmp sha256:{before} to image/png sha256:{after}" (corpus / "prosess.html").write_text( "\n
Toleranseklassene staar i figuren under.
\n" f'
\n'
"Og den store figuren:
\n" '
\n'
f"{clause}
\n" "\n", encoding="utf-8", ) build = gate.run_build(corpus, tmp_path / "work", door=False) assert build.exit_code == 0, build.log assert any(name.startswith(after[:12]) for name in build.assets), build.assets assert not any(name.startswith(before[:12]) for name in build.assets), ( "the 50 000 x 50 000 BMP was carried; the arm measures nothing" ) assert gate.asset_holds(build, never_carried) is False, ( "a document's own alt text talked the judge into a carry that never happened" ) def _small_bmp() -> bytes: """An uncompressed 24-bit 2x2 BMP -- a real picture this build CONVERTS. BMP is outside `VIEWABLE_MEDIA_TYPES`, so the run rewrites it as a PNG and books the conversion. It is the known-positive every forgery arm below needs: without it an arm could pass because the route stopped working. """ import struct rows = (((255, 0, 0), (0, 255, 0)), ((0, 0, 255), (255, 255, 255))) # A 24-bit row is padded to a multiple of four bytes; without the pad the # reader refuses the file rather than guessing at the stride. pad = b"\x00" * ((-2 * 3) % 4) body = b"".join(b"".join(bytes((b, g, r)) for (r, g, b) in row) + pad for row in rows) dib = struct.pack("
'
'
'
'
\n'
f"{body}\n\n",
encoding="utf-8",
)
if note is not None:
(inbox / "notat.md").write_text(note, encoding="utf-8")
return inbox, before, after
def test_a_document_cannot_forge_the_WHOLE_pointer_block(tmp_path: Path) -> None:
"""THE FORM IS NOT A SIGNATURE -- measured by PM 2026-09-19 on `ae441ab`.
The previous round bound the conversion claim to a pointer block, which
closed the two routes PM had measured. It did not close the class: a
pointer block is two lines of markdown, and an ordinary HTML document
writes two lines of markdown by having two `` elements. PM reproduced it through the real `okf build` -- a BMP refused `asset_too_large` and absent from `assets/` read as carried, from a document naming one digest that is public in the bundle and one that is computable in advance. So the claim is bound to what the RUN wrote: the build books each conversion in its own accounting, which no document can reach, and the bundle text is read only to CONFIRM. Each arm below is a whole build. """ pytest.importorskip("llm_ingestion_guard") tail = "-- converted from image/bmp sha256:{before} to image/png sha256:{after}" arms = { "two
elements in one HTML file": ( "

\n" "Image: graphics/ekte.png (1x1 px) " + tail + "
", None, ), "one with a
": (
"

"
"Image: graphics/ekte.png (1x1 px) " + tail + "
Se notatet.
", "# Notat\n\n\n" "Image: graphics/ekte.png (1x1 px) " + tail + "\n", ), } for index, (label, (body, note)) in enumerate(arms.items()): root = tmp_path / f"arm{index}" root.mkdir() # Two passes: the first learns the digests, the second writes the # document that names them. The forger has the same information -- # both digests are readable from a bundle this build already wrote. inbox, before, after = _forgery_corpus(root, "placeholder
") shaped = {"before": before, "after": after, "after12": after[:12]} (inbox / "prosess.html").write_text( (inbox / "prosess.html") .read_text(encoding="utf-8") .replace("placeholder
", body.format(**shaped)), encoding="utf-8", ) if note is not None: (inbox / "notat.md").write_text(note.format(**shaped), encoding="utf-8") build = gate.run_build(inbox, root / "work", door=True) assert build.exit_code == 0, build.log never_carried = inbox / "graphics" / "stor.bmp" assert not any(name.startswith(before[:12]) for name in build.assets), ( f"{label}: the refused BMP was carried; the arm measures nothing" ) assert gate.asset_holds(build, never_carried) is False, ( f"{label}: a document wrote the pointer block and the judge believed it" ) # KNOWN-POSITIVE on the same build: the picture the run really did # convert still reads as held. Without it every arm above would pass # on a route that had simply been switched off. assert gate.asset_holds(build, inbox / "graphics" / "figur.bmp") is True, ( f"{label}: the run's own conversion stopped being provable" ) def test_the_judge_proves_carriage_and_says_it_does_not_prove_fidelity(tmp_path: Path) -> None: """The limit, MEASURED here rather than trusted to the prose beside it. PM's M10 2026-09-19: a mutated converter that writes a BLANK PNG gives `asset_holds = True`. The bundle is internally consistent -- the digest it claims to have written really is the asset's digest -- and the judge has no opinion about whether those bytes hold the source's picture. The suite fells that mutant (`test_the_carried_png_holds_the_source_pixels_exactly` decodes both sides); this gate cannot, and the docstring's "a bundle claiming a conversion it did not perform still fails" reads wider than the route reaches. So the limit is asserted in BOTH directions: it is real (the blank PNG is accepted) and it is stated (the docstring names it). Teaching the judge pixels is a different job; leaving a reader to infer the gap is not. """ source = tmp_path / "figur.bmp" source.write_bytes(_huge_bmp()) blank = tmp_path / "blank.png" blank.write_bytes(_png_bytes(b"\xff\xff\xff")) before = gate._sha256(source) after = gate._sha256(blank) text = ( f"\n" f"Image: figur.bmp (8x4 px) -- converted from image/bmp sha256:{before} " f"to image/png sha256:{after}\n" ) build = _build( assets={f"{after[:12]}-figur.png": after}, bundle_text=text, accounting=_ledger((before, after)), ) assert gate.asset_holds(build, source) is True doc = gate.asset_holds.__doc__ or "" lowered = doc.lower() assert "fidelity" in lowered, "the judge does not say what its second route cannot see" assert "pixel" in lowered, "the limit is stated without naming what is not checked" def _declared(heading: int = 2, image: int = 1, fate: str = "rejected") -> dict[str, Any]: return { "accounting_version": 1, "documents": [ { "source_file": "a.md", "status": "persisted", "code": None, "inventory": {"heading": 2, "image": 1}, "fates": { "heading": {"carried": heading}, "image": {"pointer": image}, }, } ], "files": [{"source_file": "graphics/x.png", "fate": fate, "code": "extractor_unknown"}], } def _corpus(tmp_path: Path) -> Path: (tmp_path / "graphics").mkdir() (tmp_path / "graphics" / "x.png").write_bytes(b"png bytes") return tmp_path def test_row1_is_green_when_every_type_has_a_fasit() -> None: inventory = { "documents": {f"f{s}": {"suffix": s, "elements": {}} for s in TABLE}, "files": {}, } row = gate.row1(TABLE, inventory, inventory) assert (row.k, row.m, row.status) == (13, 13, gate.GREEN) def test_row1_is_red_when_one_type_lacks_a_fasit() -> None: inventory = { "documents": {f"f{s}": {"suffix": s, "elements": {}} for s in TABLE[:-1]}, "files": {}, } row = gate.row1(TABLE, inventory, inventory) assert (row.k, row.m, row.status) == (12, 13, gate.RED) def test_row1_is_red_when_the_committed_fasit_is_stale() -> None: inventory = {"documents": {"f.md": {"suffix": ".md", "elements": {"heading": 1}}}} fresh = {"documents": {"f.md": {"suffix": ".md", "elements": {"heading": 2}}}} row = gate.row1([".md"], inventory, fresh) assert (row.k, row.status) == (0, gate.RED) def test_row2_is_red_without_the_door() -> None: row = gate.row2([".md"], _inventory(), _build(), door=False) assert (row.k, row.m, row.status) == (0, 1, gate.RED) def test_row2_is_green_when_the_declared_inventory_equals_the_witness() -> None: row = gate.row2([".md"], _inventory(), _build(accounting=_declared()), door=True) assert (row.k, row.m, row.status) == (1, 1, gate.GREEN) def test_row2_is_red_when_the_declared_inventory_is_one_off() -> None: declared = _declared() declared["documents"][0]["inventory"]["heading"] = 3 row = gate.row2([".md"], _inventory(), _build(accounting=declared), door=True) assert (row.k, row.status) == (0, gate.RED) def test_row3_is_green_when_every_element_and_file_has_one_fate(tmp_path: Path) -> None: units = gate.account(_inventory(), _build(accounting=_declared()), _corpus(tmp_path)) row = gate.row3(units, door=True) assert (row.k, row.m, row.status) == (2, 2, gate.GREEN) @pytest.mark.parametrize(("heading", "u", "d"), [(1, 1, 0), (3, 0, 1)]) def test_row3_is_red_one_element_either_side(tmp_path: Path, heading: int, u: int, d: int) -> None: units = gate.account( _inventory(), _build(accounting=_declared(heading=heading)), _corpus(tmp_path) ) document = units[0] assert (document.unaccounted, document.double) == (u, d) assert gate.row3(units, door=True).status == gate.RED def test_row3_is_red_when_no_fate_is_declared(tmp_path: Path) -> None: units = gate.account(_inventory(), _build(), _corpus(tmp_path)) assert units[0].unaccounted == 3 assert gate.row3(units, door=False).status == gate.RED def test_row3_says_how_many_documents_were_refused_whole_and_what_they_cost() -> None: """P11 and P12, PM 2026-09-19: row 3's own summary of a refusal, and the `refused=` column on its detail line, could each be deleted with this file staying green at 106 passed. The LOSS is held -- `Unit.refused` keeps the unit unclean and the note names the source and its code -- but what the ROW says about it was decoration nothing pinned, and the row is what a reader of the gate's output actually sees. R, D and the element total are counted HERE, over the units this test built, never read back off the row. The known-negative is the same units without a refusal: the sentence has to change with them, or it is a constant that happens to read true.""" refused_note = "refused whole: 17 element(s) declared rejected `fail_secure`" units = [ gate.Unit("a.xml", "document", 0, 0, refused=17, notes=[refused_note]), gate.Unit("b.json", "document", 0, 0, refused=4, notes=["refused whole: 4 element(s)"]), gate.Unit("c.md", "document", 0, 0, verified=9), gate.Unit("d.png", "file", 0, 0), ] documents = [u for u in units if u.kind == "document"] refused_docs = [u for u in documents if u.refused] elements = sum(u.refused for u in units) assert (len(refused_docs), len(documents), elements) == (2, 3, 21) row = gate.row3(units, door=True) assert row.status == gate.RED assert ( f"{elements} element(s) lost with " f"{len(refused_docs)} of {len(documents)} document(s) refused whole" ) in row.reason for unit in refused_docs: assert any( unit.name in detail and f"refused={unit.refused}" in detail for detail in row.details ), unit.name clean = [gate.Unit(u.name, u.kind, 0, 0, verified=9) for u in units] assert ( "0 element(s) lost with 0 of 3 document(s) refused whole" in gate.row3(clean, door=True).reason ) def test_a_file_carried_through_a_document_and_rejected_is_double_booked(tmp_path: Path) -> None: corpus = _corpus(tmp_path) carried = _assets(corpus / "graphics" / "x.png") units = gate.account(_inventory(), _build(accounting=_declared(), assets=carried), corpus) assert (units[1].unaccounted, units[1].double) == (0, 1) def test_a_file_carried_through_a_document_and_declared_carried_is_clean(tmp_path: Path) -> None: corpus = _corpus(tmp_path) carried = _assets(corpus / "graphics" / "x.png") build = _build(accounting=_declared(fate="carried"), assets=carried) assert gate.account(_inventory(), build, corpus)[1].clean def test_a_file_declared_carried_without_its_bytes_is_unaccounted(tmp_path: Path) -> None: build = _build(accounting=_declared(fate="carried")) unit = gate.account(_inventory(), build, _corpus(tmp_path))[1] assert (unit.unaccounted, unit.double) == (1, 0) def test_an_unpointed_file_sharing_bytes_with_a_carried_one_is_not_carried( tmp_path: Path, ) -> None: corpus = _corpus(tmp_path) (corpus / "graphics" / "twin.png").write_bytes(b"png bytes") inventory = _inventory() inventory["files"]["graphics/twin.png"] = {"pointed_at_by": []} carried = _assets(corpus / "graphics" / "x.png") units = gate.account(inventory, _build(assets=carried), corpus) assert [(u.name, u.double) for u in units[1:]] == [ ("graphics/twin.png", 0), ("graphics/x.png", 1), ] def test_without_the_door_double_booking_is_derived_from_conservation(tmp_path: Path) -> None: corpus = _corpus(tmp_path) carried = _assets(corpus / "graphics" / "x.png") assert gate.account(_inventory(), _build(assets=carried), corpus)[1].double == 1 assert gate.account(_inventory(), _build(), corpus)[1].clean # --- B-1: the judge opens the bundle itself ---------------------------------- # # Written RED 2026-09-18 against the hardening order. At 864570b the gate # compared BOOKED NUMBERS with the witness's counts and never opened a concept # file, so a report that booked every element of every document as carried was # `GATE GREEN` over a bundle holding nothing (independent review, B-1). def _all_carried(headings: int = 2, images: int = 1) -> dict[str, Any]: """A report that books everything as carried, the cheat's shape.""" return { "accounting_version": 1, "documents": [ { "source_file": "a.md", "status": "persisted", "code": None, "inventory": {"heading": 2, "image": 1}, "fates": { "heading": {"carried": headings}, "image": {"carried": images}, }, } ], "files": [ {"source_file": "graphics/x.png", "fate": "rejected", "code": "extractor_unknown"} ], } def test_carried_text_the_bundle_does_not_hold_is_unverified(tmp_path: Path) -> None: build = _build(accounting=_all_carried(images=0), bundle_text="") unit = gate.account(_inventory(), build, _corpus(tmp_path))[0] assert unit.unverified == 2 assert not unit.clean def test_carried_text_the_bundle_holds_verifies(tmp_path: Path) -> None: corpus = _corpus(tmp_path) build = _build(accounting=_all_carried(images=0), assets=_assets(corpus / "graphics" / "x.png")) unit = gate.account(_inventory(), build, corpus)[0] assert (unit.unverified, unit.verified) == (0, 2) def test_one_heading_carried_of_two_in_the_bundle_is_unverified(tmp_path: Path) -> None: build = _build(accounting=_all_carried(images=0), bundle_text="# Foerste overskrift\n") unit = gate.account(_inventory(), build, _corpus(tmp_path))[0] assert unit.unverified == 1 def test_an_image_booked_carried_without_its_bytes_is_unverified(tmp_path: Path) -> None: """The image element has no text of its own, so the only proof it was carried is the asset. Without it the booking is not verifiable, and an unverifiable booking is never clean.""" unit = gate.account(_inventory(), _build(accounting=_all_carried()), _corpus(tmp_path))[0] assert unit.unverified >= 1 assert not unit.clean def test_a_negative_booking_is_never_clean(tmp_path: Path) -> None: declared = _all_carried() declared["documents"][0]["fates"]["heading"] = { "carried": 25, "rejected": {"extractor_unknown": -15}, } unit = gate.account(_inventory(), _build(accounting=declared), _corpus(tmp_path))[0] assert unit.invalid >= 1 assert not unit.clean # 25 + (-15) = 10 booked against a source holding 2, so eight are booked # twice. Absorbing the sign would read 40 and report thirty-eight. assert unit.double == 8 def test_a_document_declared_persisted_that_is_not_in_the_bundle_is_never_clean( tmp_path: Path, ) -> None: build = _build(accounting=_all_carried(), sources=set()) unit = gate.account(_inventory(), build, _corpus(tmp_path))[0] assert unit.invalid >= 1 def test_everything_rejected_is_never_clean_for_a_document_the_build_persisted( tmp_path: Path, ) -> None: declared = _all_carried() declared["documents"][0]["fates"] = { "heading": {"rejected": {"fail_secure": 2}}, "image": {"rejected": {"fail_secure": 1}}, } unit = gate.account(_inventory(), _build(accounting=declared), _corpus(tmp_path))[0] assert unit.invalid >= 1 assert "persisted" in "; ".join(unit.notes) def test_a_document_refused_whole_is_never_clean(tmp_path: Path) -> None: """H1, measured by PM 2026-09-18: a document the build refused books every element as a coded rejection, so u = 0 and d = 0 and the unit read CLEAN. The fate is honest and the content is gone; the gate has to say both.""" declared = _all_carried() declared["documents"][0]["status"] = "rejected" declared["documents"][0]["code"] = "fail_secure" declared["documents"][0]["fates"] = { "heading": {"rejected": {"fail_secure": 2}}, "image": {"rejected": {"fail_secure": 1}}, } unit = gate.account( _inventory(), _build(accounting=declared, sources=set()), _corpus(tmp_path) )[0] assert not unit.clean assert unit.refused == 3 assert "fail_secure" in "; ".join(unit.notes) def test_a_document_refused_whole_is_not_made_clean_by_the_neighbour(tmp_path: Path) -> None: """H1 in the shape the po scenario meets it: ONE refused source beside an accepted one. `refused_whole` asks its question only when the corpus persisted NOTHING, so the partial case reached row 3 as `clean = 4 of 4` with `okf build` exiting 0 and three elements gone unseen.""" inventory = _inventory() inventory["documents"]["b.md"] = { "suffix": ".md", "elements": {"heading": 1}, "texts": {"heading": [["Refused"]]}, "images": [], } declared = _all_carried() declared["documents"].append( { "source_file": "b.md", "status": "rejected", "code": "fail_secure", "inventory": {"heading": 1}, "fates": {"heading": {"rejected": {"fail_secure": 1}}}, } ) declared["files"][0]["fate"] = "carried" build = _build( accounting=declared, sources={"a.md"}, assets=_assets(_corpus(tmp_path) / "graphics" / "x.png"), ) units = gate.account(inventory, build, tmp_path) refused = next(u for u in units if u.name == "b.md") assert gate.refused_whole(inventory["documents"], build) is None, "the corpus is not refused" assert not refused.clean assert (refused.name, refused.refused) == ("b.md", 1) row = gate.row3(units, door=True) assert row.status == gate.RED assert any("b.md" in detail and "fail_secure" in detail for detail in row.details) def test_a_document_declared_rejected_that_the_bundle_holds_is_never_clean( tmp_path: Path, ) -> None: """H2 / mutant X2: the mirror of `test_a_document_declared_persisted_that_is_not_in_the_bundle_is_never_clean`, and the only one of B-1's six refusals no test drove. A report claiming a document was refused while a concept in the bundle names it is the shape that hides a persist gate that did not fire. The known-negative on the same declaration: with no concept naming it, the refusal is honest and the only finding is H1's own column.""" declared = _all_carried() declared["documents"][0]["status"] = "rejected" declared["documents"][0]["code"] = "fail_secure" declared["files"][0]["fate"] = "carried" corpus = _corpus(tmp_path) assets = _assets(corpus / "graphics" / "x.png") held = gate.account( _inventory(), _build(accounting=declared, sources={"a.md"}, assets=assets), corpus )[0] assert held.invalid >= 1 assert "declared rejected" in "; ".join(held.notes) honest = _all_carried() honest["documents"][0]["status"] = "rejected" honest["documents"][0]["code"] = "fail_secure" honest["documents"][0]["fates"] = { "heading": {"rejected": {"fail_secure": 2}}, "image": {"rejected": {"fail_secure": 1}}, } honest["files"][0]["fate"] = "carried" absent = gate.account( _inventory(), _build(accounting=honest, sources=set(), assets=assets), corpus )[0] assert absent.invalid == 0 assert absent.refused == 3 def test_a_rejection_code_outside_the_closed_list_is_never_clean(tmp_path: Path) -> None: declared = _all_carried() declared["documents"][0]["status"] = "rejected" declared["documents"][0]["code"] = "because_i_said_so" declared["documents"][0]["fates"] = { "heading": {"rejected": {"because_i_said_so": 2}}, "image": {"rejected": {"because_i_said_so": 1}}, } unit = gate.account( _inventory(), _build(accounting=declared, sources=set()), _corpus(tmp_path) )[0] assert unit.invalid >= 1 def test_an_accounting_version_the_gate_does_not_read_is_never_clean(tmp_path: Path) -> None: declared = _all_carried() declared["accounting_version"] = 2 units = gate.account(_inventory(), _build(accounting=declared), _corpus(tmp_path)) assert not any(u.clean for u in units) def test_an_asset_with_the_right_name_and_the_wrong_bytes_is_not_carried(tmp_path: Path) -> None: """m-1: the check was a NAME check, so a zero-byte file called `