Skip to content

fix(strata): fail fast when the bundled Python lacks jinja2.sandbox - #218

Merged
shuk777 merged 1 commit into
Edge0-AI:mainfrom
sx4im:fix-217-jinja2-sandbox-preflight
Nov 17, 2026
Merged

shuk777 merged 1 commit into
Edge0-AI:mainfrom
sx4im:fix-217-jinja2-sandbox-preflight

Conversation

@sx4im

@sx4im sx4im commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

What & why

The Windows standalone app shipped a Python whose jinja2 package had no sandbox module, so edge0-infer serve crashed at startup with a bare ModuleNotFoundError from serve/frontend.py. Every guard that verifies the server packages only checked the top-level jinja2 module, so the partial install passed all of them.

This checks the exact submodule serve imports instead: the strata.py preflight, setup.py bundle check and pip stamp check now verify jinja2.sandbox, and the frontend import raises a clear error naming the missing module and the remedy (reinstall the app, or pip install -r requirements.txt). The sandbox itself is unchanged, templates still render sandboxed.

Fixes #217

Area

  • Other (edge0-strata serve)

How was it tested?

Linux, Python 3.12, no GPU. Reproduced the report first with a stub jinja2 (package present, sandbox module absent): the old code failed with the bare ModuleNotFoundError. After the fix the import raises the clear error, strata.py serve exits 5 naming jinja2.sandbox, and the bundle check lists it. New regression tests in serve/test_server_packages.py: 3/3 pass, and they fail 3/3 on the unfixed code. Neighbour suite serve/test_frontend.py: 26 passed, no regression. Full unit tests need macOS Apple Silicon, so CI is the gate for those.

Checklist

  • ctest --preset cpu -L "L0|L1" passes locally in edge0-infer/ (engine changes)
  • Ran the higher test levels this change affects (see edge0-infer/docs/testing.md)
  • Added/updated tests for new behavior
  • Updated relevant docs / READMEs (incl. translations if user-facing)

The Windows standalone app shipped a Python whose jinja2 package had no
sandbox module, so `edge0-infer serve` crashed at startup with a bare
ModuleNotFoundError from serve/frontend.py. Every guard that verifies the
server's packages only checked the top-level `jinja2` module, so the
partial install passed all of them.

Check the exact submodule serve imports instead: strata.py's preflight,
setup.py's bundle check and pip stamp check now verify `jinja2.sandbox`,
and the frontend import raises a clear error naming the missing module and
the remedy (reinstall the app, or pip install -r requirements.txt).

Fixes Edge0-AI#217

@shuk777 shuk777 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — LGTM. Merging.

@shuk777
shuk777 merged commit e721bb4 into Edge0-AI:main Nov 17, 2026
1 check passed
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.

Serving fails with ModuleNotFoundError: No module named 'jinja2.sandbox'

2 participants