test(index): pin Door C's cross-run ordering bound
`d2a8c43` states in a code comment that Door C's ordering holds within a
run and never re-orders entries an earlier run wrote. That was true and
untested: every test in the new file ran each door exactly once, so the
sentence was prose rather than a pin.
Two imports into one bundle, the second adding the concept whose key
sorts FIRST. It lands last, because `link_in_index` appends what is
absent and leaves what is present. The same three concepts merged in one
run do come out ordered, asserted alongside, so the two assertions cannot
both be trivially true -- the difference is the append bound, not an
ordering that failed.
883 tests.
Co-Authored-By: Claude <claude-opus-5>
This commit is contained in:
parent
d2a8c43d77
commit
7f568b3691
1 changed files with 32 additions and 0 deletions
|
|
@ -235,3 +235,35 @@ def test_navigation_entries_stay_last_under_a_sort_key() -> None:
|
|||
"n900.md",
|
||||
f"sub/{NUMBERED.index.name}",
|
||||
]
|
||||
|
||||
|
||||
def test_door_c_orders_within_a_run_and_never_re_orders_an_earlier_one(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
"""The bound this door's ordering actually has, pinned rather than asserted.
|
||||
|
||||
`link_in_index` appends what is absent and leaves what is present where it
|
||||
is, so a concept merged in a later round lands at the END of the index even
|
||||
when the key says it sorts first. Door B reprojects and has no such bound;
|
||||
Door C writes the sender's bytes verbatim and its index is append-idempotent
|
||||
by design, so making it reproject is a different piece of work. The
|
||||
guarantee is therefore "within a run", and a guarantee stated in a comment
|
||||
with no test that goes red is not a guarantee.
|
||||
"""
|
||||
source = tmp_path / "source"
|
||||
place(source, "b.md", "---\ntype: dataset\nnumber: N200\n---\n\nBody.\n")
|
||||
place(source, "c.md", "---\ntype: dataset\nnumber: N300\n---\n\nBody.\n")
|
||||
_, bundle = run_with(tmp_path, StubImportGate(), profile=NUMBERED)
|
||||
|
||||
place(source, "a.md", "---\ntype: dataset\nnumber: N100\n---\n\nBody.\n")
|
||||
run_with(tmp_path, StubImportGate(), profile=NUMBERED)
|
||||
|
||||
# N100 sorts first and lands last, because round one's lines stay put.
|
||||
assert numbers_in(bundle, NUMBERED) == ["N200", "N300", "N100"]
|
||||
# The same three concepts merged in ONE run do come out ordered — so the
|
||||
# difference above is the append bound, not an ordering that failed.
|
||||
assert numbers_in(run_door_c(tmp_path / "fresh", profile=NUMBERED), NUMBERED) == [
|
||||
"N100",
|
||||
"N200",
|
||||
"N300",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue