This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/pkg/backend
Levi Neely 21827c57eb backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests
- Extract streamOpenAISSE, streamOllamaNDJSON from ChatStream goroutines
  into standalone functions taking io.Reader for direct testability
- Remove ctx parameter from streamAnthropicSSE (caller handles cancellation)
- Extract streamRequest into backend.go: shared HTTP execution, 429/error
  handling, and goroutine lifecycle for all three backends
- Extract encodeOpenAIMessages, encodeOpenAITools from ChatStream
- Replace string baseURL with *url.URL; validate in constructors
- Constructors (NewOpenAI, NewOllama, NewAnthropic, NewCopilot) now return error
- Remove unreachable json.Marshal and http.NewRequestWithContext error branches

ChatStream coverage: 100% (OpenAI, Ollama, Anthropic)
Stream parsers: 100% (OpenAI, Ollama), 96.6% (Anthropic)
streamRequest: 100%

Test files:
- openai_encode_test.go: message/tool encoding, JSON round-trip
- openai_stream_test.go: SSE parsing via io.Reader
- ollama_stream_test.go: NDJSON parsing via io.Reader
- anthropic_stream_test.go: SSE parsing, mapAnthropicStopReason
- openai_test.go: HTTP integration, error paths, models, context length
- backend_test.go: contract checks (all interface methods), stream text/usage/
  tool calls/tool conversation, HTTP errors, rate limits for all backends
2026-04-21 15:32:03 +02:00
..
anthropic.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
anthropic_stream_test.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
backend.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
backend_test.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
codewhisperer.go fix: only use json wire field for JSON objects in tool results 2026-04-13 16:21:45 +02:00
codewhisperer_internal.go backend: add ContextLength, Models, and auto-compaction 2026-04-10 19:35:44 +02:00
copilot.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
new.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
ollama.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
ollama_stream_test.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
openai.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
openai_encode_test.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
openai_stream_test.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
openai_test.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00
testhelper_test.go backend: extract stream parsers, shared HTTP, url.URL, comprehensive tests 2026-04-21 15:32:03 +02:00