Skip to content

test(api): give the voice relay tests one named hang guard instead of a one-second wait - #226

Merged
L4XB merged 1 commit into
mainfrom
fix/152-relay-terminal-wait
Oct 22, 2026
Merged

L4XB merged 1 commit into
mainfrom
fix/152-relay-terminal-wait

Conversation

@L4XB

@L4XB L4XB commented Oct 21, 2026

Copy link
Copy Markdown
Member

Closes #152.

Summary

The voice-relay tests waited one or two seconds for the relay task to finish, for example task.cancel() followed by await asyncio.wait_for(task, 1). On the cancellation paths that second has to cover _Relay.run's shielded cleanup: cancelling and gathering four tasks, closing the provider, conservative_finish, on_closed and closing the browser socket. On a runner at about half speed it did not, and test_cancel_closes_upstream_before_terminal_callback_and_retains_pending_cost failed on PR #147, which did not touch the relay.

The file now has one constant, HANG_GUARD_SECONDS = 10, with a comment that says what it is for: it only turns a hang into a failure. All 22 waits in the file use it. That covers the 14 terminal wait_for(task, …) calls the issue lists, the waits on harness.start(...), the waits on the write_started / first_started events and the gather, and the default of the until() polling helper, which had the same 2-second guard.

Is any of them asserting latency? No. The tests that care about timing pass their deadlines to the relay through RelayLimits(meter_timeout_seconds=0.05) or 0.3, and the relay enforces those itself. Those values are unchanged. The wait_for around them only stops a hung test.

Behavior and compatibility

  • Test-only: services/api/tests/test_voice_relay.py, plus the refreshed COMMUNITY_EXPORT_MANIFEST.json entry for that file.
  • No production code, schema, event or API change. A passing run is exactly as fast as before, since the guard only matters when something hangs.

Validation

  • uv run --frozen --extra dev pytest tests/test_voice_relay.py -q (in services/api): 63 passed.
  • ruff check and ruff format --check on the changed file: clean.
  • python scripts/audit_community_export.py .: passed (422 files, 402 HTTP operations, 1 WebSocket, 90 tables).
  • python3 .github/scripts/check_dco.py --base <main> --head <head> --pull-request-author L4XB: DCO sign-offs validated.

Review boundaries

Only test timeouts change. Engine, worker, migrations, web app, browser extension, Companion and self-hosting are unaffected.

Source-release hygiene

No data is committed. CHANGELOG.md has an entry under Unreleased → Fixed. The commit is signed and carries my DCO sign-off, and the CLA acceptance sentence follows as a standalone comment.

Visual evidence

None (no UI change).

… a one-second wait

Signed-off-by: L4XB <lukas.buck@e-mail.de>
@L4XB

L4XB commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

I have read and agree to the SixSentences CLA v1.0.

@L4XB
L4XB merged commit d9e1548 into main Oct 22, 2026
23 checks passed
@L4XB
L4XB deleted the fix/152-relay-terminal-wait branch October 22, 2026 08:31
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.

test(interviews): the relay cancellation tests give cleanup one second and a slow runner misses it

1 participant