Skip to content

test(engine): cover analyzer cancellation and timeout#17

Open
flobernd wants to merge 1 commit into
profile-routingfrom
image-analyzer-cancel-tests
Open

test(engine): cover analyzer cancellation and timeout#17
flobernd wants to merge 1 commit into
profile-routingfrom
image-analyzer-cancel-tests

Conversation

@flobernd

Copy link
Copy Markdown
Owner

Summary

Restores dedicated test coverage for the image-analysis executor's timeout and client-cancellation paths, which lost their tests when the blocking mock vision-client seam was removed. The timeout test pins the executor's own timeout arm and its tool-result error contract; the cancellation test pins the end-to-end contract that a mid-analysis client hangup stops all further upstream dispatch, with the observation window sized to exceed the analyzer delay so the assertion cannot pass vacuously.

Testing

Full cargo test green (image_agent 22/22, all other binaries 0 failed), repeated runs stable, cargo fmt --check clean, cargo clippy --all-targets zero warnings. Both tests were guard-break verified: the timeout test fails when the delay/timeout relation is inverted, and the cancellation test fails when the hangup guards are disabled. The cancellation test deliberately covers the behavior-level contract rather than isolating the executor's specific select arm; the round loop carries redundant hangup guards by design, and the test comment documents that boundary.

Closes local-inference-lab#33.

Notes

Stacked on local-inference-lab#36's branch; retarget or rebase once that merges.

The dedicated tests for the analyzeImage executor's tx.closed()/timeout
select arms were lost when the blocking mock vision-client seam was
deleted, leaving the two behaviors exercised only incidentally. Add
tests using the two-server wiremock pattern already established by
analysis_call_lands_on_analyzer_profile_upstream_with_served_model:

- analyzer_timeout_surfaces_as_tool_result_error_without_hanging_the_turn:
  a delayed analyzer response past a small request_timeout must degrade
  to the model-visible "Vision analysis timed out" tool result within a
  bounded wall time, not wait out the delay.
- analyzer_dispatch_cancels_on_client_hangup_before_completion_round:
  dropping the client's stream mid-analysis (delayed analyzer) verifies
  the end-to-end contract that no further upstream dispatch happens
  after the hangup. The analyzer delay is short (2s) and the post-hangup
  observation window deliberately exceeds it (4s), so an uncancelled
  dispatch would have produced the completion round well before the
  window closes - otherwise the absence of that round would prove
  nothing. The test cannot isolate which of run_turn's several redundant
  hangup checks is responsible (documented in the test itself); a
  promptness-based isolation would be flake-prone against real HTTP and
  scheduling jitter, so it asserts the behavior-level contract instead.

Closes local-inference-lab#33
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