This repository was archived by the owner on May 13, 2026. It is now read-only.
feat(onboarding): validate Anthropic key on save/bootstrap before persist - #1030
Merged
Conversation
…sist
POST /api/ingestion/config and POST /api/setup/bootstrap now probe
Anthropic's /v1/models endpoint with the supplied key before persisting.
A definitive 401/403 returns HTTP 400 with `{error: invalid_anthropic_key,
detail: <upstream message>}` and writes nothing. Transient failures
(DNS, 5xx, timeout) attach a `warning` field to the 200 response and
still persist — refusing to save during an Anthropic outage would be
worse than the silent-save bug we're fixing.
The wizard's ConfigureAiStep now renders the inline error returned by
bootstrap (bounces back to the AI step on 400, clears on next keystroke)
and shows a soft-warning banner when the probe couldn't reach Anthropic.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
shiba4life
enabled auto-merge
May 13, 2026 04:16
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
crate::ingestion::anthropic::validate_key: one cheap GET to/v1/modelsthat returnsResult<(), AnthropicValidationError>—Invalidon 401/403,Transienton everything else.POST /api/ingestion/configandPOST /api/setup/bootstrap: 400 + structured error on bad key, no persistence; 200 +warningfield on transient probe failure, key still saved.ConfigureAiSteprenders the inline error inline (bounces back on 400) and shows a soft-warning banner when the probe couldn't reach Anthropic.Closes the dogfooded silent-save bug where a typo'd Anthropic key persisted cleanly and only surfaced as a 401 the first time the user tried to ingest.
Test plan
save_ingestion_configroute tests: bad-key 400 + no persistence; transient 500 + soft-warn + key persisted; Ollama save doesn't probe;***configured***placeholder doesn't probebootstraproute tests: bad-key 400 + no identity / no marker / no key store; transient 503 + bootstrap completes + warning field + key persistedConfigureAiStepUI tests: rendersapiKeyErrorinline when set, hides when nullcargo clippy --workspace --all-targets -- -D warnings(clean)cargo test --workspace --all-targets(one unrelated flaky timeout inapple_consolidation_migration_test— passes in isolation)npm test(2 unrelated 1s-timeout flakes under parallel load; pass in isolation)bash scripts/lint-tracing-egress.sh(new probe is// trace-egress: skip-3p)🤖 Generated with Claude Code