fix(ui-models): stop the create card pinning a reference on a blank key

Master's credential-lifecycle work taught the editor card that a pi-ai
profile names `apiKeyEnv` only when a key is actually stored, so a route
left blank keeps its provider-native auth path. The create card kept
writing the derived reference unconditionally, so a route declared for a
credential chain or ADC was born pointing at a reference nothing sets —
and now rendered a red missing-key dot for it.

Both cards apply one rule. The obsolete assertion moves with the behavior
(the with-key case is covered by the neighbouring test), and the merged
Models e2e golden shows the declared route unmarked rather than flagged.
This commit is contained in:
Yichen Jiang
2026-08-07 13:57:52 +08:00
parent d63c70bcf1
commit 72618f29b5
6 changed files with 19 additions and 11 deletions
@@ -899,8 +899,10 @@ describe('hand-declared providers', () => {
await waitFor(() => { expect(onClose).toHaveBeenCalledWith(true) })
// No display name configured means none stored; the route id is the name.
// No key typed means no reference either, matching the editor: the route
// keeps its provider-native auth path instead of resolving a reference
// nothing ever sets. The with-key case is covered above.
expect(firstMutate(mutate).ops[0]?.value).toEqual({
apiKeyEnv: 'ACME_API_KEY',
api: 'anthropic-messages',
baseURL: 'https://acme.test/v1',
models: [{ id: 'm' }],