Repository navigation
test(e2e): replace per-provider add-flow tests with representative journeys and registry contract tests - #991
Merged
Conversation
Astro-Han
added a commit
that referenced
this pull request
Jul 14, 2026
nextSlug swept uppercase letters into '-' without lowercasing first, so the mixed-case provider types 'MiniMax' / 'MiniMax-cn' derived '-ini-ax' / '-ini-ax-cn' — slugs validateSlug rejects — leaving the add form unable to save those providers with its pre-filled slug. Prerequisite for the new default-slug derivation contract (PR #991 review finding 4): the data-driven assertion that every catalog provider's derived slug passes validateSlug goes red without this fix. nextSlug's only call site is the add form's create-time initializer, so existing stored connections are untouched and no migration is needed. Refs #989
Astro-Han
added a commit
that referenced
this pull request
Jul 14, 2026
Address PR #991 review findings 1-3: - Judge concrete baseUrl and resolved baseUrlTemplate values with validateConnectionBaseUrl — the same gate the connection IPC applies — instead of a bare new URL() check that still admitted javascript: / file: schemes production rejects. - Require a non-empty default model snapshot for hosted providers. An empty snapshot leaves the add form without a recommended default and connection readiness at missing_model, which is only acceptable for instance-specific catalogs (category local/custom) with live model discovery. - Drop 'recommended' from the legal base catalog groups: the 推荐 tab is an overlay sourced from RECOMMENDED_PROVIDER_TYPES, so a provider declaring catalogGroup 'recommended' would render in no tab at all. (No current provider does; splitting the union type is out of scope.) Refs #989
Data-driven structural invariants over CATALOG_PROVIDER_TYPES (label, catalog group, endpoint source, default-model shape) that auto-cover new providers with zero manual updates, replacing the per-provider add-flow E2E clones as the source of provider-fact coverage. Refs #989
…ive journeys Collapse the per-provider add-flow clones in providers.spec.ts (29 expanded cases) down to four: one canonical API-key journey, the account-scoped Cloudflare form, the no-auth local runtime, and the keyboard-focus journey. Both brand-mark render contracts (color <img> and currentColor mask) stay covered. Per-provider facts now live in the core registry contract; add a desktop brand-mark completeness invariant so every catalog provider still resolves to a real mark, not the generic fallback. Refs #989
The per-id loop already asserts every shipped id is non-empty, and fallbackModels[0] trivially belongs to fallbackModels, so the block asserted nothing. Refs #989
nextSlug swept uppercase letters into '-' without lowercasing first, so the mixed-case provider types 'MiniMax' / 'MiniMax-cn' derived '-ini-ax' / '-ini-ax-cn' — slugs validateSlug rejects — leaving the add form unable to save those providers with its pre-filled slug. Prerequisite for the new default-slug derivation contract (PR #991 review finding 4): the data-driven assertion that every catalog provider's derived slug passes validateSlug goes red without this fix. nextSlug's only call site is the add form's create-time initializer, so existing stored connections are untouched and no migration is needed. Refs #989
Address PR #991 review findings 1-3: - Judge concrete baseUrl and resolved baseUrlTemplate values with validateConnectionBaseUrl — the same gate the connection IPC applies — instead of a bare new URL() check that still admitted javascript: / file: schemes production rejects. - Require a non-empty default model snapshot for hosted providers. An empty snapshot leaves the add form without a recommended default and connection readiness at missing_model, which is only acceptable for instance-specific catalogs (category local/custom) with live model discovery. - Drop 'recommended' from the legal base catalog groups: the 推荐 tab is an overlay sourced from RECOMMENDED_PROVIDER_TYPES, so a provider declaring catalogGroup 'recommended' would render in no tab at all. (No current provider does; splitting the union type is out of scope.) Refs #989
Data-driven over CATALOG_PROVIDER_TYPES: every provider's pre-filled slug from nextSlug (and its collision-suffixed fallback) must pass core's validateSlug, so derivation and save-validation can never disagree the way the mixed-case MiniMax types did. Lives on the desktop side because nextSlug is renderer code core cannot import. Refs #989
Astro-Han
force-pushed
the
test/e2e-989-provider-suite-consolidation
branch
from
July 14, 2026 17:07
0570884 to
c4d18ea
Compare
The bounded -2..-99 search fell back to `${base}-${Date.now()}` without
checking `existing`, so a dense slug space could hand the add form an
already-taken slug the save path then rejects. `existing` is finite, so
an unbounded increment always terminates on a free suffix — less code
and deterministic. Extend the default-slug contract with a dense
collision case (base and -2..-99 all taken must yield -100, unused and
valid).
PR #991 second-round review fix 2.
Refs #989
The endpoint contract branched on `baseUrl !== ''`, so a whitespace-only registry baseUrl reached validateConnectionBaseUrl — which deliberately returns null for blank input because its semantics there are "no override, fall back to the provider default". In the registry the value IS the default, so a blank baseUrl means no usable endpoint and must be routed to the template / custom-connection branches instead. Branch on `baseUrl.trim() !== ''` and assert resolved baseUrlTemplates are non-blank before the validator runs. PR #991 second-round review fix 1. Refs #989
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The providers E2E suite had grown to 29 expanded cases, 25 of which were copies of one add-flow template differing only in registry data (slug, base URL, default model, catalog tab, brand mark) — asserting
PROVIDER_DEFAULTSconstants through a real Electron window each. Suite time and the window-teardown flake surface grew linearly with the catalog, and every new provider PR copied the previous test. Closes #989.This PR keeps four E2E tests, each with a distinct reason to exist:
colorAssetRenderContractmechanism in both light and dark) — it validates the flow, not Cerebras's data;maskRenderContract(monochrome) counterpart to the color-mark path;Per-provider facts move to automatic, invariant-based coverage that needs zero updates when a provider is added:
packages/core/src/__tests__/provider-catalog-contract.test.tsiteratesCATALOG_PROVIDER_TYPES: non-empty label/description, valid catalog group, resolvable endpoint source (baseUrlparses /baseUrlTemplateresolves / custom connection), well-formed fallback model set, and static-fallback discovery must ship a non-empty snapshot.icon-governance-contract.test.tsgains a completeness check: every catalog provider must have an explicitProviderBrandMarkcase — a new provider without a mark now fails instead of silently rendering the generic fallback.No existing provider violates any invariant. The convention (no per-provider add-flow E2E; extend the contract tests instead) is documented in the spec file header.
Verification
providers.spec.tslocally: 4 passed in 7.5s (was 29 cases / ~4 min).must-not-request-models-endpoint); the button-state UI reflection is no longer covered at the E2E layer — if wanted, a renderer unit test is the right home, not a per-provider Electron E2E.