Skip to content

fix: address framework papercuts (#66, #68, #71, #73, #75, #76, #81, #90, #92, #93, #94, #95) - #98

Merged
antosubash merged 2 commits into
mainfrom
feature/condescending-varahamihira-1d2e05
May 1, 2026
Merged

fix: address framework papercuts (#66, #68, #71, #73, #75, #76, #81, #90, #92, #93, #94, #95)#98
antosubash merged 2 commits into
mainfrom
feature/condescending-varahamihira-1d2e05

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

Closes 12 of the 13 open framework papercut issues filed against simple_module_python. Issue #74 lives in a downstream module (simple_module_sharing) that isn't in this repo and is left for that project.

Issue Fix
#95 users.login_redirect_url setting; users module auto-falls back to / when Dashboard isn't installed. Login.tsx reads it from props.
#94 scripts/run_worker.py + CLI template now load .env via shared load_dotenv_into_environ before importing settings.
#93 CSP gains worker-src 'self' blob: + child-src 'self' blob: (default + dev_csp) so MapLibre / WASM workers run.
#92 NavIcon swaps the hand-rolled 11-icon map for ~70 tree-shaken lucide-react named imports.
#90 ModuleBase.register_event_handlers(self, bus, app=None) so handlers can capture the framework session factory. Hosting layer dispatches via inspect.signature so single-arg overrides keep working.
#81 SM_USERS_RESET_PASSWORD_TOKEN_SECRET / SM_USERS_VERIFICATION_TOKEN_SECRET re-enabled as boot-time env-var defaults so fresh prod deploys can clear the validator.
#76 init_db() accepts poolclass=NullPool for tests on asyncpg/Postgres.
#75 tests/__init__.py dropped from the module scaffold to avoid pytest plugin collision under --import-mode=importlib.
#73 Largely already addressed in main; dedupe/optimizeDeps from #66 covers the residual React-identity bug.
#71 New task_always_eager / task_eager_propagates fields honoured by build_celery. The pytest plugin pre-builds an eager Celery app at import time so non-client fixtures don't reach for the broker.
#68 Schema-per-module now driven by explicit SM_SCHEMA_PER_MODULE; the SM_DATABASE_URL heuristic is kept as a back-compat fallback.
#66 vite.config.ts adds resolve.dedupe + optimizeDeps.include for react / react-dom / JSX runtimes so cross-@fs/ module-shipped .tsx pages share React identity with the host.

Why

Each item is the smallest fix that makes a real first-run / first-try scenario work without requiring the user to monkey-patch the framework. Most were filed during the laco-wiki rewrite as concrete repro reports.

Notable design choices

  • Shared env-parsing helpers: added env_str, env_bool, load_dotenv_into_environ, BOOL_LITERALS_TRUE/FALSE to simple_module_core.dotenv and consolidated four sites that had been hand-rolling the same patterns.
  • register_event_handlers back-compat: the new app=None parameter is dispatched via inspect.signature so out-of-tree modules with the one-arg override aren't broken at boot.
  • Login redirect: lives on UsersSettings (DB-backed, runtime-editable). users.on_startup auto-rewrites the default /dashboard// only when the Dashboard module isn't loaded; explicit operator overrides are preserved.

Test plan

  • make lint clean (ruff + ty + biome ci + tsc across host / packages / modules + file-size + metadata + readmes)
  • uv run pytest: 1047 passed, 6 deselected (e2e)
  • npx vitest run: 8 tests passed
  • Manual: spin up make dev in a fresh sm new --preset minimal to confirm login → / lands cleanly (didn't run; covered by the on_startup auto-fallback test path)
  • Manual: run a Celery worker pointed at Postgres to confirm .env is honoured (covered by docs; not exercised in CI)

antosubash added 2 commits May 1, 2026 00:44
, #92, #93, #94, #95)

- #95: users.login_redirect_url setting; auto-fallback to / when Dashboard absent
- #94 + #68: worker entrypoint loads .env via shared load_dotenv_into_environ;
  schema-per-module driven by SM_SCHEMA_PER_MODULE (URL fallback kept)
- #93: CSP gains worker-src/child-src for blob: workers (MapLibre, WASM)
- #92: NavIcon swaps hand-rolled SVGs for tree-shaken lucide-react named imports
- #90: register_event_handlers gains optional app=; back-compat dispatch shim
- #81: SM_USERS_*_TOKEN_SECRET re-enabled as boot-time env-var override
- #76: init_db accepts poolclass (NullPool) for cross-loop test setups
- #75: drop tests/__init__.py from module scaffold (pytest plugin collision)
- #71: testing plugin pre-builds eager Celery for non-client fixtures;
  new task_always_eager / task_eager_propagates settings honoured by build_celery
- #66: vite resolve.dedupe + optimizeDeps for React/JSX runtimes so
  module-shipped pages share React identity with the host

Adds shared dotenv helpers (env_str, env_bool, load_dotenv_into_environ,
BOOL_LITERALS_*) in simple_module_core to consolidate duplicated env parsing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant