fix(r4): add socket response timeout — proper tests#220
Merged
Conversation
5e733db to
119cda7
Compare
An error occurred while trying to automatically change base from
ci/vitest-framework
to
main
March 7, 2026 21:32
119cda7 to
c1efc1b
Compare
c1efc1b to
d363a9e
Compare
✅ CI Results🧪 Tests
📦 Artifactsscreenshots-ubuntu-latest · test-results · extension-vsix · ts-unit-test-results · python-unit-test-results |
d363a9e to
481dd22
Compare
onResponse() subscribed a callback that would never fire if the Python side crashed or disconnected, leaving the promise hanging forever and the request subscription leaked. Added a 30-second timeout that unsubscribes the request and resolves with an error. The caller in SocketSerialization.ts now handles the timeout case gracefully. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…useFakeTimers
- Delete hand-rolled test_response_timeout.js
- Add pendingResponseCount getter to SocketServer (via RequestsManager.count)
- Write response-timeout.test.ts with:
• vi.useFakeTimers unit tests: zero pending, registration, timeout fires,
no timeout on early response, cleanup after success, no callback after timeout
• real-server integration test: end-to-end wire-frame message delivery
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ONSE_TIMEOUT_MS - Export RESPONSE_TIMEOUT_MS from Server.ts and import it in the test - Add simulateIncomingData() helper method to SocketServer for test use - Replace direct server.outgoingRequestsManager.onData() calls with server.simulateIncomingData() - Fix chunkContentLength -> chunkLength (correct MessageChunkHeader field name, 3 occurrences) - Replace broken integration test 2 (orphaned 30s timer + no assertion) with simple 'starts with zero pending responses' check Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The protocol's messageLength field carries the data payload length (not the total packet size). Valid Python messages with small payloads (< 26 bytes) were being incorrectly rejected. The only meaningful upper-bound check is > MAX_MESSAGE_SIZE, which remains in place. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c314a1e to
5ce2c14
Compare
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.
Rebased on ci/vitest-framework. Replaced hand-rolled JS test with vitest response-timeout.test.ts. Uses vi.useFakeTimers for unit tests and real server for integration test.