Bound enable report with a timeout; clarify API contract docs · Entire
Bound enable report with a timeout; clarify API contract docs
4b3e93d→main·
Soph·1mo ago·2 files·+15 added/-2 removed
reportRepoEnabled runs synchronously on the enable success path, so a backend that accepts the connection but never responds could hang the command after it had already printed success. Wrap it in a 5s timeout.
Also clarify the enable API doc comments: RemoteURL is sent credential- free (not raw), and the CLI deliberately ignores the response fields today (the GitHub App nudge is surfaced by web onboarding).
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
61592e2c38efView transcript
Changes
2
cmd/entire/cli
api
Menable.go+8/-2
Msetup.go+7
4 unmodified lines
5
6
7
8
9
8
9
10
11
12
13
14
1 unmodified line
16
17
18
19
20
21
22
23
24
25
4 unmodified lines
```
"fmt"
// EnableRepoRequest is the body of POST /api/v1/cli/enable. The server parses
// the raw remote URL itself, so the CLI only needs to send what it knows.
// EnableRepoRequest is the body of POST /api/v1/cli/enable. RemoteURL is a
// clean, credential-free remote URL (the CLI strips any embedded credentials
// and query params before sending — see reportRepoEnabled); the server
// resolves it to a repo on its end.
type EnableRepoRequest struct {
RemoteURL string `json:"remote_url"`
}
// EnableRepoResponse is the result of recording an `entire enable`. Connected
// reports whether the GitHub App can currently reach the repo; when it can't,
// InstallURL points at the App installation page.
//
// The CLI deliberately ignores these fields today: reporting is best-effort and
// the "install the GitHub App" nudge is surfaced by the web onboarding, not the
// CLI. They are decoded for the API contract and potential future use.
type EnableRepoResponse struct {
Connected bool `json:"connected"`
InstallURL string `json:"install_url,omitempty"`
}
```go
Mcmd/entire/cli/api/enable.go+8/-2
7 unmodified lines
8
9
10
11
12
13
14
925 unmodified lines
940
941
942
943
944
945
946
947
948
949
950
951
7 unmodified lines
"os"
"path/filepath"
"strings"
"time"
"github.com/entireio/cli/cmd/entire/cli/agent"
"github.com/entireio/cli/cmd/entire/cli/agent/external"
925 unmodified lines
// network error, App-can't-reach-repo) is swallowed — the web onboarding
// surfaces the "install the GitHub App" nudge, so the CLI stays quiet.
func reportRepoEnabled(ctx context.Context, insecureHTTPAuth bool) {
// This runs synchronously on the enable success path, so bound it: a backend
// that accepts the connection but never responds must not hang the command
// after it has already printed success.
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
rawURL, err := gitremote.GetRemoteURL(ctx, "origin")
if err != nil || strings.TrimSpace(rawURL) == "" {
// Local-only repo with no origin yet — nothing to report.