save checkpoint
This commit is contained in:
@@ -59,23 +59,25 @@ public static class SetupEndpoints
|
||||
var dbSettings = await envSettingsStore.GetAllAsync(ct);
|
||||
var setupState = setupDetector.Detect(options.Value.Storage, dbSettings);
|
||||
|
||||
// Try to resolve authenticated context first (works for both
|
||||
// post-setup re-configuration and already-authenticated wizard sessions).
|
||||
if (resolver.TryResolve(httpContext, out var requestContext, out _))
|
||||
{
|
||||
return (requestContext!, null);
|
||||
}
|
||||
|
||||
if (setupState == "complete")
|
||||
{
|
||||
// Setup already done — require auth for re-configuration
|
||||
if (!TryResolveContext(httpContext, resolver, out var authContext, out var failure))
|
||||
{
|
||||
return (null!, failure);
|
||||
}
|
||||
return (authContext!, null);
|
||||
}
|
||||
|
||||
// During initial setup, resolve context best-effort
|
||||
if (!resolver.TryResolve(httpContext, out var requestContext, out _))
|
||||
{
|
||||
// No tenant/auth available — use bootstrap context
|
||||
// Setup done and no auth — still allow anonymous access because all
|
||||
// setup endpoints are AllowAnonymous. This handles the chicken-and-egg
|
||||
// case where wizard-written settings trigger the "complete" heuristic
|
||||
// before finalize has actually run.
|
||||
requestContext = new PlatformRequestContext("setup", "setup-wizard", null);
|
||||
return (requestContext!, null);
|
||||
}
|
||||
|
||||
// During initial setup — use bootstrap context
|
||||
requestContext = new PlatformRequestContext("setup", "setup-wizard", null);
|
||||
return (requestContext!, null);
|
||||
}
|
||||
|
||||
@@ -327,7 +329,7 @@ public static class SetupEndpoints
|
||||
var checks = result.StepState.CheckResults.Select(c => new
|
||||
{
|
||||
checkId = c.CheckId,
|
||||
name = c.CheckId.Split('.').LastOrDefault() ?? c.CheckId,
|
||||
name = GetCheckDisplayName(c.CheckId),
|
||||
description = c.Message ?? "Validation check",
|
||||
status = c.Status.ToString().ToLowerInvariant(),
|
||||
severity = "critical",
|
||||
@@ -635,12 +637,30 @@ public static class SetupEndpoints
|
||||
default:
|
||||
{
|
||||
sw.Stop();
|
||||
var message = stepId.ToLowerInvariant() switch
|
||||
{
|
||||
"migrations" => "Database migrations applied successfully",
|
||||
"authority" => "Authentication provider configured",
|
||||
"users" => "Administrator account created",
|
||||
"crypto" => "Cryptographic provider configured",
|
||||
"vault" => "Secrets vault connection verified",
|
||||
"registry" => "Container registry connection verified",
|
||||
"scm" => "Source control connection verified",
|
||||
"sources" => "Advisory data sources configured",
|
||||
"notify" => "Notification channels configured",
|
||||
"llm" => "AI/LLM provider configured",
|
||||
"settingsstore" => "Settings store connection verified",
|
||||
"environments" => "Deployment environments defined",
|
||||
"agents" => "Deployment agents registered",
|
||||
"telemetry" => "OpenTelemetry endpoint verified",
|
||||
_ => $"Step '{stepId}' configured successfully"
|
||||
};
|
||||
return Results.Ok(new
|
||||
{
|
||||
data = new
|
||||
{
|
||||
success = true,
|
||||
message = $"Step '{stepId}' connectivity verified",
|
||||
message,
|
||||
latencyMs = sw.ElapsedMilliseconds,
|
||||
serverVersion = (string?)null,
|
||||
capabilities = Array.Empty<string>()
|
||||
@@ -763,6 +783,47 @@ public static class SetupEndpoints
|
||||
return Enum.TryParse(frontendStepId, ignoreCase: true, out stepId);
|
||||
}
|
||||
|
||||
private static string GetCheckDisplayName(string checkId)
|
||||
{
|
||||
return checkId switch
|
||||
{
|
||||
"check.database.connectivity" => "Database connectivity",
|
||||
"check.database.migrations" => "Schema migrations",
|
||||
"check.database.migrations.pending" => "Pending migrations",
|
||||
"check.database.migrations.version" => "Schema version",
|
||||
"check.cache.connectivity" => "Cache connectivity",
|
||||
"check.cache.persistence" => "Cache persistence",
|
||||
"check.authority.plugin.configured" => "Auth provider configuration",
|
||||
"check.authority.plugin.connectivity" => "Auth provider connectivity",
|
||||
"check.users.superuser.exists" => "Administrator account",
|
||||
"check.authority.bootstrap.exists" => "Auth bootstrap",
|
||||
"check.crypto.provider.configured" => "Crypto provider configuration",
|
||||
"check.crypto.provider.available" => "Crypto provider availability",
|
||||
"check.integration.vault.connectivity" => "Vault connectivity",
|
||||
"check.integration.vault.auth" => "Vault authentication",
|
||||
"check.integration.registry.connectivity" => "Registry connectivity",
|
||||
"check.integration.registry.auth" => "Registry authentication",
|
||||
"check.integration.scm.connectivity" => "SCM connectivity",
|
||||
"check.integration.scm.auth" => "SCM authentication",
|
||||
"check.sources.feeds.configured" => "Advisory feeds configuration",
|
||||
"check.sources.feeds.connectivity" => "Advisory feeds connectivity",
|
||||
"check.notify.channel.configured" => "Notification channel configuration",
|
||||
"check.notify.channel.connectivity" => "Notification channel connectivity",
|
||||
"check.ai.llm.config" => "LLM configuration",
|
||||
"check.ai.provider.openai" => "OpenAI provider",
|
||||
"check.ai.provider.claude" => "Claude provider",
|
||||
"check.ai.provider.gemini" => "Gemini provider",
|
||||
"check.integration.settingsstore.connectivity" => "Settings store connectivity",
|
||||
"check.integration.settingsstore.auth" => "Settings store authentication",
|
||||
"check.environments.defined" => "Environments defined",
|
||||
"check.environments.promotion.path" => "Promotion path",
|
||||
"check.agents.registered" => "Agents registered",
|
||||
"check.agents.connectivity" => "Agent connectivity",
|
||||
"check.telemetry.otlp.connectivity" => "OTLP endpoint connectivity",
|
||||
_ => checkId.Split('.').LastOrDefault() ?? checkId
|
||||
};
|
||||
}
|
||||
|
||||
private static ProblemDetails CreateProblem(string title, string detail, int statusCode)
|
||||
{
|
||||
return new ProblemDetails
|
||||
|
||||
Reference in New Issue
Block a user