You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Codebase quality sweep: error handling, drift detection, test hygiene (#176)
## Summary
Codebase-wide quality sweep addressing 6 categories of issues across 53
files:
- **Error handling hardening** — wrap unguarded stream writes in
try/catch (recorder.ts, agui-recorder.ts), add response termination for
headers-already-sent paths (server.ts, a2a-mock.ts, mcp-mock.ts), fix
vector-mock double body consumption
- **Parse error detail surfacing** — capture and include the actual
JSON.parse error message in all 25+ bare catch blocks across every
provider handler, WebSocket handler, and stream-collapse function
- **Drift detection gaps** — `compareSSESequences` now compares ALL
events per type (not just the first), catching shape variations like
Anthropic thinking deltas; Ollama drift tests use synchronous env-var
gate instead of broken async `describe.skipIf`
- **Test hygiene** — fix 12 unrestored spy/mock leaks across 6 test
files, correct misleading "toolCalls should win" comments/assertions,
move prototype-level spy to afterEach, update 17 test assertion strings
for new error format
## Test plan
- [x] 2867 tests pass (79 files, 37 skipped)
- [x] TypeScript typecheck clean
- [x] Prettier + ESLint clean (pre-commit hooks pass)
- [x] 7-agent CR Round 1: 0 new bucket (a) findings from changes; 2
minor items fixed (comment + confirmed non-issue)
- [x] 10-slot blitz execution with zero merge conflicts
Copy file name to clipboardExpand all lines: CHANGELOG.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,23 @@
1
1
# @copilotkit/aimock
2
2
3
+
## [Unreleased]
4
+
5
+
### Fixed
6
+
7
+
-**Progressive relay for NDJSON and Bedrock binary event streams** — Ollama NDJSON and Bedrock binary event streams were fully buffered before relay, triggering downstream idle timeouts; now relayed progressively as chunks arrive
8
+
-**JSON.parse error detail in bare catch blocks** — capture and surface parse-error detail in all bare catch blocks across 25+ provider/WebSocket/stream-collapse handlers instead of swallowing context
9
+
-**Unguarded stream write/end calls** — wrap stream write/end in try/catch (recorder.ts, agui-recorder.ts) to prevent unhandled exceptions on client disconnect
10
+
-**Response termination for headers-already-sent paths** — add response termination in error paths where headers were already sent (server.ts, a2a-mock.ts, mcp-mock.ts), preventing connection hangs
11
+
-**Vector-mock double body consumption** — fix route passthrough consuming the request body twice, causing empty-body forwarding
12
+
-**Drift detection compared only first event per type** — `compareSSESequences` now compares ALL events per type, not just the first, catching previously invisible divergences
13
+
-**Ollama drift tests used broken async describe.skipIf** — replaced with synchronous env-var gate so tests are correctly skipped or executed
14
+
-**12 unrestored spy/mock leaks and misleading assertions** — fix spy/mock leaks across test files and correct assertions that passed for the wrong reasons
15
+
16
+
### Changed
17
+
18
+
-**Anti-buffering headers on all progressive stream relay paths** — standard headers (Cache-Control, Connection, X-Accel-Buffering) added to all progressive stream relay paths to prevent intermediate proxy buffering
19
+
-**Stream-collapse returns firstDroppedSample** — stream-collapse functions now return the first dropped sample for forensic debugging of collapsed streams
0 commit comments