GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(providers): parallelize isolated provider unit tests and shrink … · Twigpine/zero@d6b25fc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • internal
    • config
      • unknownfields.go
    • providers
      • anthropic
        • cache_breakpoints_test.go
        • dropped_test.go
        • finish_reason_test.go
        • idle_test.go
        • image_test.go
        • provider_test.go
        • stop_reason_test.go
      • factory_turn_session_test.go
      • gemini
        • done_test.go
        • finish_reason_test.go
        • idle_test.go
        • images_test.go
        • provider_test.go
      • openai
        • codex_terminal_test.go
        • codex_test.go
        • provider_test.go
        • reasoning_effort_test.go
        • session_test.go
      • providerio
        • retry.go
        • retry_test.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎internal/config/unknownfields.go‎

Copy file name to clipboardExpand all lines: internal/config/unknownfields.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type knownField struct {
131131
}
132132

133133
func derefType(t reflect.Type) reflect.Type {
134-
for t != nil && t.Kind() == reflect.Ptr {
134+
for t != nil && t.Kind() == reflect.Pointer {
135135
t = t.Elem()
136136
}
137137
return t
Collapse file

‎internal/providers/anthropic/cache_breakpoints_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/anthropic/cache_breakpoints_test.go
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
// unmarked (Anthropic caps breakpoints at 4 per request: system, tools, and
1717
// these two).
1818
func TestAnthropicRequestMarksLastTwoMessagesForCaching(t *testing.T) {
19+
t.Parallel()
1920
var gotBody map[string]any
2021
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2122
if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {
@@ -73,6 +74,7 @@ func TestAnthropicRequestMarksLastTwoMessagesForCaching(t *testing.T) {
7374
// the breakpoint, and thinking blocks must never carry cache_control (the API
7475
// rejects them) — the marker goes on the last cacheable block instead.
7576
func TestApplyMessageCacheBreakpointsSkipsThinkingBlocks(t *testing.T) {
77+
t.Parallel()
7678
messages := []anthropicMessage{
7779
{Role: "user", Content: "plain string"},
7880
{Role: "assistant", Content: []map[string]any{
Collapse file

‎internal/providers/anthropic/dropped_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/anthropic/dropped_test.go
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
// can ask the model to retry, mirroring the OpenAI provider's behavior, instead
1414
// of silently dropping it.
1515
func TestStreamCompletionEmitsDroppedOnNamelessToolUseBlock(t *testing.T) {
16+
t.Parallel()
1617
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
1718
writeSSEEvent(w, "content_block_start", `{"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"","name":""}}`)
1819
writeSSEEvent(w, "content_block_stop", `{"type":"content_block_stop","index":0}`)
@@ -45,6 +46,7 @@ func TestStreamCompletionEmitsDroppedOnNamelessToolUseBlock(t *testing.T) {
4546

4647
// A well-formed tool_use block must NOT emit a dropped signal.
4748
func TestStreamCompletionDoesNotDropValidToolUseBlock(t *testing.T) {
49+
t.Parallel()
4850
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
4951
writeSSEEvent(w, "content_block_start", `{"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_1","name":"read_file"}}`)
5052
writeSSEEvent(w, "content_block_stop", `{"type":"content_block_stop","index":0}`)
Collapse file

‎internal/providers/anthropic/finish_reason_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/anthropic/finish_reason_test.go
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
// truncated at the output cap. The provider must surface it on the done event so
1212
// the agent does not treat a clipped answer as complete.
1313
func TestStreamCompletionSurfacesMaxTokensStopReason(t *testing.T) {
14+
t.Parallel()
1415
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
1516
writeSSEEvent(w, "message_start", `{"type":"message_start","message":{"usage":{"input_tokens":5,"output_tokens":0}}}`)
1617
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"cut"}}`)
@@ -37,6 +38,7 @@ func TestStreamCompletionSurfacesMaxTokensStopReason(t *testing.T) {
3738

3839
// A normal end_turn stop_reason must leave the done event's FinishReason empty.
3940
func TestStreamCompletionNormalStopReasonHasNoFinishReason(t *testing.T) {
41+
t.Parallel()
4042
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
4143
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"ok"}}`)
4244
writeSSEEvent(w, "message_delta", `{"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":2}}`)
Collapse file

‎internal/providers/anthropic/idle_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/anthropic/idle_test.go
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
// message_stop or closing) must abort on the idle timeout instead of blocking
1616
// the agent forever.
1717
func TestStreamCompletionIdleTimeoutAbortsStalledStream(t *testing.T) {
18+
t.Parallel()
1819
released := make(chan struct{})
1920
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2021
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"hi"}}`)
Collapse file

‎internal/providers/anthropic/image_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/anthropic/image_test.go
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func firstUserContentBlocks(t *testing.T, body map[string]any) []any {
6060
// TestUserTextOnlyTurnUnchanged pins the text-only wire shape: a single
6161
// user message whose content is a one-element text-block array.
6262
func TestUserTextOnlyTurnUnchanged(t *testing.T) {
63+
t.Parallel()
6364
body := captureRequestBody(t, zeroruntime.CompletionRequest{
6465
Messages: []zeroruntime.Message{
6566
{Role: zeroruntime.MessageRoleUser, Content: "Describe this."},
@@ -78,6 +79,7 @@ func TestUserTextOnlyTurnUnchanged(t *testing.T) {
7879
// TestUserImagePlusTextTurn asserts a text block followed by one image
7980
// source block carrying base64 of the RAW bytes.
8081
func TestUserImagePlusTextTurn(t *testing.T) {
82+
t.Parallel()
8183
raw := []byte{0x89, 0x50, 0x4e, 0x47, 0x01, 0x02}
8284
body := captureRequestBody(t, zeroruntime.CompletionRequest{
8385
Messages: []zeroruntime.Message{
@@ -112,6 +114,7 @@ func TestUserImagePlusTextTurn(t *testing.T) {
112114
// TestUserImageOnlyTurnEmits asserts an image-only user turn (empty Content)
113115
// still produces a user message with a single image block.
114116
func TestUserImageOnlyTurnEmits(t *testing.T) {
117+
t.Parallel()
115118
raw := []byte{0xff, 0xd8, 0xff, 0xe0}
116119
body := captureRequestBody(t, zeroruntime.CompletionRequest{
117120
Messages: []zeroruntime.Message{
Collapse file

‎internal/providers/anthropic/provider_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/anthropic/provider_test.go
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ import (
99
"strings"
1010
"testing"
1111

12+
"github.com/Gitlawb/zero/internal/providers/providerio"
1213
"github.com/Gitlawb/zero/internal/zeroruntime"
1314
)
1415

16+
func init() {
17+
providerio.ShrinkBackoffForTest()
18+
}
19+
1520
func TestStreamCompletionPostsMessagesRequest(t *testing.T) {
21+
t.Parallel()
1622
var gotPath string
1723
var gotAPIKey string
1824
var gotVersion string
@@ -123,6 +129,7 @@ func TestStreamCompletionPostsMessagesRequest(t *testing.T) {
123129
}
124130

125131
func TestStreamCompletionAppliesCustomAuthAndHeaders(t *testing.T) {
132+
t.Parallel()
126133
var gotDefaultAuth string
127134
var gotCustomAuth string
128135
var gotTenant string
@@ -165,6 +172,7 @@ func TestStreamCompletionAppliesCustomAuthAndHeaders(t *testing.T) {
165172
}
166173

167174
func TestStreamCompletionEmitsTextUsageAndDone(t *testing.T) {
175+
t.Parallel()
168176
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
169177
writeSSEEvent(w, "message_start", `{"type":"message_start","message":{"usage":{"input_tokens":25}}}`)
170178
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}`)
@@ -186,6 +194,7 @@ func TestStreamCompletionEmitsTextUsageAndDone(t *testing.T) {
186194
}
187195

188196
func TestStreamCompletionReportsCacheTokens(t *testing.T) {
197+
t.Parallel()
189198
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
190199
writeSSEEvent(w, "message_start", `{"type":"message_start","message":{"usage":{"input_tokens":10,"cache_read_input_tokens":200,"cache_creation_input_tokens":40}}}`)
191200
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"hi"}}`)
@@ -217,6 +226,7 @@ func TestStreamCompletionReportsCacheTokens(t *testing.T) {
217226
}
218227

219228
func TestStreamCompletionEnablesThinkingWhenEffortRequested(t *testing.T) {
229+
t.Parallel()
220230
var gotBody map[string]any
221231
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
222232
if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {
@@ -257,6 +267,7 @@ func TestStreamCompletionEnablesThinkingWhenEffortRequested(t *testing.T) {
257267
}
258268

259269
func TestStreamCompletionOmitsThinkingWithoutEffort(t *testing.T) {
270+
t.Parallel()
260271
var gotBody map[string]any
261272
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
262273
if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {
@@ -287,6 +298,7 @@ func TestStreamCompletionOmitsThinkingWithoutEffort(t *testing.T) {
287298
}
288299

289300
func TestStreamCompletionCapturesThinkingBlocksForReplay(t *testing.T) {
301+
t.Parallel()
290302
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
291303
writeSSEEvent(w, "content_block_start", `{"type":"content_block_start","index":0,"content_block":{"type":"thinking","thinking":""}}`)
292304
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":0,"delta":{"type":"thinking_delta","thinking":"Let me think"}}`)
@@ -312,6 +324,7 @@ func TestStreamCompletionCapturesThinkingBlocksForReplay(t *testing.T) {
312324
}
313325

314326
func TestStreamCompletionPreservesUnclosedThinkingBlockAtStreamEnd(t *testing.T) {
327+
t.Parallel()
315328
// The SSE ends after thinking_delta/signature_delta but BEFORE the thinking
316329
// block's content_block_stop. The open buffer must still be finalized into the
317330
// done event's ReasoningBlocks (via closeOpen), or the next Anthropic replay
@@ -339,6 +352,7 @@ func TestStreamCompletionPreservesUnclosedThinkingBlockAtStreamEnd(t *testing.T)
339352
}
340353

341354
func TestAnthropicRequestReplaysThinkingBlocksFirst(t *testing.T) {
355+
t.Parallel()
342356
var gotBody map[string]any
343357
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
344358
if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {
@@ -392,6 +406,7 @@ func TestAnthropicRequestReplaysThinkingBlocksFirst(t *testing.T) {
392406
}
393407

394408
func TestStreamCompletionEmitsToolUseBlocks(t *testing.T) {
409+
t.Parallel()
395410
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
396411
writeSSEEvent(w, "content_block_start", `{"type":"content_block_start","index":1,"content_block":{"type":"tool_use","id":"toolu_1","name":"read_file","input":{}}}`)
397412
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":1,"delta":{"type":"input_json_delta","partial_json":"{\"path\":"}}`)
@@ -414,6 +429,7 @@ func TestStreamCompletionEmitsToolUseBlocks(t *testing.T) {
414429
}
415430

416431
func TestStreamCompletionClosesOpenToolCallOnEOF(t *testing.T) {
432+
t.Parallel()
417433
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
418434
writeSSEEvent(w, "content_block_start", `{"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_1","name":"grep","input":{}}}`)
419435
writeSSEEvent(w, "content_block_delta", `{"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"pattern\":\"Zero\"}"}}`)
@@ -429,6 +445,7 @@ func TestStreamCompletionClosesOpenToolCallOnEOF(t *testing.T) {
429445
}
430446

431447
func TestStreamCompletionClassifiesHTTPErrorsAndRedactsToken(t *testing.T) {
448+
t.Parallel()
432449
cases := []struct {
433450
name string
434451
status int
@@ -464,6 +481,7 @@ func TestStreamCompletionClassifiesHTTPErrorsAndRedactsToken(t *testing.T) {
464481
}
465482

466483
func TestStreamCompletionEmitsStreamErrorObject(t *testing.T) {
484+
t.Parallel()
467485
provider := newTestProviderWithKey(t, "sk-ant", func(w http.ResponseWriter, r *http.Request) {
468486
writeSSEEvent(w, "error", `{"type":"error","error":{"message":"stream failed sk-ant","type":"overloaded_error"}}`)
469487
})
@@ -481,6 +499,7 @@ func TestStreamCompletionEmitsStreamErrorObject(t *testing.T) {
481499
}
482500

483501
func TestStreamCompletionRejectsMalformedHistoryBeforeDispatch(t *testing.T) {
502+
t.Parallel()
484503
provider := newTestProvider(t, func(w http.ResponseWriter, r *http.Request) {
485504
t.Fatal("provider should not dispatch malformed history")
486505
})
@@ -507,6 +526,7 @@ func TestStreamCompletionRejectsMalformedHistoryBeforeDispatch(t *testing.T) {
507526
}
508527

509528
func TestNewRequiresModelAndPositiveMaxTokens(t *testing.T) {
529+
t.Parallel()
510530
if _, err := New(Options{}); err == nil {
511531
t.Fatal("New without model returned nil error")
512532
}
Collapse file

‎internal/providers/anthropic/stop_reason_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/anthropic/stop_reason_test.go
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
)
88

99
func TestMapStopReasonRefusal(t *testing.T) {
10+
t.Parallel()
1011
if got := mapStopReason("refusal"); got != zeroruntime.FinishReasonContentFilter {
1112
t.Errorf("refusal → %q, want content_filter (M4)", got)
1213
}
Collapse file

‎internal/providers/factory_turn_session_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/factory_turn_session_test.go
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
// wraps into the default TurnSessionProvider: construction succeeds, a session
1515
// opens, and Compact reports unsupported (the default adapter contract).
1616
func TestNewTurnSessionProviderForEveryKind(t *testing.T) {
17+
t.Parallel()
1718
kinds := []config.ProviderKind{
1819
config.ProviderKindOpenAI,
1920
config.ProviderKindOpenAICompatible,
@@ -65,6 +66,7 @@ func TestNewTurnSessionProviderForEveryKind(t *testing.T) {
6566
// projects the model-registry entry (context limits, capability flags,
6667
// reasoning efforts) into the flat ProviderCapabilities.
6768
func TestNewTurnSessionProviderProjectsRegistryCapabilities(t *testing.T) {
69+
t.Parallel()
6870
registry, err := modelregistry.NewRegistry([]modelregistry.ModelEntry{{
6971
ID: "pr7-caps-model",
7072
DisplayName: "PR7 Capability Probe",
@@ -137,6 +139,7 @@ func TestNewTurnSessionProviderProjectsRegistryCapabilities(t *testing.T) {
137139
// entry that enumerates no efforts of its own still reports the name-inferred
138140
// effective tiers the /effort picker and run-time resolver advertise.
139141
func TestNewTurnSessionProviderUsesEffectiveReasoningEfforts(t *testing.T) {
142+
t.Parallel()
140143
registry, err := modelregistry.NewRegistry([]modelregistry.ModelEntry{{
141144
// A gpt-5-family id with NO ReasoningEfforts listed: the effective
142145
// efforts come from name inference, differing from the raw entry.
Collapse file

‎internal/providers/gemini/done_test.go‎

Copy file name to clipboardExpand all lines: internal/providers/gemini/done_test.go
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
// emitDone must mark the shared state done so callers observe it through the
1111
// pointer (a by-value receiver would make state.done a dead store).
1212
func TestEmitDoneMarksStateDoneThroughPointer(t *testing.T) {
13+
t.Parallel()
1314
provider, err := New(Options{Model: "gemini-test"})
1415
if err != nil {
1516
t.Fatalf("New returned error: %v", err)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.