Materialize instances when a quest definition is created
create_quest_definition persisted the rule, definition, assignees and windows but never called regenerate_for_definition, unlike edit, assign, unassign and activate. A new task therefore had no quest_instances rows and stayed off the panel board until an unrelated write regenerated it. Call regenerate_for_definition after the DAO write, using the host clock and the default horizon, and add a test that a created weekly definition has only today-or-later instances. Update test fixtures that relied on create writing no instances: close the seeded one-day rules with end_date, clear the table before the gated materialize walk, and adjust the admin regenerate tests to the new create behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -468,7 +468,11 @@ async def _materialize_with_change(
|
||||
proceeds with the snapped presence). This deterministically
|
||||
exercises the snapshot-to-insert gap that a config edit can
|
||||
interleave into.
|
||||
|
||||
``create_quest_definition`` already materializes its horizon, so the
|
||||
table is cleared first: the gated walk must be the only writer.
|
||||
"""
|
||||
await database.execute("DELETE FROM quest_instances")
|
||||
original_upsert = QuestInstancesDao.upsert_if_valid
|
||||
entered = asyncio.Event()
|
||||
release = asyncio.Event()
|
||||
|
||||
Reference in New Issue
Block a user