v0.3.90 6f6753c

copilot_catalog_test.go RawHistoryFolder

1package provider
2
3import (
4	"context"
5	"testing"
6)
7
8func TestCopilotCatalogCoversPublicChatModels(t *testing.T) {
9	groups := map[string][]string{
10		APIAnthropicMessages: {"claude-fable-5", "claude-fable-5.1", "claude-haiku-4.5", "claude-opus-4.7", "claude-opus-4.8", "claude-opus-4.8-fast", "claude-opus-5", "claude-opus-5.5", "claude-sonnet-5"},
11		APIResponses:         {"gpt-5-mini", "gpt-5.3-codex", "gpt-5.4", "gpt-5.4-mini", "gpt-5.5", "gpt-5.6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-6-astra", "grok-4.5", "grok-4.6", "mai-code-1-flash-picker", "mai-code-1.1-flash"},
12		APICompletions:       {"gemini-3.5-flash", "gemini-3.6-flash", "gemini-3.7-flash", "gemini-3.8-flash", "kimi-k2.7-code", "kimi-k3"},
13	}
14	for api, ids := range groups {
15		for _, id := range ids {
16			t.Run(id, func(t *testing.T) {
17				m, err := FindModel("github-copilot", id)
18				if err != nil {
19					t.Fatal(err)
20				}
21				if m.API != api {
22					t.Fatalf("API = %q, want %q", m.API, api)
23				}
24				if m.ContextWindow <= 0 || m.MaxOutput <= 0 || m.MaxOutput >= m.ContextWindow {
25					t.Fatalf("invalid context/output limits: %d/%d", m.ContextWindow, m.MaxOutput)
26				}
27				if m.BaseURL != copilotDefaultBaseURL || !m.Reasoning {
28					t.Fatal("invalid endpoint or reasoning metadata")
29				}
30				client := NewGithubCopilotClient("synthetic-token").(*copilotClient)
31				captures := make(map[string]*routeCaptureClient)
32				for _, key := range []string{APIAnthropicMessages, APIResponses, APICompletions} {
33					capture := &routeCaptureClient{name: "github-copilot"}
34					captures[key] = capture
35					client.router.byAPI[key] = capture
36				}
37				stream, err := client.Stream(context.Background(), Request{Model: id})
38				if err != nil {
39					t.Fatal(err)
40				}
41				for range stream {
42				}
43				for key, capture := range captures {
44					want := 0
45					if key == api {
46						want = 1
47					}
48					if len(capture.models) != want {
49						t.Errorf("%s routed to %s incorrectly", id, key)
50					}
51				}
52			})
53		}
54	}
55}
56
57func TestCopilotCatalogExcludesRetiredAndUtilityModels(t *testing.T) {
58	// https://docs.github.com/en/copilot/reference/ai-models/supported-models
59	// Sonnet 4.6 is excluded from the general catalog despite its annual-plan exception.
60	excluded := map[string]bool{
61		"claude-opus-4.5": true, "claude-opus-4.6": true,
62		"claude-sonnet-4.5": true, "claude-sonnet-4.6": true,
63		"gemini-2.5-pro": true, "gemini-3-flash-preview": true, "gemini-3.1-pro-preview": true,
64		"gpt-4.1": true, "gpt-4o": true, "gpt-5.2": true, "gpt-5.2-codex": true,
65		"grok-code-fast-1": true, "gpt-5.4-nano": true,
66	}
67	for _, m := range Catalog {
68		if m.Provider == "github-copilot" && excluded[m.ID] {
69			t.Errorf("Copilot catalog still includes %q", m.ID)
70		}
71	}
72}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close