From bd693ca31bcc705c544276865943ad324f867ae0 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Wed, 4 Nov 2026 00:52:04 +0000 Subject: [PATCH] Run recovery handoffs for the host target --- cmd/releasekit/main.go | 9 +++++---- cmd/releasekit/publication_handoff_test.go | 7 +++++-- docs/roadmap/implementation.md | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmd/releasekit/main.go b/cmd/releasekit/main.go index 6462201..33fbe6c 100644 --- a/cmd/releasekit/main.go +++ b/cmd/releasekit/main.go @@ -142,16 +142,17 @@ func selectedPublicationRecoveryCommand(ctx context.Context, result releasekit.P if err != nil { return "", err } - if len(args) > 0 { - command := "env GOWORK=off GOTOOLCHAIN=local go" - for _, arg := range args { + if args != nil { + prefix := "go -C " + shellQuote(git.DisplayDiagnostic(args.Directory)) + command := "(export GOWORK=off GOTOOLCHAIN=local && releasekit_host_os=$(" + prefix + " env GOHOSTOS) && releasekit_host_arch=$(" + prefix + " env GOHOSTARCH) && GOOS=\"$releasekit_host_os\" GOARCH=\"$releasekit_host_arch\" " + prefix + for _, arg := range args.Args { command += " " + shellQuote(git.DisplayDiagnostic(arg)) } path, err := filepath.Abs(git.DisplayDiagnostic(result.RecordPath)) if err != nil { return "", err } - return command + " reconcile --record " + shellQuote(path), nil + return command + " reconcile --record " + shellQuote(path) + ")", nil } } return publicationRecoveryCommand(result.RecordPath) diff --git a/cmd/releasekit/publication_handoff_test.go b/cmd/releasekit/publication_handoff_test.go index c831648..7f51bd3 100644 --- a/cmd/releasekit/publication_handoff_test.go +++ b/cmd/releasekit/publication_handoff_test.go @@ -256,7 +256,8 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) { } // Execute from another directory after the original driver and the // API-only launcher's temporary files are gone. - evidence, err := publish.LoadEvidence(outputLineValue(text, "publication record saved: ")) + originalRecord := outputLineValue(text, "publication record saved: ") + evidence, err := publish.LoadEvidence(originalRecord) if err != nil { t.Fatal(err) } @@ -277,10 +278,12 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) { } selected := command if scenario.record != "" { - selected += " --record " + shellQuote(scenario.record) + selected = strings.Replace(selected, shellQuote(originalRecord), shellQuote(scenario.record), 1) } recovery := exec.Command("sh", "-c", selected) recovery.Dir = t.TempDir() + foreignOS, foreignArch := foreignTarget() + recovery.Env = setEnvironment(setEnvironment(os.Environ(), "GOOS", foreignOS), "GOARCH", foreignArch) recovered, err := recovery.CombinedOutput() if scenario.status == 0 && err != nil || scenario.status != 0 && (!errors.As(err, &exitError) || exitError.ExitCode() != scenario.status) { t.Fatalf("recovery status want %d: %v: %s", scenario.status, err, recovered) diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 44c2417..1ed41dd 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -129,6 +129,8 @@ checks in Stage 6. ## Stage 5: Normalize the printed recovery command when it runs +**Completed.** + 1. In `selectedPublicationRecoveryCommand` in [the CLI](../../cmd/releasekit/main.go), render the descriptor as one copyable POSIX shell command. Use this structure, with ``,