Skip to content

Commit b472597

Browse files
author
Mike Bridge
committed
test(versioning): pin cross-type purge streak isolation
Answer Richard's review on #44262: distinguish boundary joins and legacy predecessors from same-UUID records of another type, so removing any entity_type guard fails the fixture. Document the server-banner trust assumption without changing purge behavior.
1 parent e16fe62 commit b472597

2 files changed

Lines changed: 45 additions & 9 deletions

File tree

‎UPDATING.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ theme editor picker.
418418
equivalent correlated predecessor probes instead of window tables. That
419419
legacy plan may be slower on deep histories; measure the selected path and
420420
writer wait on the target backend rather than reusing timings from another plan.
421+
Dispatch trusts the dialect's `SELECT VERSION()` banner: a proxy advertising
422+
MySQL 8.x in front of MySQL 5.7 selects `LAG` and fails at runtime.
421423
Ten batches are shared across all categories per run, so the removal upper
422424
bound is **500 at the default or 1,000 at the ceiling**, and can be lower
423425
when rechecks reject candidates or categories use short batches. The default

‎tests/unit_tests/commands/deletion_retention/test_prune_audit.py‎

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,26 +532,60 @@ def test_repeat_dispatch_uses_metadata_server_version(
532532
)
533533

534534

535-
def test_repeat_paths_isolate_entity_types_and_agree() -> None:
536-
"""Keep each type's first block when UUIDs collide, in both query paths."""
535+
@pytest.mark.parametrize(
536+
("history", "repeat_indices"),
537+
[
538+
pytest.param(
539+
[
540+
("chart", STATUS_BLOCKED, 1, "same"),
541+
("dashboard", STATUS_BLOCKED, 2, "other"),
542+
("chart", STATUS_BLOCKED, 3, "same"),
543+
],
544+
[2],
545+
id="partition-reason-isolation",
546+
),
547+
pytest.param(
548+
[
549+
("dashboard", STATUS_CONFIRMED, 1, None),
550+
("chart", STATUS_BLOCKED, 5, "same"),
551+
("chart", STATUS_CONFIRMED, 6, None),
552+
("chart", STATUS_BLOCKED, 7, "same"),
553+
("chart", STATUS_BLOCKED, 8, "same"),
554+
],
555+
[4],
556+
id="boundary-join-isolation",
557+
),
558+
pytest.param(
559+
[
560+
("dashboard", STATUS_BLOCKED, 1, "same"),
561+
("chart", STATUS_BLOCKED, 2, "same"),
562+
("chart", STATUS_BLOCKED, 3, "same"),
563+
],
564+
[2],
565+
id="predecessor-type-isolation",
566+
),
567+
],
568+
)
569+
def test_repeat_paths_isolate_entity_types_and_agree(
570+
history: list[tuple[str, str, int, str | None]], repeat_indices: list[int]
571+
) -> None:
572+
"""Keep per-type streak survivors despite shared UUIDs and foreign boundaries."""
537573
engine: sa.Engine = sa.create_engine("sqlite://")
538574
metadata: sa.MetaData = sa.MetaData()
539575
table: sa.Table = prune_audit.PurgeAuditLog.__table__.to_metadata(metadata)
540-
ids: list[UUID] = [uuid4() for _ in range(3)]
576+
ids: list[UUID] = [uuid4() for _ in history]
541577
rows: list[dict[str, Any]] = [
542578
{
543579
"id": id_,
544580
"entity_type": entity_type,
545581
"entity_uuid": "shared",
546-
"status": STATUS_BLOCKED,
582+
"status": status,
547583
"trigger": "scheduled",
548584
"actor": "system",
549585
"created_on": datetime(2026, 1, day),
550-
"reason": "same" if entity_type == "chart" else "other",
586+
"reason": reason,
551587
}
552-
for id_, entity_type, day in zip(
553-
ids, ["chart", "dashboard", "chart"], [1, 2, 3], strict=True
554-
)
588+
for id_, (entity_type, status, day, reason) in zip(ids, history, strict=True)
555589
]
556590
try:
557591
metadata.create_all(engine)
@@ -568,7 +602,7 @@ def test_repeat_paths_isolate_entity_types_and_agree() -> None:
568602
predicate(table, datetime(2026, 2, 1)),
569603
)
570604
)
571-
) == {ids[2]}
605+
) == {ids[index] for index in repeat_indices}
572606
finally:
573607
engine.dispose()
574608

0 commit comments

Comments
 (0)