fix(tests): resolve 4 post-phase test failures

- platformClients.integration: iOS/Android push tests lacked
  setStatus() call before listNodes(), so platform filter excluded
  nodes. Added publishHeartbeat() to set platform on connection state.
- server.test: agent.send now emits run_state events before done (Phase
  1). Added sendAndWaitForDone() helper and updated test to find done
  event rather than assuming index 0.
- handlers.test: updated agent.send/cancel assertions to use find()
  and pass send arg to agent.cancel, consistent with run_state events.
- httpBody: req.destroy() closed socket before 413 response could be
  sent. Removed socket destruction from body reader; 413 responses now
  send Connection: close so Node closes the connection cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
William Valentin
2026-02-25 11:55:14 -08:00
parent 787dd61a6d
commit b39010d602
9 changed files with 62 additions and 28 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ export class WebhookHandler implements ChannelAdapter {
} catch (err) {
if (err instanceof RequestBodyTooLargeError) {
auditLogger?.webhookDenied(webhookName, `Payload too large (>${this.maxRequestBodyBytes} bytes)`);
res.writeHead(413, { 'Content-Type': 'application/json' });
res.writeHead(413, { 'Content-Type': 'application/json', 'Connection': 'close' });
res.end(JSON.stringify({ error: 'Payload too large' }));
return false;
}