Two milestones: a note can carry its own check (317), and a rule keeps what it used to say (323) #135
@@ -35,10 +35,13 @@ OWNER_USERNAME = "rule_history_owner"
|
||||
async def constraint():
|
||||
"""One rule carrying a check, with no history yet.
|
||||
|
||||
Cleanup is in this fixture's own teardown, never in an autouse one:
|
||||
`_dispose_engine` arrives through usefixtures, so it tears down BEFORE an
|
||||
autouse fixture would, and a database call after that point orphans a
|
||||
pooled connection and breaks the NEXT test to touch Postgres (#3240).
|
||||
CLEANED UP AT SETUP, NOT TEARDOWN, and that is forced. `update_rule` fires
|
||||
a detached `asyncio.create_task(upsert_rule_embedding(...))` that opens
|
||||
its own connection and UPDATEs the rule row. A teardown that deleted the
|
||||
rulebook would race it: the delete cascade-locks the rule the embedding
|
||||
task is writing, and Postgres kills one of them with a deadlock. Purging
|
||||
at setup instead runs on a fresh loop, after the previous test's loop
|
||||
closed and cancelled whatever it left in flight.
|
||||
"""
|
||||
async with async_session() as s:
|
||||
owner = await ensure_user(s, OWNER_USERNAME)
|
||||
@@ -60,13 +63,7 @@ async def constraint():
|
||||
verify_with="read the workflow's shell setting",
|
||||
)
|
||||
|
||||
yield {"uid": uid, "rule_id": rule.id}
|
||||
|
||||
async with async_session() as s:
|
||||
row = await s.get(Rulebook, book.id)
|
||||
if row is not None:
|
||||
await s.delete(row)
|
||||
await s.commit()
|
||||
return {"uid": uid, "rule_id": rule.id}
|
||||
|
||||
|
||||
async def _versions(rule_id: int) -> list[RuleVersion]:
|
||||
|
||||
Reference in New Issue
Block a user