Skip to content

Merge develop: SSE, make-now, custom filters, coverage audit#36

Merged
featurecreep-cron merged 6 commits intomainfrom
develop
Apr 4, 2026
Merged

Merge develop: SSE, make-now, custom filters, coverage audit#36
featurecreep-cron merged 6 commits intomainfrom
develop

Conversation

@featurecreep-cron
Copy link
Copy Markdown
Owner

Summary

  • Real-time menu updates via SSE
  • Make-now constraint and custom filters UI (feat: pantry-aware generation (prefer recipes using ingredients on hand) #15)
  • Path traversal validation on all file-based services
  • Comprehensive test coverage audit (SSE, profiles, solver, state machine)
  • Architectural lint tests and narrowed exception handling
  • Dependency bumps (ruff, codeql-action, Python 3.14-slim, scorecard permissions)

Context

Feature branch feat/makenow-and-custom-filters merged into develop, resolving divergent clear_before_generate implementations (took the clear_others flag pattern from the feature branch).

…overy

Remove clear_before_generate from scheduler — generation already
overwrites atomically, clearing first risks data loss on failure.
Remove the UI toggle and clear_callback plumbing.

Improve frontend empty states: distinguish "no profiles visible" from
"no menu generated". Add retry button that re-triggers generation
instead of just reloading. Check generation status on 404 to surface
errors or in-progress state instead of silently showing empty.

Rename clearRecipes to clearMenu for consistency. Show Current Menu
section even when empty so the clear button remains accessible.
Add three lint test classes to test_architecture.py:
- TestNoBroadExcept: enforces specific exception types or explicit
  per-line noqa justification (no file-level grandfathering)
- TestNoFrameworkImportsInServices: services stay framework-independent
- TestNoDirectServiceInstantiation: routes use DI, not constructors

Narrow 12 broad except clauses to specific types:
- OSError for requests/file I/O (RequestException inherits IOError)
- (ValueError, UnicodeDecodeError) for base64 decode
- (httpx.HTTPError, OSError) for connection tests
- (OSError, ValueError) for icon generation/PIL

Remove 2 unnecessary try/except blocks around settings_service.get_all()
(in-memory dict read behind null guard, can't fail).

8 remaining broad excepts justified with inline noqa comments:
state machines, shutdown isolation, injected callbacks, health check.
- Add /api/menu/stream SSE endpoint for push notifications (generating,
  menu_updated, menu_cleared events) replacing 60s polling
- Fix QR code extending below viewport with multiple menus
- Add prominent date display on generated menu screen
- Thread clear_others flag through generation pipeline as SSE-only
  (not persisted in JSON to avoid stickiness)
- Gate generating/cleared events on kiosk mode — customer phones
  silently update without spinner or blank screen
- Add debounced loadMenu to prevent concurrent fetch races
- Bound subscriber queues (maxsize=64) to prevent zombie buildup
…hine

New test files:
- test_generation_sse.py: pub/sub lifecycle, event delivery, bounded queues
- test_menu_stream.py: SSE endpoint wiring, keepalive, subscriber cleanup
- test_template_service.py: name validation, CRUD, slot expansion, gen plan
- test_weekly_generation_service.py: plan CRUD, state transitions, distribution
- test_recipe_detail_service.py: food resolution, ingredient extraction

Expanded existing:
- test_scheduler_service.py: meal plan pipeline, cleanup, weekly callback
- test_solver.py: cookedon/createdon constraints, labels, soft constraints
- test_api.py: profile GET/POST/PUT/PATCH/DELETE routes with admin auth
- test_services.py: wait_for_completion, shutdown, temp file cleanup
# Conflicts:
#	morsl/services/scheduler_service.py
#	tests/test_scheduler_service.py
#	tests/test_services.py
#	web/js/app.js
@featurecreep-cron featurecreep-cron merged commit 9b5aa95 into main Apr 4, 2026
9 checks passed
featurecreep-cron added a commit that referenced this pull request Apr 6, 2026
Merge develop: SSE, make-now, custom filters, coverage audit
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