Validate credentials on save#1106
Open
simple-agent-manager[bot] wants to merge 6 commits into
Open
Conversation
|
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
Testing..., green success feedback, and red warning feedback from the save response.Validation
pnpm lintpnpm typecheckpnpm testpnpm build; focused API/web credential tests; Playwright visual audit on 375x667 and 1280x800Staging Verification (REQUIRED for all code changes — merge-blocking)
Deploy Stagingworkflow triggered manually and passed for this branchapp.sammy.party(staging) using test credentials and actively tested the applicationStaging Verification Evidence
Deploy Staging passed: https://github.com/raphaeltm/simple-agent-manager/actions/runs/26331230963
Live Playwright/API verification passed against staging:
/dashboard,/projects,/settings/cloud-provider, and/settings/agent-keyswith an authenticated staging browser session.autoActivate:false; deployed API returned201withvalidation.valid=false, provider status401, and warning-mode persistence.200.400for the same invalid key.UI Compliance Checklist (Required for UI changes)
.codex/tmp/playwright-screenshots/End-to-End Verification (Required for multi-component changes)
.claude/rules/10-e2e-verification.md)Data Flow Trace
apps/web/src/components/onboarding/StepShared.tsx,apps/web/src/components/AgentKeyCard.tsx,apps/web/src/components/HetznerTokenForm.tsx,apps/web/src/components/ScalewayCredentialForm.tsx.packages/shared/src/types/user.ts,packages/shared/src/agents.ts.apps/api/src/routes/credentials.ts.apps/api/src/services/validation.ts.Untested Gaps
No gap for the implemented warning-mode save behavior: it is covered by unit/route tests, UI tests, and live staging API verification. Live staging did not use a real invalid Hetzner/Scaleway credential in the shared user account to avoid mutating existing cloud-provider configuration; provider-specific behavior is covered by mocked route/service tests.
Post-Mortem (Required for bug fix PRs)
What broke
Credential save flows accepted cloud provider tokens and agent API keys without a live upstream validation check, so users discovered invalid credentials later during provisioning or agent startup.
Root cause
Credential format validation and explicit validation existed in parts of the codebase, but the save path did not consistently return live provider validation feedback in warning mode.
Class of bug
Trust-boundary validation gap across UI/API persistence flow.
Why it wasn't caught
Existing tests did not assert that save responses included provider validation status or that UI surfaces displayed success/warning feedback from save.
Process fix included in this PR
Added route/service/UI tests that exercise the save-with-validation contract and UI feedback.
Post-mortem file
N/A: task archive records findings and verification in
tasks/archive/2026-05-23-credential-validation-on-save.md.Specialist Review Evidence (Required for agent-authored PRs)
needs-human-reviewlabel added and merge deferred to human — N/A: all reviews completed1d86daff; acceptance criteria covered.Exceptions (If any)
Agent Preflight (Required)
Classification
External References
Official documentation consulted before coding:
GET https://api.hetzner.cloud/v1/servers: https://docs.hetzner.com/cloud/api/getting-started/using-api/GET /instance/v1/zones/{zone}/servers: https://www.scaleway.com/en/developers/api/instanceGET https://api.anthropic.com/v1/models: https://anthropic.mintlify.app/en/api/models-listGET https://api.openai.com/v1/models: https://developers.openai.com/api/reference/resources/models/methods/listCodebase Impact Analysis
Affected components:
apps/api: credential save routes and provider validation service.apps/web: onboarding/settings credential feedback surfaces.packages/shared: response and agent credential validation metadata types.Documentation & Specs
tasks/archive/2026-05-23-credential-validation-on-save.mdwith verification evidence.Constitution & Risk Check
Checked Principle XI / no hardcoded values. Provider URLs are external API contracts for the providers being validated; validation timeout is configurable via
AGENT_CREDENTIAL_VALIDATION_TIMEOUT_MS. Main risk is upstream provider availability, mitigated by warning-mode persistence.Do not merge from agent automation. This PR is ready for human review.