Feature/channel retry warning - #2987
Conversation
WalkthroughThis PR implements a risk acknowledgment workflow for high-risk HTTP status code redirects (504, 524) that should never be retried. It refactors backend retry logic to use a centralized helper function, introduces a reusable risk acknowledgment modal component, integrates it into channel editing workflows, and adds multi-language i18n support. Changes
Sequence DiagramsequenceDiagram
actor User
participant EditChannelModal
participant statusCodeRiskGuard
participant StatusCodeRiskGuardModal
participant RiskAcknowledgementModal
participant Backend
User->>EditChannelModal: Edit channel & modify status_code_mapping
User->>EditChannelModal: Click Submit
EditChannelModal->>statusCodeRiskGuard: collectNewDisallowedStatusCodeRedirects(original, current)
statusCodeRiskGuard-->>EditChannelModal: [risky redirect mappings]
alt Risky Redirects Detected
EditChannelModal->>StatusCodeRiskGuardModal: Show with detailItems=riskyRedirects
StatusCodeRiskGuardModal->>RiskAcknowledgementModal: Render with checklist + required text
RiskAcknowledgementModal-->>User: Display warning modal with risk content
User->>RiskAcknowledgementModal: Check all items & type confirmation text
RiskAcknowledgementModal->>StatusCodeRiskGuardModal: Resolve confirmation promise
StatusCodeRiskGuardModal->>EditChannelModal: onConfirm callback fired
EditChannelModal->>Backend: Submit channel update
else No Risky Redirects
EditChannelModal->>Backend: Submit channel update directly
end
Backend-->>User: Update successful
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
setting/operation_setting/status_code_ranges.go (1)
29-32: Consider markingalwaysSkipRetryStatusCodesas intentionally immutable.Since Go doesn't allow
constmaps, there's no compiler-enforced guarantee. The map is currently safe (unexported, no setter, never written after init), but a brief comment prevents future maintainers from adding entries at runtime without also updatingShouldRetryByStatusCode's callers.💡 Suggested annotation
-var alwaysSkipRetryStatusCodes = map[int]struct{}{ +// alwaysSkipRetryStatusCodes lists HTTP status codes that are NEVER retried, +// regardless of AutomaticRetryStatusCodeRanges. Do NOT modify at runtime. +var alwaysSkipRetryStatusCodes = map[int]struct{}{ }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@setting/operation_setting/status_code_ranges.go` around lines 29 - 32, Add an explicit comment above the alwaysSkipRetryStatusCodes map stating it is intentionally immutable (e.g., "immutable: do not modify at runtime; update ShouldRetryByStatusCode callers if you change this") so future maintainers know not to mutate it; keep the map unexported and leave ShouldRetryByStatusCode as the single read-path that consults this map.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@web/src/components/common/modals/RiskAcknowledgementModal.jsx`:
- Around line 139-147: The empty styled warning container inside
RiskAcknowledgementModal (the div with className 'rounded-lg' and inline styles
using isMobile) should be removed or populated; either delete that div entirely
to avoid rendering a blank block, or add the intended warning content (e.g., the
modal’s warning title/message or an i18n string) inside it so the banner
displays meaningful text and actions; locate this div in
RiskAcknowledgementModal.jsx (the element using isMobile for padding) and
implement the chosen change.
---
Nitpick comments:
In `@setting/operation_setting/status_code_ranges.go`:
- Around line 29-32: Add an explicit comment above the
alwaysSkipRetryStatusCodes map stating it is intentionally immutable (e.g.,
"immutable: do not modify at runtime; update ShouldRetryByStatusCode callers if
you change this") so future maintainers know not to mutate it; keep the map
unexported and leave ShouldRetryByStatusCode as the single read-path that
consults this map.
| <div | ||
| className='rounded-lg' | ||
| style={{ | ||
| border: '1px solid var(--semi-color-warning-light-hover)', | ||
| background: 'var(--semi-color-warning-light-default)', | ||
| padding: isMobile ? '10px 12px' : '12px 14px', | ||
| }} | ||
| > | ||
| </div> |
There was a problem hiding this comment.
Remove or populate the empty warning banner.
Lines 139-147 render a styled container with no content, which shows as a blank block in the modal.
🧹 Proposed cleanup
- <div
- className='rounded-lg'
- style={{
- border: '1px solid var(--semi-color-warning-light-hover)',
- background: 'var(--semi-color-warning-light-default)',
- padding: isMobile ? '10px 12px' : '12px 14px',
- }}
- >
- </div>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <div | |
| className='rounded-lg' | |
| style={{ | |
| border: '1px solid var(--semi-color-warning-light-hover)', | |
| background: 'var(--semi-color-warning-light-default)', | |
| padding: isMobile ? '10px 12px' : '12px 14px', | |
| }} | |
| > | |
| </div> | |
| {/* warning banner removed - was empty */} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@web/src/components/common/modals/RiskAcknowledgementModal.jsx` around lines
139 - 147, The empty styled warning container inside RiskAcknowledgementModal
(the div with className 'rounded-lg' and inline styles using isMobile) should be
removed or populated; either delete that div entirely to avoid rendering a blank
block, or add the intended warning content (e.g., the modal’s warning
title/message or an i18n string) inside it so the banner displays meaningful
text and actions; locate this div in RiskAcknowledgementModal.jsx (the element
using isMobile for padding) and implement the chosen change.
…ry-warning Feature/channel retry warning
Summary by CodeRabbit
Release Notes
New Features
Documentation