test(storage): support flattened SQLite expiry query plans

Co-authored-by: multica-agent <[email protected]>
This commit is contained in:
RockChinQ
2026-10-18 16:29:22 +08:00
co-authored by multica-agent
parent 57077740bd
commit 3794a7ee64
2 changed files with 82 additions and 1 deletions
@@ -214,8 +214,11 @@ async def test_event_scan_budget_advances_past_foreign_events_without_reading_pa
plan = ' '.join(
row[3] for row in await connection.exec_driver_sql('EXPLAIN QUERY PLAN ' + statement, parameters)
)
if 'CORRELATED' in plan:
# SQLite 3.53 reports a flattened EXISTS lookup instead of a
# CORRELATED subquery. Classify the query by SQL, not planner wording.
if 'EXISTS (' in statement:
assert 'SEARCH agent_run_event USING INTEGER PRIMARY KEY' in plan, plan
assert 'USING INDEX ix_agent_run_run_id' in plan, plan
else:
assert 'COVERING INDEX ix_agent_run_event_media_ttl' in plan, plan
assert 'TEMP B-TREE' not in plan, plan