fix: do not recreate tasks that already have the derived UUID
All checks were successful
CI Smoke / host-smoke (push) Successful in 1s
CI Smoke / container-smoke (push) Successful in 2s
Build and Publish Multi-Context Image / build-and-push (push) Successful in 25s

Registrar-minted tasks keep the derived UUID with record_id unset.
Inserting them again collides. Match by UUID, then write record_id.

Assistant: grok
Assistant-Session: 01a04996-76e8-7f53-b971-1885cfbed436
This commit is contained in:
tegwick 2026-08-28 21:31:13 +02:00
parent 43e3edd727
commit 54b09ee9e2
2 changed files with 26 additions and 4 deletions

View file

@ -1107,6 +1107,18 @@ class TestExistingWorkplanTasks:
assert "DEMO-WP-0001-T09" in out.cancelled_tasks
assert session.deleted == []
@pytest.mark.asyncio
async def test_sets_record_id_when_the_derived_uuid_already_exists(self):
row = _Row(slug="demo-wp-0001", status="active", path="workplans/a.md")
existing = _TaskRow(None, status="done", title="Clear the stale hub rows", workplan_id=row.id)
derived = self._derived(("DEMO-WP-0001-T01", "Clear the stale hub rows", "done"))
existing.id = __import__("uuid").UUID(derived.workplans[0].tasks[0].uuid)
session = _FakeSession(repo=_Repo(), rows=[row], task_rows=[existing])
out = await fp.reset_repository_projection(session, "demo", derived=derived)
assert out.created_tasks == []
assert existing.record_id == "DEMO-WP-0001-T01"
assert session.added == []
@pytest.mark.asyncio
async def test_leaves_unidentified_tasks_alone(self):
row = _Row(slug="demo-wp-0001", status="active", path="workplans/a.md")