Skip to content

test(core): check models.dev entrypoints against native providers - #60779

Merged
rekram1-node merged 1 commit into
devfrom
ai-dup-subpaths
Oct 31, 2026
Merged

rekram1-node merged 1 commit into
devfrom
ai-dup-subpaths

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Nothing in this PR deletes a subpath. Every duplicate @opencode/ai/providers/* path is still referenced by models.dev, by Core, or by both, so removing any of them would break saved configs or catalog entries. The PR only adds a test that protects this contract.

The contract

  • models.dev: each model API's sdk.opencodeai names a package entry point.
  • Core loads that name through the builtins map in packages/core/src/provider.ts. Names missing from the map are skipped as unknown (loadable() in models-dev.ts). variant.ts, aisdk-native.ts and plugin/verbosity.ts also key on these paths.
  • The published package: users' configs (package: "...") and other apps import these paths directly.

An existing test already checks that the builtins map matches every package export that has a model(). The new test closes the remaining gap. Every @opencode/ai/* value in the bundled snapshot (packages/core/src/models-dev/snapshot.txt) must be a real package export and a loadable builtin. The only exception is an explicit list of protocol-only entry points.

Duplicate paths

Path Same as References found Result
providers/openai-compatible-responses providers/openai-compatible/responses models.dev: 0. Core: provider.ts loader, variant.ts, and a provider.test.ts test that pins it for existing configs. ai tests import the source file. kept
providers/openai-compatible/responses ↑ models.dev: 783. Core loader and variant.ts, README, www docs kept
providers/google-vertex-messages providers/google-vertex/messages models.dev: 0. Core: provider.ts loader, variant.ts, and the same config test. auth-options.types.ts kept
providers/google-vertex/messages ↑ models.dev: 18. Core loader, variant.ts, models-dev.ts, aisdk-native.ts (@ai-sdk/google-vertex/anthropic maps here), README, docs kept
providers/amazon-bedrock/mantle providers/amazon-bedrock/mantle/responses models.dev: 0. Core: aisdk-native.ts returns it as a rewrite target. Also the loader, variant.ts, and tests kept
providers/amazon-bedrock/mantle/responses ↑ models.dev: 17. Core loader, variant.ts, plugin/verbosity.ts, docs kept

Several <provider>/chat, /responses and /messages subpaths re-export the root's model: alibaba/chat, moonshot/chat, minimax/messages, zai/chat, zai-coding-plan/chat, meta/responses, openai/responses and google-vertex/gemini. These are not module duplicates, because each root is the provider's full module with more exports. models.dev uses every one of these subpaths, and Core loads every root. All are kept.

Gap this surfaced

The snapshot points openai/gpt-6-luna's decisions API at @opencode/ai/protocols/openai-decisions. That entry point has no model(), so Core skips that API. The test lists it explicitly. Any new non-loadable value fails the test until someone decides how to handle it. Current models.dev data also names protocols/openai-speech, openai-transcription, google-speech and similar paths. These will hit the same check when the snapshot is next refreshed.

Verification

  • The test fails when a snapshot-referenced export is removed. I checked this by temporarily dropping providers/zai/chat.
  • bun run check passes. bun typecheck and typecheck:tsc pass in packages/ai and packages/core.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The new test is small and deterministic and checks the snapshot → exports → builtins contract as described. I ran test/provider.test.ts in packages/core (5/5 pass) and typecheck:tsc (passes). I also confirmed that the new test fails when a snapshot-referenced export (providers/zai/chat) is removed from packages/ai/package.json.

Public API is unchanged (test-only).

No concerns. As you noted, the next snapshot refresh will make this test fail on the new protocols/* speech and transcription paths, until each is either loaded by Core or added to the protocolOnly list.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new head is a rebase onto dev. The test change is identical to what I reviewed before, and test/provider.test.ts still passes (5/5). There are no new concerns, and the public API is unchanged (test-only).

@rekram1-node
rekram1-node merged commit 54988df into dev Oct 31, 2026
11 of 13 checks passed
@rekram1-node
rekram1-node deleted the ai-dup-subpaths branch October 31, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant