fail loudly when the app package has no __init__.py

Merged
FL
15d ago
+79-1

Fixes #7258

The granian backend gets the app as a file path, and granian works out the module name by walking up through directories that have an __init__.py. When myapp/myapp/__init__.py is missing it imports the app as myapp instead of myapp.myapp. The compiler used myapp.myapp, so the root state names don't match and every delta gets dropped on the client.

get_app_file() now checks that each package in the app module path has an __init__.py and raises a clear error pointing at the missing file, instead of starting a backend that looks fine but never updates.

Tests cover the missing-init layouts (including a package-style app_module_import) and check that granian resolves the app file to the configured module name for valid layouts. Ran the unit suite, ruff, and pyright on the touched packages locally (full-repo pyright ran out of memory on my machine).