Skip to content

fix(r4): add socket response timeout — proper tests#220

Merged
elazarcoh merged 4 commits intomainfrom
fix/r4-socket-response-timeout
Mar 9, 2026
Merged

fix(r4): add socket response timeout — proper tests#220
elazarcoh merged 4 commits intomainfrom
fix/r4-socket-response-timeout

Conversation

@elazarcoh
Copy link
Copy Markdown
Owner

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.

@elazarcoh elazarcoh force-pushed the fix/r4-socket-response-timeout branch from 5e733db to 119cda7 Compare March 7, 2026 21:14
An error occurred while trying to automatically change base from ci/vitest-framework to main March 7, 2026 21:32
@elazarcoh elazarcoh force-pushed the fix/r4-socket-response-timeout branch from 119cda7 to c1efc1b Compare March 7, 2026 22:47
@elazarcoh elazarcoh changed the base branch from ci/vitest-framework to main March 7, 2026 22:51
@elazarcoh elazarcoh force-pushed the fix/r4-socket-response-timeout branch from c1efc1b to d363a9e Compare March 7, 2026 22:52
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 7, 2026

✅ CI Results

🧪 Tests

Suite ✅ Passed ❌ Failed ⏭️ Skipped 📊 Total
E2E (UI) 16 0 2 18
Python Unit 98 0 0 98
TS Unit 85 0 0 85

📦 Artifacts

screenshots-ubuntu-latest  ·  test-results  ·  extension-vsix  ·  ts-unit-test-results  ·  python-unit-test-results

→ Full run details

@elazarcoh elazarcoh force-pushed the fix/r4-socket-response-timeout branch from d363a9e to 481dd22 Compare March 8, 2026 20:12
@elazarcoh elazarcoh enabled auto-merge March 8, 2026 20:12
elazarcoh and others added 4 commits March 10, 2026 00:48
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>
@elazarcoh elazarcoh force-pushed the fix/r4-socket-response-timeout branch from c314a1e to 5ce2c14 Compare March 9, 2026 22:48
@elazarcoh elazarcoh merged commit 2435d0b into main Mar 9, 2026
10 checks passed
@elazarcoh elazarcoh deleted the fix/r4-socket-response-timeout branch March 9, 2026 23:03
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