fix(deploy,api): interactive project picker + detect shell-mangled api paths#35
Conversation
…i paths Two CLI failure buckets surfaced by telemetry (last 30 days): deploy — "No project specified" (52 events, 47 users): resolveDeployProject already auto-selects a lone project, but multi-project accounts hard-failed even for interactive users. Add a promptui picker for the multi-project case, mirroring the existing server picker. Agents / piped / --non-interactive callers keep the structured error+list so automation can retry with --project. api — "unsupported protocol scheme \"c\"" (Windows/Git-Bash): MSYS POSIX path conversion rewrites a leading "/projects/..." into "C:/Program Files/Git/...". Detect a drive-letter path (never a valid API path) and return an actionable error pointing to MSYS_NO_PATHCONV=1 or dropping the leading slash — rather than guessing the intended endpoint, which on a raw escape hatch could fire a destructive call. Note: the other two telemetry buckets (422/404 -> internal misclassification, literal "undefined" error_message) are stale-client artifacts (v0.16.3 / v0.14.1) already fixed on current versions; no code change needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe CLI now rejects Git Bash/MSYS-mangled API paths before making requests. Deploy commands prompt interactive users to choose among multiple projects while retaining structured errors for non-interactive callers. ChangesCLI behavior updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant resolveDeployProject
participant promptui.Select
CLI->>resolveDeployProject: resolve multiple projects
resolveDeployProject->>promptui.Select: prompt when interactive
promptui.Select-->>resolveDeployProject: selected project or cancellation
resolveDeployProject-->>CLI: project identifier or UserError
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/commands/deploy_test.go (1)
605-608: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftCover both sides of the project-resolution split.
This test only exercises the existing non-interactive error path. Add coverage for a non-TTY envelope with
NonInteractive: falseand a deterministic interactive selection, so regressions in the picker or piped-output behavior are caught.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/commands/deploy_test.go` around lines 605 - 608, Add a complementary test alongside the existing non-interactive multi-project case using a non-TTY output.Envelope with NonInteractive: false, and configure deterministic picker input to select a project. Exercise resolveDeployProject and assert the selected project is returned, while preserving the existing structured-error assertions for the non-interactive path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/commands/api.go`:
- Around line 53-55: Update the recovery command hints in the API error response
to make the path placeholder shell-safe: quote the placeholder or replace it
with a clearly marked concrete example such as "/projects/my-app", while
indicating that users must substitute their actual path. Preserve both recovery
command variants and their existing guidance.
---
Nitpick comments:
In `@internal/commands/deploy_test.go`:
- Around line 605-608: Add a complementary test alongside the existing
non-interactive multi-project case using a non-TTY output.Envelope with
NonInteractive: false, and configure deterministic picker input to select a
project. Exercise resolveDeployProject and assert the selected project is
returned, while preserving the existing structured-error assertions for the
non-interactive path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1f157b73-fb93-404d-bf82-aa1beb09aff9
📒 Files selected for processing (4)
internal/commands/api.gointernal/commands/api_test.gointernal/commands/deploy.gointernal/commands/deploy_test.go
Review-council finding (Codex, verified): the project and server pickers gated only on !env.NonInteractive, but --json on a TTY leaves NonInteractive false. promptui writes terminal control sequences to os.Stdout (select.go:558), so `dhq deploy --json` in a terminal would interleave non-JSON bytes into stdout, breaking the stdout=data contract. Gate both pickers on `!env.NonInteractive && !env.WantsJSON()` so JSON mode takes the structured-error path (itself valid JSON). Also closes the same pre-existing gap in the server picker. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CodeRabbit review: the recovery hint printed literal "<path>" placeholders,
which Bash parses as input redirection (from a file named "path") if a user
copies the command. Use concrete examples ("/projects/my-app") in both
recovery lines instead.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes the two current CLI failure buckets from the last-30-day Mixpanel telemetry review. (The other two buckets — 422/404→
internalmisclassification and literalundefinederror messages — turned out to be stale-client artifacts from v0.16.3 / v0.14.1, already fixed on current versions, so no code change was needed there.)dhq deploy— "No project specified" (52 events, 47 distinct users)The largest failure message in the dataset.
resolveDeployProjectalready auto-selects when the account has exactly one project, but multi-project accounts hard-failed with a list even for interactive users.promptuipicker for the multi-project case, mirroring the existing server picker indeploy.go.--non-interactivekeep the structuredNo project specifiederror + project list (unchanged), so automation can still retry with--project. The telemetry headline is preserved for bucket continuity.dhq api—unsupported protocol scheme "c"(Windows / Git-Bash)MSYS POSIX path conversion rewrites a leading
/projects/...intoC:/Program Files/Git/projects/...before the CLI sees it, sourl.Parsereadsc:as a scheme.MSYS_NO_PATHCONV=1or omitting the leading slash.Tests
resolveDeployProjectnon-interactive assertions (multi-project lists candidates; lone project auto-selects; zero projects suggestsdhq launch).TestIsShellMangledPathtable test (drive-letter variants flagged; relative/root-absolute paths pass).userclass); legitimate relative/absolute paths pass through untouched.go test ./...,go vet,golangci-lintall clean.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
New Features