Skip to content

Commit 5512bb2

Browse files
committed
test(web): drop model selection rows main now covers
Restores main's single codex fallback case, since main now keeps a missing ACP registry model on purpose, and drops the saved Cursor preset rows and their settings entry, which only repeat main's ACP registry catalog-gap coverage.
1 parent 2bafe26 commit 5512bb2

1 file changed

Lines changed: 57 additions & 80 deletions

File tree

‎apps/web/src/modelSelection.test.ts‎

Lines changed: 57 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ function settingsWithProviderInstances(): UnifiedSettings {
7070
return {
7171
...DEFAULT_UNIFIED_SETTINGS,
7272
providerInstances: {
73-
[ProviderInstanceId.make("acpRegistry")]: {
74-
driver: ProviderDriverKind.make("acpRegistry"),
75-
config: { agentId: "cursor" },
76-
},
7773
[ProviderInstanceId.make("claudeAgent")]: {
7874
driver: ProviderDriverKind.make("claudeAgent"),
7975
config: { customModels: [] },
@@ -413,11 +409,6 @@ describe("instance-scoped model selection", () => {
413409
availableModel: "opencode/big-pickle",
414410
missingModel: "opencode/kimi-k3",
415411
},
416-
{
417-
driverName: "acpRegistry",
418-
availableModel: "composer-2",
419-
missingModel: "composer-2[fast=true]",
420-
},
421412
{
422413
driverName: "antigravity",
423414
availableModel: "gemini-3.1-pro",
@@ -503,40 +494,37 @@ describe("instance-scoped model selection", () => {
503494
});
504495
});
505496

506-
it.each(["codex", "acpRegistry"])(
507-
"falls back from an explicit %s draft with a missing model",
508-
(driverName) => {
509-
const instanceId = ProviderInstanceId.make(driverName);
510-
const driver = ProviderDriverKind.make(driverName);
511-
const providers = [provider({ provider: driver, instanceId, models: ["gpt-5.6-sol"] })];
512-
const state = deriveEffectiveComposerModelState({
513-
threadStarted: false,
514-
draft: {
515-
activeProvider: instanceId,
516-
modelSelectionByProvider: {
517-
[instanceId]: createModelSelection(instanceId, "gpt-missing", [
518-
{ id: "effort", value: "max" },
519-
]),
520-
},
497+
it("falls back from an explicit non-OpenCode draft with a missing model", () => {
498+
const instanceId = ProviderInstanceId.make("codex");
499+
const driver = ProviderDriverKind.make("codex");
500+
const providers = [provider({ provider: driver, instanceId, models: ["gpt-5.6-sol"] })];
501+
const state = deriveEffectiveComposerModelState({
502+
threadStarted: false,
503+
draft: {
504+
activeProvider: instanceId,
505+
modelSelectionByProvider: {
506+
[instanceId]: createModelSelection(instanceId, "gpt-missing", [
507+
{ id: "effort", value: "max" },
508+
]),
521509
},
522-
providers,
523-
selectedProvider: driver,
524-
selectedInstanceId: instanceId,
525-
threadModelSelection: null,
526-
projectModelSelection: null,
527-
settings: settingsWithProviderInstances(),
528-
});
529-
const dispatch = getComposerProviderState({
530-
provider: driver,
531-
model: state.selectedModel,
532-
models: providers[0]!.models,
533-
modelOptions: state.modelOptions?.[instanceId],
534-
});
510+
},
511+
providers,
512+
selectedProvider: driver,
513+
selectedInstanceId: instanceId,
514+
threadModelSelection: null,
515+
projectModelSelection: null,
516+
settings: settingsWithProviderInstances(),
517+
});
518+
const dispatch = getComposerProviderState({
519+
provider: driver,
520+
model: state.selectedModel,
521+
models: providers[0]!.models,
522+
modelOptions: state.modelOptions?.[instanceId],
523+
});
535524

536-
expect(state.selectedModel).toBe("gpt-5.6-sol");
537-
expect(dispatch.modelOptionsForDispatch).toBeUndefined();
538-
},
539-
);
525+
expect(state.selectedModel).toBe("gpt-5.6-sol");
526+
expect(dispatch.modelOptionsForDispatch).toBeUndefined();
527+
});
540528

541529
it("sends a Cursor thread's stored model and options when the catalog lacks them", () => {
542530
const instanceId = ProviderInstanceId.make("cursor");
@@ -740,46 +728,35 @@ describe("instance-scoped model selection", () => {
740728
},
741729
);
742730

743-
it.each([
744-
[
745-
"opencode",
746-
"opencode/big-pickle",
747-
"opencode/kimi-k3",
748-
[
749-
{ id: "variant", value: "max" },
750-
{ id: "agent", value: "build" },
751-
],
752-
],
753-
["acpRegistry", "composer-2", "composer-2[fast=true]", [{ id: "fast", value: "false" }]],
754-
])(
755-
"preserves saved %s options through dispatch when the model is absent from the catalog",
756-
(driverName, availableModel, missingModel, options) => {
757-
const instanceId = ProviderInstanceId.make(driverName);
758-
const driver = ProviderDriverKind.make(driverName);
759-
const providers = [provider({ provider: driver, instanceId, models: [availableModel] })];
760-
const saved = createModelSelection(instanceId, missingModel, options);
761-
const state = deriveEffectiveComposerModelState({
762-
threadStarted: false,
763-
draft: null,
764-
providers,
765-
selectedProvider: driver,
766-
selectedInstanceId: instanceId,
767-
threadModelSelection: saved,
768-
projectModelSelection: null,
769-
settings: settingsWithProviderInstances(),
770-
});
771-
const dispatch = getComposerProviderState({
772-
provider: driver,
773-
model: state.selectedModel,
774-
models: providers[0]!.models,
775-
modelOptions: state.modelOptions?.[instanceId],
776-
});
731+
it("preserves saved options through dispatch when the model is absent from the catalog", () => {
732+
const instanceId = ProviderInstanceId.make("opencode");
733+
const driver = ProviderDriverKind.make("opencode");
734+
const providers = [provider({ provider: driver, instanceId, models: ["opencode/big-pickle"] })];
735+
const saved = createModelSelection(instanceId, "opencode/kimi-k3", [
736+
{ id: "variant", value: "max" },
737+
{ id: "agent", value: "build" },
738+
]);
739+
const state = deriveEffectiveComposerModelState({
740+
threadStarted: false,
741+
draft: null,
742+
providers,
743+
selectedProvider: driver,
744+
selectedInstanceId: instanceId,
745+
threadModelSelection: saved,
746+
projectModelSelection: null,
747+
settings: settingsWithProviderInstances(),
748+
});
749+
const dispatch = getComposerProviderState({
750+
provider: driver,
751+
model: state.selectedModel,
752+
models: providers[0]!.models,
753+
modelOptions: state.modelOptions?.[instanceId],
754+
});
777755

778-
expect(
779-
createModelSelection(instanceId, state.selectedModel, dispatch.modelOptionsForDispatch),
780-
).toEqual(saved);
781-
},
782-
);
756+
expect(
757+
createModelSelection(instanceId, state.selectedModel, dispatch.modelOptionsForDispatch),
758+
).toEqual(saved);
759+
});
783760

784761
describe("composer model option precedence", () => {
785762
const instanceId = ProviderInstanceId.make("claudeAgent");

0 commit comments

Comments
 (0)