chore(core): stage 1 contracts — dialog, API schemas + fixtures, integrations, monitoring, modules
CI / ruff · pytest (pull_request) Successful in 22s

Freeze interfaces between lanes A (bot), B (backend), C (dashboard) so three developers work in
parallel without touching each other's files: dialog Event/Reply + engine registry with echo stub,
integration protocols with in-memory defaults, MonitoringService with noop stub, /api/v1 schemas
with fixture-backed routes, frozen main.py wiring, config/modules.yaml + due_scales(), DAR-5,
tzdata, Andrey trajectory, lanes in WORKFLOW, ADR-010.

Refs #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 15:22:25 +03:00
co-authored by Claude Opus 5.5
parent a86008f248
commit b4731fb1d6
30 changed files with 1126 additions and 89 deletions
+4 -12
View File
@@ -73,9 +73,7 @@ async def test_create_all_puts_tables_in_the_right_db(dbs: None) -> None:
async def test_identity_roundtrip_and_connect_code(dbs: None) -> None:
async with session.get_identity_session() as s:
await identity_repo.upsert_doctor(
s, doctor_id="d1", full_name="Доктор Тест", clinic_id="c1", on_call=True
)
await identity_repo.upsert_doctor(s, doctor_id="d1", full_name="Доктор Тест", clinic_id="c1", on_call=True)
await identity_repo.create_patient(
s,
token=TOKEN,
@@ -147,9 +145,7 @@ async def test_scales_profiles_prescriptions(dbs: None) -> None:
await repo.upsert_profile(s, token=TOKEN, doctor_id="d1", modules=["veteran", "depression"])
await repo.upsert_profile(s, token=TOKEN2, doctor_id="d2")
await repo.upsert_profile(s, token=TOKEN, next_visit=date(2026, 10, 20))
await repo.add_item_response(
s, token=TOKEN, scale="phq9", item_id="9", score=1, source="button", ts=T0
)
await repo.add_item_response(s, token=TOKEN, scale="phq9", item_id="9", score=1, source="button", ts=T0)
await repo.add_scale_result(
s,
token=TOKEN,
@@ -218,9 +214,7 @@ async def test_dialog_state_messages_clock(dbs: None) -> None:
async with session.get_clinical_session() as s:
assert await repo.get_dialog_state(s, TOKEN) is None
await repo.set_dialog_state(s, token=TOKEN, state="checkin_mood", data={"step": 1}, now=T0)
await repo.add_message(
s, token=TOKEN, direction="in", text=ScrubbedText("ок"), ts=T0, fsm_state="idle"
)
await repo.add_message(s, token=TOKEN, direction="in", text=ScrubbedText("ок"), ts=T0, fsm_state="idle")
with pytest.raises(ValueError):
await repo.add_message(s, token=TOKEN, direction="x", text=ScrubbedText("ок"), ts=T0)
assert await repo.load_clock_offset(s) == 0.0
@@ -237,9 +231,7 @@ async def test_dialog_state_messages_clock(dbs: None) -> None:
async def test_naive_datetime_rejected(dbs: None) -> None:
with pytest.raises(Exception, match="naive datetime"):
async with session.get_clinical_session() as s:
await repo.add_alert(
s, token=TOKEN, level=AlertLevel.INFO, code="x", reason="x", ts=datetime(2026, 1, 1)
)
await repo.add_alert(s, token=TOKEN, level=AlertLevel.INFO, code="x", reason="x", ts=datetime(2026, 1, 1))
async def test_session_rolls_back_on_error(dbs: None) -> None: