feat(onboarding): mirror offer uses the create wizard's region selection · Entire
feat(onboarding): mirror offer uses the create wizard's region selection
1a30a09·
peyton-alt·yesterday·4 files·+140 added/-38 removed
The offer hardcoded aws-us-east-2 while entire repo mirror create offers the catalog: bare wizard = region multi-select, one-shot = cluster picker. Setup now resolves placements with the wizard's own machinery — the region multi-select pre-checked to the caller's home-jurisdiction default (one Enter for the common case, several regions selectable — data residency is the user's call in setup exactly as in the command), pickRegions + createMirrors shared verbatim. One catalog region skips the question; non-interactive keeps the fixed default so scripts stay stable.
finalizeMirrorOffer folds per-region results: any serving placement is a success, suspended-only keeps the honest warning + retry hint, total failure surfaces the cause.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Sessions
01KXPKG0NH5XKC4XKBCNPSBQVSView transcript
Changes
4
cmd/entire/cli
Monboarding_offer_actions.go+42/-26
- Monboarding_offer_test.go+27/-11
- Mrepo_mirror_create_wizard.go+50/-1
- Mrepo_mirror_create_wizard_test.go+21
10 unmodified lines
// runOnboardingLogin is the auth rung's offer: the same browser-first login
// runOnboardingMirrorCreate is the mirror rung's offer: register a mirror for
// the origin repo on the default cluster and return once placement is
// confirmed. The initial clone continues server-side (`--no-wait` semantics),
// runOnboardingMirrorCreate is the mirror rung's offer: register the origin
// repo's mirror placement(s) using the create wizard's own machinery — the
// region multi-select pre-checked to the caller's jurisdiction
// (resolveOfferRegions) and the parallel per-region create (createMirrors) —
// so setup and `entire repo mirror create` resolve placements identically.
// Placements are registered without awaiting clones (`--no-wait` semantics),
// so enable never blocks on a large repo's clone.
func runOnboardingMirrorCreate(ctx context.Context, errW io.Writer, deps onboardingRungDeps) error {
forge, owner, repo, err := deps.resolveOrigin(ctx)
return errors.New("origin is not a GitHub repository")
}
// finalizeMirrorOffer turns a nil-error createAndAwaitMirror outcome into the
// offer's result. A suspended placement returns nil error from the create
// path but will never serve — report it like `entire repo mirror create`
// does and return an error so the rung keeps its retry hint. (The probe-cache
// write-through lives in createAndAwaitMirror, which already skips suspended
// placements.)
func finalizeMirrorOffer(w io.Writer, outcome mirrorCreateOutcome) error {
created := outcome.created
if created == nil {
return errors.New("mirror placement not registered")
}
// finalizeMirrorOffer folds the per-region create results into the offer's
// outcome. Any serving placement is a success (the probe-cache write-through
// already happened inside createAndAwaitMirror); suspended-only placements
// are reported like `entire repo mirror create` does and return an error so
// the rung keeps its retry hint, as does a total failure.
func finalizeMirrorOffer(w io.Writer, results []mirrorResult) error {
served, suspended := 0, 0
var firstErr error
for _, r := range results {
switch r.status {
case mirrorStatusSuspended:
suspended++
case mirrorStatusError:
if firstErr == nil && r.err != nil {
firstErr = r.err
}
default:
served++
}
}
if created.Suspended {
if served > 0 {
fmt.Fprintln(w, " Mirror registered — the initial clone continues in the background.")
return nil
}
}
}
}
// A suspended-only placement set must be an error — the checklist would // otherwise show ✓ for a mirror that never serves. (The probe cache is safe // either way: createAndAwaitMirror only writes through for serving // placements.) func TestFinalizeMirrorOffer_SuspendedIsAnError(t *testing.T) { t.Parallel() var out bytes.Buffer outcome := mirrorCreateOutcome{created: &coreapi.CreatedMirror{Suspended: true}}
err := finalizeMirrorOffer(&out, outcome) err := finalizeMirrorOffer(&out, []mirrorResult{{status: mirrorStatusSuspended}})
if err == nil { t.Error("suspended placement must be an error so the rung keeps its retry hint") } }
// Total failure surfaces the underlying error so the offer's notice names the // cause and the checklist keeps the retry hint. func TestFinalizeMirrorOffer_TotalFailureSurfacesError(t *testing.T) { t.Parallel() var out bytes.Buffer
err := finalizeMirrorOffer(&out, []mirrorResult{{status: mirrorStatusError, err: errors.New("boom")}})
if err == nil || !strings.Contains(err.Error(), "boom") { t.Errorf("err = %v, want the create failure surfaced", err) } }