test(engine): cover analyzer cancellation and timeout#17
Open
flobernd wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 testgreen (image_agent 22/22, all other binaries 0 failed), repeated runs stable,cargo fmt --checkclean,cargo clippy --all-targetszero 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.