v0.45.0 cb619f7

merge_test.go RawHistoryFolder

1package provider
2
3import "testing"
4
5func TestMergeCatalogForProvidersPrunesUnavailableStaticModels(t *testing.T) {
6	const (
7		providerID = "openai-codex"
8		liveID     = "gpt-5.6-luna"
9		absentID   = "gpt-5.6-sol"
10	)
11
12	staticPresent := false
13	for _, model := range Catalog {
14		if model.Provider == providerID && model.ID == absentID {
15			staticPresent = true
16			break
17		}
18	}
19	if !staticPresent {
20		t.Fatalf("fixture drift: static model %s/%s is no longer in Catalog", providerID, absentID)
21	}
22
23	merged := MergeCatalogForProviders([]Model{{
24		Provider: providerID,
25		ID:       liveID,
26		Source:   "live",
27	}}, []string{providerID})
28
29	foundLive := false
30	for _, model := range merged {
31		if model.Provider != providerID {
32			continue
33		}
34		if model.ID == absentID {
35			t.Fatalf("unavailable static model %s/%s remains in authoritative catalog", providerID, absentID)
36		}
37		if model.ID == liveID {
38			foundLive = true
39		}
40	}
41	if !foundLive {
42		t.Fatalf("live model %s/%s missing from authoritative catalog", providerID, liveID)
43	}
44}
45
46func TestMergeCatalogForProvidersPreservesStaticMetadata(t *testing.T) {
47	merged := MergeCatalogForProviders([]Model{{
48		Provider: "openai-codex",
49		ID:       "gpt-5.6-luna",
50		Source:   "live",
51	}}, []string{"openai-codex"})
52	for _, model := range merged {
53		if model.Provider == "openai-codex" && model.ID == "gpt-5.6-luna" {
54			if model.ContextWindow == 0 || model.MaxOutput == 0 || model.PriceInput == 0 || model.PriceOutput == 0 {
55				t.Fatalf("live model did not retain static metadata: %+v", model)
56			}
57			return
58		}
59	}
60	t.Fatal("live Codex model missing from merged catalog")
61}
62
63func TestSetLiveModelsForProvidersPrunesEmptyAuthoritativeCatalog(t *testing.T) {
64	if _, err := FindModel("openai-codex", "gpt-5.6-luna"); err != nil {
65		t.Fatalf("fixture drift: static Codex model missing: %v", err)
66	}
67	preserveActiveCatalog(t)
68
69	SetLiveModelsForProviders(nil, []string{"openai-codex"})
70	if _, err := FindModel("openai-codex", "gpt-5.6-luna"); err == nil {
71		t.Fatal("empty authoritative catalog retained a static Codex model")
72	}
73}
74
75func TestAcceptsUnlistedModelsStopsAfterAuthoritativeDiscovery(t *testing.T) {
76	preserveActiveCatalog(t)
77
78	SetLiveModels([]Model{{Provider: ProviderOpenCodeGo, ID: "bootstrap"}})
79	if !AcceptsUnlistedModels(ProviderOpenCodeGo) {
80		t.Fatal("non-authoritative OpenCode Go overlay rejected unlisted models")
81	}
82	SetLiveModelsForProviders([]Model{{Provider: ProviderOpenCodeGo, ID: "served"}}, []string{ProviderOpenCodeGo})
83	if AcceptsUnlistedModels(ProviderOpenCodeGo) {
84		t.Fatal("authoritative OpenCode Go catalog accepted an unlisted model")
85	}
86}

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