Add FastAPI catalog backend (games/snapshots/diff) + tests

Modular-monolith backend over SQLAlchemy (SQLite by default, Postgres-ready
via DATABASE_URL). The full snapshot.json is stored verbatim; diffing reads it
back through the ams.diff engine, so the DB never mirrors the snapshot schema.

- ams.api.db/models/schemas/service : Game 1-N Snapshot, sha256-deduped upsert
- routes: POST/GET /games, POST/GET /snapshots (import, deduped), GET /diff
          (?old&new[&owner]) running compute_diff on stored snapshots, /health
- ams.api.importer : bulk CLI loader (python -m ams.api.importer --game ...)
- run: uvicorn ams.api.app:create_app --factory

11 tests pass (6 diff + 5 API via TestClient over the golden pair). Smoke-tested
live on uvicorn: import -> /snapshots -> /diff returns the BlooMoo deltas.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Patryk Gensch
2026-05-30 22:27:24 +02:00
parent 6885bbee3d
commit 8386196653
14 changed files with 481 additions and 2 deletions

View File

@@ -1,9 +1,28 @@
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "ams"
version = "0.1.0"
description = "Aidem Media engine-surface snapshot diffing (Piklib/BlooMoo)"
requires-python = ">=3.9"
description = "Aidem Media engine-surface snapshot diffing + catalog (Piklib/BlooMoo)"
requires-python = ">=3.10"
dependencies = []
[project.optional-dependencies]
api = [
"fastapi>=0.110",
"uvicorn[standard]>=0.27",
"sqlalchemy>=2.0",
"pydantic>=2.6",
]
dev = [
"pytest>=8",
"httpx>=0.27",
]
[tool.setuptools.packages.find]
include = ["ams*"]
[tool.pytest.ini_options]
testpaths = ["tests"]