Skip to content

fix: fresh-scaffold + background_tasks papercuts (#116, #119, #123, #124, #126, #127, #128, #129) - #130

Merged
antosubash merged 1 commit into
mainfrom
feature/blissful-gagarin-0d66ca
May 6, 2026
Merged

fix: fresh-scaffold + background_tasks papercuts (#116, #119, #123, #124, #126, #127, #128, #129)#130
antosubash merged 1 commit into
mainfrom
feature/blissful-gagarin-0d66ca

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

Addresses every open issue on the tracker, all in one place. The bugs split into three buckets:

sm new scaffold layout (#116, #119, #126, #127, #128, #129). Most were fixed at the source level since 0.0.8 but lacked CI coverage; #129 was a live regression in the flat scaffold layout. New regression tests now pin them so they can't sneak back in.

Vite resolver (#123). vite.config.ts template now seeds the optimizeDeps walk with each wheel-installed module's package.json. Without it, sonner / lucide-react imports from .venv/site-packages/<mod>/pages/*.tsx couldn't reach host/client_app/node_modules.

Background tasks (#124). background_tasks.sync_db now exposes set_database_url(url), called from BackgroundTasksModule.on_startup with the host's resolved settings.database_url. The old os.environ['SM_DATABASE_URL'] read silently fell back to SQLite in the web process because pydantic-settings never propagates .env to the OS environment.

Per-issue notes

Test plan

…123, #124, #126, #127, #128, #129)

Pulls together the post-0.0.8 follow-up fixes:

- #129: `repo_root_from_client_app` now walks up to the nearest workspace
  `package.json` (falling back to the nearest plain `package.json`) instead
  of hardcoding two levels up. This unblocks `sm host sync-js-deps` in the
  flat `sm new` scaffold layout where `client_app/` sits one level under
  the project root.

- #123: scaffolded `vite.config.ts` now also seeds the optimizeDeps walk
  with each wheel-installed module's `package.json`. Without it, deps a
  module imports directly (`sonner`, `lucide-react`, ...) were never
  pre-bundled and Node module resolution from inside `.venv/site-packages`
  could not reach `host/client_app/node_modules`.

- #124: `background_tasks.sync_db` now exposes `set_database_url(url)`,
  called from `BackgroundTasksModule.on_startup` with the host's resolved
  `settings.database_url`. The old `os.environ["SM_DATABASE_URL"]` read
  silently fell back to SQLite in the web process (uvicorn doesn't load
  `.env` into the env). Falls back to the env var when no override is set
  so the worker's existing flow keeps working.

- Adds regression tests for #126, #127, #128 (already fixed in source but
  not previously asserted in CI), #129 layout-resolution edges, and the
  new `set_database_url` URL-resolution contract.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 353d65c
Status: ✅  Deploy successful!
Preview URL: https://391687db.simple-module-python.pages.dev
Branch Preview URL: https://feature-blissful-gagarin-0d6.simple-module-python.pages.dev

View logs

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