feat: Phase 6 — require_active_service decorator + wizard install wiring

Email/calendar/files routes now return 404 when the service is not
installed, using a require_active_service decorator that checks
ServiceRegistry. Status endpoints are exempt so health checks always work.

SetupManager.complete_setup() now accepts a service_store_manager and
installs any wizard-selected services in a background daemon thread after
setup completes. Failures are logged but do not fail the wizard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 16:58:57 -04:00
parent a69ca1e402
commit 44d7e96f29
12 changed files with 556 additions and 5 deletions
+9
View File
@@ -1,9 +1,12 @@
import logging
from flask import Blueprint, request, jsonify
from routes import require_active_service
logger = logging.getLogger('picell')
bp = Blueprint('calendar', __name__)
@bp.route('/api/calendar/users', methods=['GET'])
@require_active_service('calendar')
def get_calendar_users():
"""Get calendar users."""
try:
@@ -15,6 +18,7 @@ def get_calendar_users():
return jsonify({"error": str(e)}), 500
@bp.route('/api/calendar/users', methods=['POST'])
@require_active_service('calendar')
def create_calendar_user():
"""Create calendar user."""
try:
@@ -33,6 +37,7 @@ def create_calendar_user():
return jsonify({"error": str(e)}), 500
@bp.route('/api/calendar/users/<username>', methods=['DELETE'])
@require_active_service('calendar')
def delete_calendar_user(username):
"""Delete calendar user."""
try:
@@ -44,6 +49,7 @@ def delete_calendar_user(username):
return jsonify({"error": str(e)}), 500
@bp.route('/api/calendar/calendars', methods=['POST'])
@require_active_service('calendar')
def create_calendar():
"""Create calendar."""
try:
@@ -67,6 +73,7 @@ def create_calendar():
return jsonify({"error": str(e)}), 500
@bp.route('/api/calendar/events', methods=['POST'])
@require_active_service('calendar')
def add_calendar_event():
try:
from app import calendar_manager
@@ -85,6 +92,7 @@ def add_calendar_event():
return jsonify({"error": str(e)}), 500
@bp.route('/api/calendar/events/<username>/<calendar_name>', methods=['GET'])
@require_active_service('calendar')
def get_calendar_events(username, calendar_name):
"""Get calendar events."""
try:
@@ -108,6 +116,7 @@ def get_calendar_status():
return jsonify({"error": str(e)}), 500
@bp.route('/api/calendar/connectivity', methods=['GET'])
@require_active_service('calendar')
def test_calendar_connectivity():
"""Test calendar connectivity."""
try: