Skip to content

test: generic validator for declarative providers - #10010

Merged
DOsinga merged 3 commits into
mainfrom
declarative-generic-tests
Jul 1, 2026
Merged

test: generic validator for declarative providers#10010
DOsinga merged 3 commits into
mainfrom
declarative-generic-tests

Conversation

@DOsinga

@DOsinga DOsinga commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

What

Replaces the hand-maintained per-provider declarative tests with a single generic validator, test_all_bundled_providers_are_valid.

Why

The previous tests asserted specific model names, model counts and orderings from each bundled provider JSON (e.g. config.models[0].name == "zai-org/GLM-5.1-FP8"). Adding or reordering a model in a provider's JSON broke unrelated structural tests — most recently in #9967, where adding GLM-5.2 broke the nearai test. That's noise, not signal.

What the generic test checks

For every bundled provider JSON it asserts the invariants that actually matter:

  • it parses through the real loader (deserialize_provider_config, including the preserves_thinking default)
  • has a valid provider id (validate_provider_id) that is unique across all bundled providers
  • has a non-empty base_url
  • has static models when dynamic_models is disabled (otherwise construction fails at runtime)
  • declares a matching env_var for every ${VAR} placeholder in base_url, base_path and headers

The placeholder/env_var check catches a real misconfiguration class (a placeholder with no backing env_var would fail expansion at runtime) — verified by temporarily injecting a bad placeholder, which the test correctly fails on.

Also drops the brittle default_model assertions from the registry-wiring tests in init.rs while keeping their structural config-key checks.

Net: -274/+68 lines.

Douwe M Osinga added 2 commits June 25, 2026 10:28
The declarative provider tests hand-asserted specific model names, model
counts, and orderings from each bundled provider JSON. Adding or reordering a
model broke unrelated structural tests (see #9967).

Replace the per-provider deserialize tests with a single
test_all_bundled_providers_are_valid that walks every bundled provider and
checks the invariants that actually matter: it parses, has a valid and unique
id, a non-empty base_url, static models when dynamic_models is disabled, and a
declared env_var for every ${VAR} placeholder in base_url/base_path/headers.

Also drop the brittle default_model assertions from the registry-wiring tests,
keeping their structural config-key checks.
The per-provider registry-wiring tests (tanzu/nvidia/nearai/alibaba) each
restated one provider's display_name, doc link, and config-key names. Replace
them with test_bundled_providers_wire_into_registry_metadata, which registers
every bundled declarative provider and asserts the wiring contract that
matters: it registers as Declarative, never leaks the OpenAI engine's
OPENAI_HOST/OPENAI_BASE_PATH keys, and turns the JSON api_key_env + env_vars
into config keys with the right secret/required flags.

Keep the huggingface (Preferred) and openai-compatible config-key tests, which
exercise different (non-declarative) registration paths.
@DOsinga
DOsinga enabled auto-merge July 1, 2026 02:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d99c06fa06

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +870 to +871
let mut registry = crate::providers::provider_registry::ProviderRegistry::new(None);
register_declarative_provider(&mut registry, config, ProviderType::Declarative);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exercise the real provider registry path

Because this replacement test registers each bundled provider directly into a fresh ProviderRegistry, it no longer covers the init_registry/providers().await path that the application uses. With the deleted init.rs registry-wiring tests gone, removing or breaking the register_declarative_providers call from initialization would still pass here while every bundled declarative provider disappears from the app; keep at least one assertion against the global registry or register through that path.

Useful? React with 👍 / 👎.

@DOsinga
DOsinga added this pull request to the merge queue Jul 1, 2026
Merged via the queue into main with commit f150672 Jul 1, 2026
26 checks passed
@DOsinga
DOsinga deleted the declarative-generic-tests branch July 1, 2026 03:21
lifeizhou-ap added a commit that referenced this pull request Jul 1, 2026
* main: (31 commits)
  test: generic validator for declarative providers (#10010)
  UI acp migratoin: Decouple desktop UI types from generated OpenAPI types (Part 2) (#10149)
  Remove MCP sampling support (#10087)
  Support TLS for ACP serve (#10088)
  feat (ui): Migrate dictation local model manager to ACP (#10131)
  Fix MCP app sandbox bridge lifecycle (#10064)
  fix(bedrock): send inference config (max_tokens, temperature) on Converse (#9889)
  feat(providers): support OpenRouter request parameters (#9276)
  Migrate local inference model management to ACP (#10124)
  (attempt to) fix disk space errors in linux release builds (#10024)
  feat: add --edit session flag to edit conversation before forking (#9799)
  feat: add iFlytek Spark and Astron MaaS providers (#9837)
  fix(desktop): dedupe Nostr session deep link imports (#9918)
  [codex] Add SessionStart hook parity outside CLI (#9970)
  feat(providers): add Fireworks AI declarative provider (#9990)
  fix(providers): don't retry deterministically-permanent 400s (thinking-block immutability) (#10005)
  fix(deps): downgrade pkcs8 to v0.10 to match sec1/pkcs1 v0.7 (#10119)
  chore(deps): bump actions/cache from 5.0.2 to 6.0.0 (#10051)
  Make OpenAI Responses API store param configurable (#10040)
  remove unsupported model (#10121)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants