refactor: move services to a unit of work over repository ports

Services depend only on src/core/ports: async with self.uow is one
transaction, commit is explicit, leaving without it rolls back. A
connection is held per step, the JSON routers keep a shared request
deadline, and rollback runs under the block deadline. Adds
service-tests with fakes, a repo contract run on both the fake and SQL,
and make service_test / service_test_db. API, schema and settings are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 23:14:16 +03:00
co-authored by Claude Opus 5.5
parent b2fb88f25a
commit 6ba74b18f3
90 changed files with 10882 additions and 2030 deletions
+6 -1
View File
@@ -39,7 +39,7 @@ dev = [
line-length = 79
target-version = "py312"
# student-tests: хелперы набора импортируются как модули первого уровня
src = [".", "student-tests"]
src = [".", "student-tests", "service-tests"]
# публичные проверки skeleton не форматируем и не правим
extend-exclude = ["tests", "scripts"]
@@ -47,6 +47,11 @@ extend-exclude = ["tests", "scripts"]
select = ["E", "F", "I", "W505", "COM812", "F401", "B", "C4", "ARG", "UP", "SIM", "Q"]
ignore = ["E501"]
[tool.ruff.lint.per-file-ignores]
# метод фейка повторяет сигнатуру порта, а тест и хук pytest получают аргументы
# по имени: используются не все
"service-tests/**" = ["ARG001", "ARG002"]
[tool.ruff.format]
quote-style = "preserve"
skip-magic-trailing-comma = false