Skip to content

fix: Narrow exception handling in concurrent reset+query test#41

Merged
phillipleblanc merged 1 commit into
trunkfrom
phillipleblanc/fix-concurrent-reset-test
Mar 26, 2026
Merged

fix: Narrow exception handling in concurrent reset+query test#41
phillipleblanc merged 1 commit into
trunkfrom
phillipleblanc/fix-concurrent-reset-test

Conversation

@phillipleblanc

@phillipleblanc phillipleblanc commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Changes

The testConcurrentResetAndQuery test had a catch-all Exception handler that silently swallowed all non-NPE exceptions. This meant:

  • IllegalStateException (client incorrectly thinks it's closed during concurrent reset) would pass silently
  • ExecutionException wrapping an NPE or ISE as its cause would also pass silently
  • Any other unexpected exception type would be ignored

Fix

Replace the catch-all with an isExpectedTransportError() helper that:

  1. Unwraps ExecutionException to inspect the real cause (since SpiceClient.query() wraps retried failures)
  2. Allows only known transport errors: FlightRuntimeException (gRPC status errors), ConnectException/IOException (connection refused, broken pipe), and messages containing known transport keywords
  3. Records as unexpected everything else — NPE, ISE, or any other exception that would indicate a bug in the reset/rebuild logic

Addresses review feedback from #40.

Copilot AI review requested due to automatic review settings March 26, 2026 03:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates ResetTest.testConcurrentResetAndQuery so that IllegalStateException is treated as an unexpected error (alongside NullPointerException) during concurrent reset() + query() operations, aligning the test behavior with its documentation and intent from PR #40.

Changes:

  • Record IllegalStateException as an unexpected error in testConcurrentResetAndQuery (previously swallowed).
  • Clarify inline comments describing which error types are expected vs unexpected.
  • Update the assertion message to mention both NPE and IllegalStateException.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/test/java/ai/spice/ResetTest.java
@phillipleblanc phillipleblanc self-assigned this Mar 26, 2026
@phillipleblanc
phillipleblanc force-pushed the phillipleblanc/fix-concurrent-reset-test branch from 768af26 to 959fda2 Compare March 26, 2026 03:53
@phillipleblanc phillipleblanc changed the title fix: Treat IllegalStateException as unexpected in concurrent reset+query test fix: Narrow exception handling in concurrent reset+query test Mar 26, 2026
@phillipleblanc
phillipleblanc merged commit a071065 into trunk Mar 26, 2026
18 of 19 checks passed
@phillipleblanc
phillipleblanc deleted the phillipleblanc/fix-concurrent-reset-test branch March 26, 2026 04:39
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.

3 participants