fix: dashboard renders when doza_assist.__version__ is unimportable (issue #25)#30
Merged
Merged
Conversation
…ble (issue #25) A v3.5.3 user reported the dashboard 500-ing with ``ImportError: cannot import name '__version__' from 'doza_assist'`` despite the v3.5.3 source clearly exporting it. The likely cause is a stale/shadowed ``doza_assist`` package somewhere on sys.path (e.g. an old pip install in the user's venv from earlier ``install.sh --clean`` runs) that gets resolved before the bundled package. The blast radius was outsized: ``inject_brand`` runs as a context processor on every template render, so the import failure crashed every page load. Flask's process didn't shut down cleanly afterwards, which left port 5050 stuck and required the user to kill the orphaned process before the app could launch again. Loud port-conflict error, quiet root cause — same masking pattern as issue #25 itself. Wrap the import in try/except so a missing or stale ``__version__`` reads as ``'unknown'`` and the dashboard renders. A WARNING line goes to server.log naming the likely culprit (shadowed venv install) so the diagnostic path is obvious if a maintainer reads the log later. This does not change the answer for the affected user (we still need to clear the stale package to see the real version), but it removes the "can't launch the app at all" failure mode for anyone who hits a similar sys.path collision in the future. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
doza-assist | 7205df5 | May 21 2026, 12:11 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Defensive fix for issue #25. User on v3.5.3 reported
ImportError: cannot import name '__version__' from 'doza_assist'despite the v3.5.3 source clearly exporting it — suggesting a stale/shadoweddoza_assistpackage on sys.path (likely an old pip install in their venv from earlierinstall.sh --cleanruns).The blast radius was outsized:
inject_brandis a Flask context processor, so the import crashed every page render and left Flask half-alive — which is why the user also had to manuallykillthe orphaned Python process before the next launch (port 5050 stuck).This PR wraps the import in
try/except. If__version__can't be loaded, the dashboard reads it as"unknown"and the app launches, with a clear WARNING line inserver.logpointing at the likely cause.What this doesn't fix
The user still has a stale package on their machine. Diagnosing that root cause is in flight on the issue thread (asked them for the bundled file contents + a
findover their venv). This PR is the safety net so a future user with a similar sys.path collision doesn't get a fully unlaunchable app.Test plan
doza_assist/__version__is importable → dashboard shows the real version (unchanged behavior).python -c "import sys; sys.modules['doza_assist'] = type(sys)('doza_assist')"before importingapp→ dashboard renders, version reads as"unknown", server.log shows the WARNING.🤖 Generated with Claude Code