Carry over the lab 4 solution

Bring the application, own tests, Dockerfile, toolchain, compose stack,
HAProxy, k6 and RustFS configuration, migrations, hooks, evidence and
scenario scripts and the CI job from the lab 4 solution commit d2744bc,
merge the lab 4 Makefile targets into the lab 5 skeleton Makefile
without touching its targets, and append the lab 4 solution variables
to the skeleton .env.example. The package and the application follow
the contract version 1.5.0, and the image and the throwaway test
containers are tagged lab5 so they do not collide with a lab 4 stand on
the same host.

This is the starting point of the lab 5 cycle: lint, own tests and the
offline skeleton check pass before any lab 5 change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Artyom
2026-10-29 00:34:03 +03:00
co-authored by Claude Opus 5.5
parent 1210dd899c
commit 540fcb35ba
171 changed files with 12909 additions and 1 deletions
+42
View File
@@ -0,0 +1,42 @@
from collections.abc import Sequence
from contextlib import AbstractAsyncContextManager
from datetime import datetime
from typing import Any, Protocol, runtime_checkable
from uuid import UUID
from messenger.shared.domain.events import DomainEvent
@runtime_checkable
class Clock(Protocol):
def now(self) -> datetime: ...
@runtime_checkable
class IdGenerator(Protocol):
def new_id(self) -> UUID: ...
@runtime_checkable
class Logger(Protocol):
def info(self, event: str, /, **fields: Any) -> None: ...
def warning(self, event: str, /, **fields: Any) -> None: ...
def error(self, event: str, /, **fields: Any) -> None: ...
@runtime_checkable
class UnitOfWork(Protocol):
def transaction(self) -> AbstractAsyncContextManager[None]: ...
async def commit(self) -> None: ...
def record(self, event: DomainEvent) -> None: ...
def collect_new_events(self) -> list[DomainEvent]: ...
@runtime_checkable
class EventPublisher(Protocol):
async def publish(self, events: Sequence[DomainEvent]) -> None: ...