Skip to content

test: close major coverage gaps in service-context, stream-registry, genie connector, files plugin#278

Closed
jamesbroadhead wants to merge 2 commits intodatabricks:mainfrom
jamesbroadhead:test/coverage-gaps
Closed

test: close major coverage gaps in service-context, stream-registry, genie connector, files plugin#278
jamesbroadhead wants to merge 2 commits intodatabricks:mainfrom
jamesbroadhead:test/coverage-gaps

Conversation

@jamesbroadhead
Copy link
Copy Markdown
Contributor

Summary

Adds 131 tests across 4 new test files targeting the largest coverage gaps in the backend. No production code changes.

File Tests Coverage Before Coverage After
context/service-context.ts 35 7% 100%
stream/stream-registry.ts 34 32% 100%
connectors/genie/client.ts 28 61% 97%
plugins/files/plugin.ts 50 69% 89%

What's now covered

service-context.ts — initialization with pre-configured and auto-created clients, idempotency, concurrent call deduplication, createUserContext with OBO tokens, warehouse auto-discovery with state priority sorting (RUNNING > STOPPED > STARTING), workspace ID via SCIM API fallback, error paths for missing env vars and unreachable workspace

stream-registry.ts — LRU eviction under capacity pressure, SSE STREAM_EVICTED error broadcast to all connected clients, AbortController abort on eviction with correct reason strings, clear() with "Server shutdown" abort, edge cases (capacity=1, same-id update, sequential evictions, mixed writable states)

genie/client.tsstreamSendMessage for new + existing conversations with query result emission, streamConversation with parallel query fetch via Promise.allSettled and partial failure handling, streamGetMessage polling until terminal state with abort signal, classifyGenieError error mapping, mapAttachments for query/text/suggestedQuestions

files/plugin.ts — upload streaming with mid-transfer TransformStream size enforcement, cache invalidation on upload/delete/mkdir, raw endpoint CSP sandbox with safe vs unsafe content type handling, download Content-Disposition filename sanitization, _handleApiError for AuthenticationError/ApiError/generic errors, shutdown with in-flight write tracking and 10s deadline, volume discovery merging (explicit config wins over env vars)

Test plan

  • 1697 tests pass (1566 baseline + 131 new)
  • No production code changes
  • All new tests run in node environment (no browser deps)

This pull request was AI-assisted by Isaac.

jamesbroadhead and others added 2 commits April 15, 2026 19:06
…ctor, files plugin

New test files covering major coverage gaps:
- context/tests/service-context.test.ts (35 tests, 7% -> 100%)
- stream/tests/stream-registry.test.ts (34 tests, 32% -> 100%)
- connectors/genie/tests/client.test.ts (28 tests, 61% -> 97%)
- plugins/files/tests/upload-and-write.test.ts (50 tests, 69% -> 89%)

Total: 1566 -> 1713 tests, all passing.

Co-authored-by: Isaac
@jamesbroadhead
Copy link
Copy Markdown
Contributor Author

Tests are now included in #256.

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.

2 participants