Forward the lab 5 foundation while preserving lab 6 telemetry

Source: immutable lab5 snapshot f88e9ba43cdfd7eb6a5a7ae5feb4247b4e820071; forward the allowed diff from 64d5c67. Carry SQLAlchemy, Alembic, reliability fixes, versioned jobs, infrastructure and student tests without changing protected coursework files.

Validation: make check, validate, lint; 515 student tests passed with one Linux-only skip; public smoke with telemetry enabled and repeat migration passed. Stop the owned stack and retain volumes. Preserve the existing OTel work in progress; grade implementation remains a separate phase.
This commit is contained in:
Artyom
2026-11-06 12:29:35 +03:00
parent dc9256baf9
commit 12db77133f
161 changed files with 11160 additions and 1467 deletions
+19 -14
View File
@@ -33,20 +33,6 @@ def test_identity_does_not_know_about_messaging() -> None:
assert not {k: v for k, v in offenders.items() if v}
def test_messaging_touches_identity_only_through_events() -> None:
allowed = f"{IDENTITY}.domain.events"
offenders: dict[str, list[str]] = {}
for path in modules_under("messaging"):
borrowed = [
module
for module in imports_of(path)
if module.startswith(IDENTITY) and module != allowed
]
if borrowed:
offenders[str(path.relative_to(SOURCE))] = borrowed
assert not offenders
def test_attachments_and_other_zones_do_not_import_each_other() -> None:
offenders: dict[str, list[str]] = {}
for zone, foreign in (
@@ -126,6 +112,7 @@ def test_shared_core_holds_only_platform() -> None:
"logging.py",
"postgres.py",
"telemetry.py",
"readiness.py",
}
@@ -269,6 +256,16 @@ def sql_tables(zone: str, tables: tuple[str, ...]) -> set[str]:
for node in ast.walk(tree):
if isinstance(node, ast.Constant) and isinstance(node.value, str):
words.update(re.findall(r"\b(?:FROM|JOIN|INTO|UPDATE)\s+(\w+)", node.value))
if (
isinstance(node, ast.Assign)
and any(
isinstance(target, ast.Name) and target.id == "__tablename__"
for target in node.targets
)
and isinstance(node.value, ast.Constant)
and isinstance(node.value.value, str)
):
words.add(node.value.value)
return words & set(tables)
@@ -289,3 +286,11 @@ def test_messaging_does_not_import_identity_at_all() -> None:
for path in modules_under("messaging")
}
assert not {key: value for key, value in borrowed.items() if value}
def test_sqlalchemy_stays_in_infrastructure_and_asyncpg_is_only_a_driver() -> None:
for path in SOURCE.rglob("*.py"):
modules = {module.split(".")[0] for module in imports_of(path)}
assert "asyncpg" not in modules
if "infrastructure" not in path.parts:
assert "sqlalchemy" not in modules