Commit dfe14fb
committed
Fix builtin provider save — remove stray
`useSaveBuiltinProviderMutation` sends `type: 'builtin'` on the `PUT
/api/providers/:id` body, but `ProviderUpdateSchema` in
`src/lib/validation/schemas.ts` is `.strict()` and does not accept a
`type` key. Every save of a builtin provider (Anthropic, OpenAI,
Hermes, etc.) via the Provider Sheet therefore returns 400.
The server already derives `type` server-side (`'builtin'` when the id
is present in the `PROVIDERS` map, `existing.type` on update), so the
client never needed to send it.
- Drop `type: 'builtin'` from the PUT body.
- Add a regression test asserting `PUT /providers/:id` with an
unknown field returns 400.
- Wire `src/app/api/providers/[id]/route.test.ts` into `test:runtime`
(it was present but not executed by any npm script).
Repro: open any builtin provider in the Provider Sheet, change the
base URL or enablement, click Save — fails with a Zod validation
error. After this change, save succeeds.type field rejected by strict schema1 parent da64497 commit dfe14fb
3 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
0 commit comments