feat: import prepared Catalog bindings through authenticated services

This commit is contained in:
Codex
2026-10-06 18:04:07 +02:00
parent d720da721b
commit af4c7b5df9
29 changed files with 835 additions and 35 deletions
+22 -8
View File
@@ -25,12 +25,14 @@ import (
type Request struct{ PlanPath, InstallationPath string }
type Result struct {
SchemaVersion int `json:"schema_version"`
PlatformReady bool `json:"platform_ready"`
WorkspaceReady bool `json:"workspace_ready"`
Stage string `json:"stage"`
Action string `json:"action"`
Journal string `json:"journal,omitempty"`
SchemaVersion int `json:"schema_version"`
PlatformReady bool `json:"platform_ready"`
WorkspaceReady bool `json:"workspace_ready"`
BindingsReady bool `json:"bindings_ready"`
BindingImport *BindingReport `json:"binding_import,omitempty"`
Stage string `json:"stage"`
Action string `json:"action"`
Journal string `json:"journal,omitempty"`
}
type journal struct {
SchemaVersion int `json:"schema_version"`
@@ -88,6 +90,11 @@ func Run(ctx context.Context, request Request, runner compose.Runner, check Chec
if _, err := preflight.ReadExecutionPlan(request.PlanPath); err != nil {
return fail("validation", "Inputs changed during checks; repeat planning before execution.")
}
payload, err := bindingPayload(plan)
if err != nil {
return fail("bootstrap-input", err.Error())
}
defer clear(payload)
result.Journal = filepath.Join(installation.ControlDirectory(), "installation-apply.json")
state := journal{SchemaVersion: 1, Installation: installation.Path, ReleaseRevision: plan.Release.Revision, PlanSeal: plan.InputSeal}
if _, err := os.Lstat(result.Journal); err == nil {
@@ -194,6 +201,13 @@ func Run(ctx context.Context, request Request, runner compose.Runner, check Chec
}
return docker(time.Minute, "exec", "-T", "core", "node", "--input-type=module", "-e", runtimeCheck)
}},
{"bindings", func() error {
result.PlatformReady = true
report, err := importBindings(ctx, plan, runner, payload)
result.BindingImport = &report
result.BindingsReady = err == nil
return err
}},
}
// Reconcile each idempotent stage against Docker/migration authority on every retry.
// A journal entry alone is never proof that a container or migration still exists.
@@ -203,8 +217,8 @@ func Run(ctx context.Context, request Request, runner compose.Runner, check Chec
}
}
result.PlatformReady = true
result.Stage = "platform-ready"
result.Action = "Platform is running. Import prepared database bindings and complete workspace readiness before a human-reviewed question."
result.Stage = "bindings-ready"
result.Action = "Platform and prepared database bindings are ready. Complete workspace readiness before a human-reviewed question."
return result, nil
}