Blueprint Migration Complete
The multi-release refactor of the monolithic nova/__init__.py is now complete. All routes have been migrated into dedicated blueprint modules, and supporting infrastructure has been extracted into focused packages:
| Module | What moved |
|---|---|
nova/blueprints/api.py | All /api/* routes, weather chain, telemetry_ping, help docs |
nova/blueprints/tools.py | Equipment CRUD, import/export, journal photos, YAML portability |
nova/blueprints/admin.py | 5 admin user-management routes (new dedicated admin_bp) |
nova/migration.py | 18 YAML import/export, user provisioning, and catalog pack functions |
nova/auth.py | Conditional User model, login_manager, and load_user |
nova/__init__.py is now a thin entry point that wires up the app, registers blueprints, and starts workers. No route logic remains in it.
Bortle-Aware AI Recommendations
The Ask Nova AI ranking and DSO notes features now factor in your Bortle scale and horizon mask settings:
- Dark sites (Bortle 1–4) – No restrictions; all target types viable.
- Suburban (Bortle 5–6) – Nudges toward narrowband filters and emission targets.
- Bright sites (Bortle 7–9) – Strongly favours emission nebulae with dual-band filters.
Bortle scale and horizon mask presence are injected into the AI prompt context from the active Location model, so recommendations adapt automatically when you switch locations.
Cache Reliability Fixes
Several unbounded in-memory caches have been replaced with BoundedCache to prevent uncontrolled memory growth in long-running deployments:
SUN_EVENTS_CACHEandMOON_PHASE_CACHE– capped at 1,000 entries each inmodules/astro_calculations.py.- Observable objects cache – moved into a dedicated
BoundedCacheinnova/config.py. nightly_curves_cachekey collisions – cache keys now includeusername,lat,lon,altitude_threshold, andsampling_intervalso entries are correctly scoped per-user and per-location instead of colliding on object name + date alone.
A new calculate_moon_phase_cached() helper deduplicates three inline ephem.Moon() blocks into a single cached function, ensuring the moon phase is computed consistently everywhere.
Moon Phase Consistency
Fixed a mismatch between the moon phase shown on the dashboard and the graph view:
- Both views now use consistent past-midnight date logic (
hour < 12rolls back one day). - Moon phase is computed at dusk time via a topocentric
ephem.Observereverywhere. - Redundant phase update on initial graph view load is skipped to prevent SSR-to-AJAX flicker.
Mobile Improvements
- Location switcher persists to server – selecting a location on mobile now saves it to the database so all pages (dashboard, outlook, object detail) use the same location consistently.
- Object detail layout – full-viewport flex layout (
100dvh) with a fixed-position edit-notes button that appears above the bottom nav only when the Notes tab is active. - Post-save redirect – saving notes on mobile now returns to the object detail page instead of the dashboard.
Bug Fixes
- Dither fields in YAML export – structured dither fields (
dither_type,dither_amount,dither_every) were missing from per-object journal downloads. They are now included. - Dither display in session detail – the detail template referenced
entry.dither_displaybut the dict was built only from DB columns, so the computed value was missing. It is now injected via thedither_displayhelper. - Help topics 404 –
PROJECT_ROOTinapi.pyresolved tonova/instead of the project root after the blueprint migration, causing all/api/help/*routes to return 404. Fixed with a correctdirnamechain. - Inspiration modal interpolation – single quotes in the template literal prevented
${wikiUrl}and${source}from being interpolated, rendering them as literal text. - Heatmap status indicators – heatmap section JavaScript refactored for clearer status handling.
Code Quality
- Removed unused imports across
astro_calculations.py,__init__.py,api.py,core.py,journal.py,mobile.py,tools.py. - Replaced bare
except:with specific exception types inhelpers.pyandlog_parser.py. - Removed debug
print()statements from__init__.py. - Cleaned stale refactor markers and commented-out code from blueprints.
- German translations marked as auto-generated in the i18n config.
Security
- Telemetry debug endpoint – the
/telemetry/debugroute now requires login and admin-only access (previously accessible to any authenticated user).
Admin Blueprint
Admin user-management routes have been extracted from tools_bp into a dedicated admin_bp (nova/blueprints/admin.py):
- 5 routes: list users, create user, toggle active, reset password, delete user.
- Shared
_admin_guard()helper deduplicates the repeatedSINGLE_USER_MODE+ admin-check pattern. - CSRF
before_requesthook included. - 10 new tests in
tests/test_nova_admin.pycovering guard logic, create, delete, and toggle paths.
Upgrade Notes
- No database migration required – all changes are backwards-compatible.
- No new dependencies – this release uses only existing packages.
- Docker – no changes to the Dockerfile or entry point. Pull the new image and restart as usual.
Thanks for using Nova DSO Tracker! As always, feedback is welcome – please report any issues on GitHub.