Skip to content

fix(voice): add service status validation, safe dictionary access, and fallback attributes in voice_status - #3

Open
Vishaaallll wants to merge 2 commits into
mainfrom
fix/voice-status-dict-get-safety
Open

Vishaaallll wants to merge 2 commits into
mainfrom
fix/voice-status-dict-get-safety

Conversation

@Vishaaallll

Copy link
Copy Markdown
Owner

Summary

Hardens the voice_status endpoint in ods/extensions/services/dashboard-api/routers/voice.py:

  • Validates cfg object type (isinstance(cfg, dict)) before evaluating health checks for Whisper, TTS, and LiveKit services.
  • Uses getattr(result, "status", "unknown") to safely extract service status from health check return objects.
  • Replaces direct key lookups (entry["status"]) in installed_healthy with safe dictionary .get() calls (entry.get("status")) and isinstance(entry, dict) type guards.
  • Enriches status payloads with explicit configured boolean metadata for downstream frontend rendering.

Why It Is Useful

  • Prevents HTTP 500 Dashboard Errors: Replaces unhandled exceptions (KeyError, AttributeError, TypeError) with graceful fallback status representations ("unavailable", "not_configured").
  • Supports Optional Voice Stack Topologies: Allows installations without optional voice components (or partial voice configurations) to query readiness endpoints reliably.
  • Provides Richer Status Context: Adds explicit configured flags to response dictionaries, enabling the UI to distinguish between unconfigured services and failed service health checks.

Verification

  • Ran test suite pytest ods/extensions/services/dashboard-api/tests/ -k voice -v (8 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.

2 participants