fix(catalyst-api): D30 PR I — mark imported deployment as Adopted on chroot

Founder t140 bug #6: /parent-domains shows only primary, not the
sme-pool domains. Chroot's deployment record has parentDomains[]
populated but ListParentDomains uses h.activeDeployment() which
filters to AdoptedAt!=nil. The mothership ships the record before
the chroot's own handover-finalisation, so AdoptedAt is nil →
activeDeployment returns nil → only synth primary row renders.

Fix: HandleDeploymentImport stamps AdoptedAt at import time. The
FQDN-match guard above verifies "this record IS my Sovereign's
record" so the chroot is by definition the operator/owner — no
separate adoption-wizard needed on chroot side.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hatiyildiz 2026-05-17 09:04:32 +02:00
parent 473a2ba4b9
commit 129ea34067

View File

@ -28,6 +28,7 @@ import (
"net/http"
"os"
"strings"
"time"
"github.com/openova-io/openova/products/catalyst/bootstrap/api/internal/store"
)
@ -76,6 +77,22 @@ func (h *Handler) HandleDeploymentImport(w http.ResponseWriter, r *http.Request)
return
}
// D30 PR I (2026-05-17 t140 /parent-domains regression): mark imported
// deployment as Adopted at import time. The chroot IS the owner of
// this Sovereign (FQDN-match guard above verifies it) and the record
// arrives ONLY after handover-fire on the mothership, so the chroot's
// view of "this is my deployment" should not wait for a separate
// wizard adoption step (which doesn't exist on the chroot side).
//
// Without this, h.activeDeployment() returns nil because it filters
// to AdoptedAt!=nil → ListParentDomains returns only the synth primary
// → operator visits /parent-domains and sees ONE row instead of the
// pool. Founder caught on t140 (b#6).
if rec.AdoptedAt == nil {
now := time.Now().UTC()
rec.AdoptedAt = &now
}
if err := h.store.Save(rec); err != nil {
h.log.Error("deployment-import: store.Save failed",
"id", rec.ID,