kin: auto-commit after pipeline
This commit is contained in:
parent
9ba202f395
commit
01060c954e
1 changed files with 45 additions and 0 deletions
|
|
@ -549,3 +549,48 @@ class TestAutoTrigger:
|
||||||
})
|
})
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
mock_launch.assert_called_once()
|
mock_launch.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# (6) KIN-ARCH-010: Дедупликация задач в task_decomposer при повторном запуске
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestDecomposerDeduplication:
|
||||||
|
"""KIN-ARCH-010: повторный вызов _save_decomposer_output не создаёт дубли."""
|
||||||
|
|
||||||
|
def test_double_call_with_same_data_creates_only_one_child_task(self, conn):
|
||||||
|
"""Регрессия: вызов _save_decomposer_output дважды с одинаковыми данными
|
||||||
|
должен создать ровно одну дочернюю задачу, а не две.
|
||||||
|
|
||||||
|
Broken behavior: без проверки дублей второй вызов добавлял бы вторую задачу
|
||||||
|
с тем же title + parent_task_id — в БД оказывалось бы 2 строки вместо 1.
|
||||||
|
"""
|
||||||
|
from agents.runner import _save_decomposer_output
|
||||||
|
|
||||||
|
decomposer_output = {
|
||||||
|
"raw_output": json.dumps({
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"title": "Implement login endpoint",
|
||||||
|
"brief": "POST /api/auth/login",
|
||||||
|
"priority": 3,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
r1 = _save_decomposer_output(conn, "vdol", "VDOL-001", decomposer_output)
|
||||||
|
r2 = _save_decomposer_output(conn, "vdol", "VDOL-001", decomposer_output)
|
||||||
|
|
||||||
|
assert r1["created"] == 1
|
||||||
|
assert r1["skipped"] == 0
|
||||||
|
assert r2["created"] == 0
|
||||||
|
assert r2["skipped"] == 1
|
||||||
|
|
||||||
|
children = conn.execute(
|
||||||
|
"SELECT id FROM tasks WHERE parent_task_id = ?",
|
||||||
|
("VDOL-001",),
|
||||||
|
).fetchall()
|
||||||
|
assert len(children) == 1, (
|
||||||
|
f"Ожидалась 1 дочерняя задача, получено {len(children)}"
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue