Walkthrough
Refactors Git action control flow in the web component by introducing a generalized executeGitAction function that orchestrates commit, push, and PR steps with progress tracking. Adds new getGitProgressToastAction function to determine toast actions based on run state and PR eligibility, and includes comprehensive unit tests.
Changes
| Cohort / File(s) | Summary |
|---|---|
Git Actions Control Component apps/web/src/components/GitActionsControl.tsx | Introduces new executeGitAction function orchestrating multi-step Git operations (commit, push, PR) with progress updates and error handling. Adds getGitProgressToastAction function to determine toast action type (open/create PR). Refactors PR eligibility logic with canCreatePrFromStatus helper. Updates Git progress initialization with optional generate step flag. Removes previous mutation-based immediate action path and adjusts UI wiring for new action flow. |
Git Actions Control Tests apps/web/src/git-actions-control.test.ts | New test file covering getGitProgressToastAction function with test cases for PR URL availability, push eligibility, running/error states, and non-push actions. Includes helper builders for mocking Git status and action results. |
Sequence Diagram(s)
| 1 | sequenceDiagram |
| 2 | participant User as User Action |
| 3 | participant Component as GitActionsControl Component |
| 4 | participant Executor as executeGitAction |
| 5 | participant Git as Git Operations |
| 6 | participant Toast as Progress Toast |
| 7 | |
| 8 | User->>Component: Trigger runGitActionImmediately() |
| 9 | Component->>Executor: executeGitAction() with steps |
| 10 | Executor->>Toast: Show progress (starting) |
| 11 | |
| 12 | Executor->>Git: Commit changes |
| 13 | Git-->>Executor: Commit result |
| 14 | Executor->>Toast: Update progress |
| 15 | |
| 16 | Executor->>Git: Push to remote |
| 17 | Git-->>Executor: Push result |
| 18 | Executor->>Toast: Update progress |
| 19 | |
| 20 | Executor->>Git: Create/Open PR |
| 21 | Git-->>Executor: PR result |
| 22 | Executor->>Toast: Update final status |
| 23 | |
| 24 | Toast->>Component: getGitProgressToastAction() |
| 25 | Component-->>Toast: Determine action (open_pr/create_pr/null) |
| 26 | Toast-->>User: Display with action |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'Add dynamic PR toast actions to Git actions flow' accurately summarizes the main change: introducing dynamic toast CTA logic to show contextual PR actions. |
| Merge Conflict Detection | ✅ Passed | ✅ No merge conflicts detected when merging into main |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
codething/3a47e5fc
Comment @coderabbitai help to get the list of available commands and usage tips.