fix(#264) : Enhance error handling and testing for branch creation failures - #266
Conversation
…r codes 502, 503, and 504
…ay failures during branch creation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe change adds API message text to post-refresh HTTP errors, classifies gateway failures as ambiguous branch-creation outcomes, and adopts matching branches after HTTP 502, 503, or 504 responses. A test covers adoption after a 502 response. ChangesBranch creation recovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR improves branch-creation failure handling and error reporting with localized code and test changes; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThe PR improves recovery when branch creation returns an ambiguous gateway error and enriches shared Platform API errors with HTTP status and server-provided details.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/commands/branch/create.ts | Expands guarded branch adoption to ambiguous gateway statuses while preserving name, mode, and timestamp matching. |
| src/lib/api/platform.ts | Enriches both normal and post-refresh HTTP failures with status codes and combined server error details. |
| src/commands/branch/create.test.ts | Adds regression coverage showing that a matching branch is adopted after an HTTP 502 response. |
Sequence Diagram
sequenceDiagram
participant CLI
participant Platform as Platform API
CLI->>Platform: Create branch
Platform-->>CLI: Transport error or 502/503/504
CLI->>Platform: List branches
Platform-->>CLI: Existing branches
alt Same name, mode, and recent timestamp
CLI->>CLI: Adopt matching branch
CLI->>Platform: Poll until ready
else No matching branch
CLI->>CLI: Rethrow original error
end
Reviews (2): Last reviewed commit: "Merge branch 'main' into main" | Re-trigger Greptile
|
@haddybhaiya could you please resolve the conflicts first? |
Done @jwfing , thanks for mentioning ! |
closes #264
This pull request improves the reliability and clarity of branch creation in the CLI by better handling ambiguous failures, especially around gateway errors, and by enhancing error reporting. The logic for "adopting" a branch after an ambiguous failure is now more robust, and error messages now carry more detail for debugging.
Branch creation reliability improvements:
src/commands/branch/create.ts, [1] [2] [3] [4]src/commands/branch/create.test.ts, src/commands/branch/create.test.tsR434-R467)Error reporting enhancements:
CLIErrorthrown on failed API responses now includes the HTTP status code as a property, and the error message is more descriptive, including botherrorandmessagefields if present. (src/lib/api/platform.ts, [1] [2]Summary by CodeRabbit