Files
xenia-pos-local/local_backend/tests/guards
bonaminandClaude Opus 5.5 d3d328804e refactor(backend): Alembic owns the local schema; v1 ALTER list deleted
Platform v2 step 1.0 (APPS_PLATFORM D-13, D-17).
- migrations/ with env.py (render_as_batch, models/all.py metadata, no
  fileConfig) and baseline 0001_v2_baseline autogenerated from the models and
  reviewed; it also seeds the pos_settings rows a fresh v1 install got
- core/schema.py::upgrade_to_head() is the only way the schema is built:
  app startup, seed.py, demo_seed.py, wipe_database.py and the tests. It
  refuses v1 databases (tables without alembic_version) with a clear error
- main.py: _run_migrations() and create_all removed (723 lines)
- sync_events became a model (was raw DDL); price_event_log order indexes
  declared on the model; unused order_discounts.price_before/after dropped
- tests/guards: no-drift + idempotent upgrade + install defaults + v1 refusal
  + no create_all; placeholders for the time (1.1) and access (1.5) guards
- CS-1 rewritten for Alembic on this branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:54:15 +02:00
..

Guard tests (APPS_PLATFORM D-17)

Tests that protect platform-wide rules rather than one feature. They must stay green; if one fails, fix the code, not the guard. Changing a guard's rule is a design decision: record it in APPS_PLATFORM §2 first.

File Rule Filled in
test_migrations.py Models and Alembic revisions don't drift; the schema is built only by Alembic; v1 databases are refused step 1.0
test_no_naive_datetimes.py No datetime.utcnow, argument-less now() / .astimezone(), or Column(DateTime in backend code step 1.1 (placeholder until then)
test_route_access.py Every route declares require(...), require_device(...) or public() step 1.5 (placeholder until then)