Show retry budget usage and why a retry was refused - #160
Conversation
Adds a Budget usage panel to the retry policy page listing each integration's spent total, flagging exhausted ones, with per-row and bulk Reset — the only way back for a group that has hit its ceiling. The xchange retry dialog now shows the policy's refusal reason, and the "Max attempts total" tooltip is corrected: the total is a lifetime ceiling counted per integration, not a shared one across all messages.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: simplify9/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)src/**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (6)
📝 WalkthroughSummary
Risk
Security-sensitive areas
Test coverage impactNo test changes are described. Add coverage for usage loading, empty, error, and exhausted states; authorized and unauthorized reset actions; bulk reset behavior; policy-update refetching; API failures; and retry refusal messages with quotation marks. Operational concerns
WalkthroughChangesRetry policy controls
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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 `@src/client/apis/retryPoliciesApi.ts`:
- Around line 74-88: Update the updateRetryPolicy mutation’s invalidatesTags
configuration to include retryPolicyUsage alongside retryPolicies, ensuring
mounted usage panels refresh after saving policy changes.
In `@src/components/exchanges/RetryModal.tsx`:
- Around line 75-80: Add regression tests for the RetryModal warning controlled
by hasScheduledRetry and retryBlockedReason: verify a non-empty reason renders
when no retry is scheduled, verify the warning is hidden when scheduledRetryOn
exists, and verify null or empty reasons render nothing. Use the existing
RetryModal test setup and preserve all other modal behavior.
- Line 78: Update the JSX text in RetryModal to encode the quotation marks
around Retry as " entities, preserving the existing message and manual
retry instruction.
In `@src/components/RetryPolicies/RetryBudgetUsage.tsx`:
- Line 16: Update RetryBudgetUsage around useRetryPolicyUsageQuery to also
consume isError and refetch, rendering a distinct error state with a retry
action when the request fails. Only render the existing empty-state message when
the query succeeds with no usage data, while preserving the loading and
populated-data paths.
- Around line 77-99: Update the reset controls in RetryBudgetUsage to rely on
Authorize omitting unauthorized children rather than a disabled section, and
enforce the same Admin/Member authorization in both reset mutation handlers on
the backend. Ensure unauthorized users cannot invoke individual or “Reset all”
actions, and add coverage verifying those controls and mutations are rejected
for unauthorized roles.
- Around line 16-17: Update RetryBudgetUsage and its tests to cover query-error
rendering, per-row and bulk reset payloads, and cache refresh after resets.
Ensure query failures display an error state rather than “No budget spent,” and
make both reset actions unavailable to unauthorized roles by explicitly
disabling or gating the descendant buttons; verify the authorized and
unauthorized flows.
🪄 Autofix
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: Repository: simplify9/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a7756c6f-a4cc-475e-994d-bee8eef2e049
📒 Files selected for processing (8)
src/client/apis/retryPoliciesApi.tssrc/components/RetryPolicies/AddEditRetryGroupModal.tsxsrc/components/RetryPolicies/RetryBudgetUsage.tsxsrc/components/RetryPolicy.tsxsrc/components/exchanges/ExchangeList.tsxsrc/components/exchanges/RetryModal.tsxsrc/types/retryPolicies.tssrc/types/xchange.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
src/**
⚙️ CodeRabbit configuration file
src/**: Focus on correctness, security, maintainability, and testability.Flag:
- authentication bypasses
- authorization gaps
- injection risks
- unsafe deserialization
- insecure crypto
- missing input validation
- data leakage
- race conditions
- weak error handling
- missing audit logging for sensitive actions
- insufficient tests for changed behavior
Files:
src/components/RetryPolicy.tsxsrc/components/RetryPolicies/AddEditRetryGroupModal.tsxsrc/types/retryPolicies.tssrc/components/exchanges/RetryModal.tsxsrc/types/xchange.tssrc/components/exchanges/ExchangeList.tsxsrc/components/RetryPolicies/RetryBudgetUsage.tsxsrc/client/apis/retryPoliciesApi.ts
🪛 React Doctor (0.9.3)
src/components/exchanges/RetryModal.tsx
[warning] 78-78: " in JSX text can read as markup & confuse readers.
Replace bare ' / " / > / } characters with HTML entities so literal UI text is encoded consistently.
(no-unescaped-entities)
🔇 Additional comments (8)
src/types/xchange.ts (1)
42-43: LGTM!src/components/exchanges/ExchangeList.tsx (1)
227-227: LGTM!src/components/exchanges/RetryModal.tsx (1)
14-17: LGTM!src/types/retryPolicies.ts (1)
100-116: LGTM!src/client/apis/retryPoliciesApi.ts (1)
7-8: LGTM!Also applies to: 17-17, 102-103
src/components/RetryPolicies/RetryBudgetUsage.tsx (1)
1-15: LGTM!Also applies to: 19-20, 23-31, 37-75, 101-105
src/components/RetryPolicies/AddEditRetryGroupModal.tsx (1)
172-172: LGTM!src/components/RetryPolicy.tsx (1)
10-10: LGTM!Also applies to: 66-68
A failed usage request fell through to "No budget spent", claiming every group was untouched when the truth was unknown. Render an error with a retry action instead, and keep the empty state for successful empty responses. Refetch usage after a policy is saved, since saving drops the counters of any removed group. Encode the quotation marks in the retry dialog.
Adds a Budget usage panel to the retry policy page listing each integration's spent total, flagging exhausted ones, with per-row and bulk Reset — the only way back for a group that has hit its ceiling.
The xchange retry dialog now shows the policy's refusal reason, and the "Max attempts total" tooltip is corrected: the total is a lifetime ceiling counted per integration, not a shared one across all messages.