Split backend into tavolo-platform, tavolo-scopone and tavolo-app packages

Move the game-independent machinery (lobby, live-game store, websocket,
deadline scheduler, match history, leaderboards) into a new
tavolo-platform distribution behind a GameEngine contract, the scopone
scientifico rules plus a platform adapter into tavolo-scopone, and keep
only the composition root in tavolo-app. The three distributions share
the tavolo namespace (PEP 420, kaya-style monorepo).

Match history becomes fully generic: Match carries the engine's result
JSON and MatchPlayer points/details instead of scopone-shaped team
columns (migration 3 backfills existing rows). Lobby creation takes an
opaque per-game options object and websocket actions dispatch to the
session's engine.

Tests: platform suite runs against a DummyEngine toy game, scopone
keeps the rules tests plus new adapter tests, server/tests covers the
wired stack end to end (194 tests, was 143).
This commit is contained in:
2026-09-19 07:28:58 +00:00
parent b2b514ab91
commit 5a73601ddf
72 changed files with 4490 additions and 2102 deletions
+6 -20
View File
@@ -3,12 +3,14 @@ requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "tavolo"
name = "tavolo-app"
version = "0.1.0"
description = "Multiplayer card-game platform backend built on the kaya framework"
description = "Tavolo multiplayer card-game application: platform + scopone game wiring"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"tavolo-platform",
"tavolo-scopone",
"kaya-core",
"kaya-cors",
"kaya-session",
@@ -17,9 +19,8 @@ dependencies = [
"kaya-openapi",
"kaya-rsgi",
"granian>=2.0",
"tortoise-orm",
"aerich",
"asyncpg",
"aerich",
"httpx",
"PyJWT[crypto]",
"pwo",
@@ -38,7 +39,7 @@ otel = [
[tool.setuptools.packages.find]
where = ["src"]
namespaces = false
namespaces = true
# Database migrations (aerich). See the Migrations section in README.md.
[tool.aerich]
@@ -49,18 +50,3 @@ location = "./migrations"
python_version = "3.12"
ignore_missing_imports = true
plugins = []
# TortoiseORM auto-generates `<fk>_id` attributes on ForeignKeyField at
# runtime; without the (unavailable here) tortoise mypy plugin the stubs
# only declare the relation field. These are real attributes, not bugs.
[[tool.mypy.overrides]]
module = "tavolo.models"
disable_error_code = ["attr-defined"]
[[tool.mypy.overrides]]
module = "tavolo.routes.*"
disable_error_code = ["attr-defined"]
[[tool.mypy.overrides]]
module = "tavolo.game.*"
disable_error_code = ["attr-defined"]