← Back to Pull requests

fix(webhooks): import notify_video_room_config_changed from room_control #136

Closed
unknown closed this pull request without merging on Oct 10, 2026 16:52 UTC
View on GitHub
unknown unknown commented on Oct 02, 2026 21:58 UTC
Author

What

The VoxBento webhook handlers for booth.transcription.started and booth.transcription.stopped import notify_video_room_config_changed from the module that defines it, so both webhooks return 200 instead of 500.

Why

Fixes #135.

Both handlers imported the function from .video_integration, which does not define it, so the import raised ImportError after the room status had been saved.
The function lives in interpretation/room_control.py, and views.py already imports it from there.
The wrong import was introduced in e92c91a.

Before, on current dev, with correctly signed webhooks against a running dev server:

booth.transcription.started: HTTP 500; status in DB = running (already saved)
booth.transcription.stopped: HTTP 500; status in DB = idle (already saved)
ImportError: cannot import name 'notify_video_room_config_changed' from 'interpretation.video_integration'

After, on this branch, same webhooks and same room:

booth.transcription.started: HTTP 200; status in DB = running; backend_session_id = 'sess-1'
booth.transcription.stopped: HTTP 200; status in DB = idle; backend_session_id = ''

The server log after the fix has no Internal Server Error or ImportError entries.

How

  • Change the import in handle_transcription_started and handle_transcription_stopped to from .room_control import notify_video_room_config_changed.

  • Keep the imports inside the handlers instead of moving them to module top, so the diff stays at two lines and does not conflict with #131 and #124, which edit the same handlers.

  • room_control does not import views_webhooks, so there is no import cycle either way.

    Out of scope: notify_video_room_config_changed swallows all exceptions, and creating a RoomInterpretation in tests triggers a sync that tries to reach VoxBento.

    Testing

    Added tests/test_views_webhooks.py with four tests: signed started (200, status running, notify called once), signed stopped (200, status idle, session id cleared, notify called once), a booth.interpreter.joined control case, and a guard that parses views_webhooks.py and checks that every notify_video_room_config_changed import points at a module that defines it.
    On dev the started and stopped tests fail with ImportError and the guard fails with AttributeError, while the control passes, and all four pass with this change.

  • pytest tests/: 72 passed (68 on dev plus the 4 new tests).

  • uvx ruff check . and uvx ruff format --check .: clean.
  • Summary by Sourcery

    Correct the notification helper import used by transcription webhooks to prevent successful events from failing with server errors.

    Bug Fixes:

  • Fix transcription webhook handlers so signed start and stop events return successfully after updating room interpretation state.
  • Tests:

  • Add webhook coverage for transcription lifecycle responses, state updates, notifications, control events, and validating notification imports.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Maintenance
    Expanded coverage for transcription and interpreter webhooks, verifying that transcription status and session details are updated and interpreter join details are recorded.
    Confirmed that transcription notifications are triggered during the tested webhook flows.
    No user-facing behavior changes were made.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 437 lines (+327 / -110) across 5 files Reviewer: Nirupon123 Review duration: 11213m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.68) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.68 · 437 lines diff across 5 files
    0.68
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.364
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.068
    Real PR Conversation Timeline
    1 comments
    "Review active on #136"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.4% (HIGH) · Higher = larger blast radius
    68.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27% · Safe to merge
    27%