Commit dd527d5
committed
Validate a provider credential before onboarding reports it configured
An empty API key on a key-required preset was written as keyless:
true, and resolveProvider skips the missing-key check entirely once
keyless is set, so a config that should have failed validation loaded
as configured and only broke on the first real send. The submit
funnel now rejects an empty key on any preset that isn't genuinely
keyless-capable (the custom/manual endpoint), instead of downgrading
it.
The "save anyway" escape hatch had the same failure shape one step
further along: a credential that failed its connection test still
got persisted, indistinguishable from a verified one. It's now marked
verified: false, and the running session surfaces a plain-language
startup notice instead of letting the first send fail with a raw
adapter error.
Both bugs existed twice over: first-run onboarding and the mid-session
"connect a new provider" flow each reimplemented the same submit
logic, so a fix to one alone would have left the other silently
broken. The submit logic moves into its own module and both callers
now share it.
verified defaults to trusted (absent, not false) so this doesn't
retroactively flag every existing user's already-working setup; only
a path that persists a credential without testing it sets it false.
The OAuth submit path is exempt from the same marking on purpose — a
completed OAuth login is a stronger signal than a pasted key (the
provider's own server just issued it), though it doesn't confirm the
resulting token carries API scope, which is tracked as a separate
follow-up rather than faked here.1 parent f712dda commit dd527d5
5 files changed
Lines changed: 39 additions & 5 deletions
File tree
- src
- config
- tui-opentui
- tui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
274 | 287 | | |
275 | 288 | | |
276 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
608 | 612 | | |
609 | 613 | | |
610 | 614 | | |
| |||
1075 | 1079 | | |
1076 | 1080 | | |
1077 | 1081 | | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1082 | 1088 | | |
1083 | 1089 | | |
1084 | 1090 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| |||
0 commit comments