enable toggle#296
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Currently reviewing new changes in this PR... Files selected (2)
|
Reviewer's GuideAdds guardrails so PR summary settings are tightly coupled to the main "enable reviews" toggle at both repository and organization levels, ensuring PR summaries cannot be enabled or persisted when reviews are disabled. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughBoth organization and repository settings components now enforce a dependency between "Enable Reviews" and "Enable PR Summary". When reviews are disabled, PR summary is automatically cleared in state, the UI becomes disabled, and persistence ensures PR summary is saved as false whenever reviews are off. ChangesEnable Reviews and PR Summary Dependency
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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.
🧹 Nitpick comments (2)
apps/platform/app/(platform)/repositories/[repository]/settings/components/SettingsTab.tsx (1)
58-59: ⚡ Quick winConsider normalizing state on load to handle inconsistent data.
If the backend returns
enableReviews: falsewithenablePrSummary: true(due to data corruption or legacy records), the UI will display the PR Summary switch as checked but disabled, which is confusing. The save logic correctly persistsfalse, but the initial UI state is misleading.🛡️ Suggested normalization
if (data) { setRepositoryId(data.repositoryId) setOrganizationId(data.organizationId) setUseOrgSettings(data.useOrganizationSettings) setEnableReviews(data.enableReviews) - setEnablePrSummary(data.enablePrSummary) + setEnablePrSummary(data.enableReviews ? data.enablePrSummary : false) setEnableInlineReviewComments(data.enableInlineReviewComments)🤖 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 `@apps/platform/app/`(platform)/repositories/[repository]/settings/components/SettingsTab.tsx around lines 58 - 59, The loaded settings may be inconsistent (e.g., enableReviews=false but enablePrSummary=true) causing a checked-but-disabled PR Summary switch; normalize after fetch in the SettingsTab load logic by setting setEnableReviews(data.enableReviews) and then setting setEnablePrSummary to data.enablePrSummary only when data.enableReviews is true (otherwise force false), so the component state always reflects the valid dependency between enableReviews and enablePrSummary.apps/platform/app/(platform)/organization-settings/components/OrganizationSettingsTab.tsx (1)
46-47: ⚡ Quick winConsider normalizing state on load to handle inconsistent data.
If the backend returns
enableReviews: falsewithenablePrSummary: true(due to data corruption or legacy records), the UI will display the PR Summary switch as checked but disabled, which is confusing. The save logic correctly persistsfalse, but the initial UI state is misleading.🛡️ Suggested normalization
if (data) { setEnableReviews(data.enableReviews) - setEnablePrSummary(data.enablePrSummary) + setEnablePrSummary(data.enableReviews ? data.enablePrSummary : false) setEnableInlineReviewComments(data.enableInlineReviewComments)🤖 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 `@apps/platform/app/`(platform)/organization-settings/components/OrganizationSettingsTab.tsx around lines 46 - 47, Normalize loaded settings so PR Summary can't be true when Reviews are disabled: in the code path that initializes state (the place calling setEnableReviews and setEnablePrSummary in OrganizationSettingsTab), after calling setEnableReviews(data.enableReviews) add logic to force setEnablePrSummary(false) whenever data.enableReviews is false (i.e., if (!data.enableReviews) then setEnablePrSummary(false) else setEnablePrSummary(data.enablePrSummary)). This ensures the UI and saved state are consistent when the backend returns inconsistent/legacy records.
🤖 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.
Nitpick comments:
In
`@apps/platform/app/`(platform)/organization-settings/components/OrganizationSettingsTab.tsx:
- Around line 46-47: Normalize loaded settings so PR Summary can't be true when
Reviews are disabled: in the code path that initializes state (the place calling
setEnableReviews and setEnablePrSummary in OrganizationSettingsTab), after
calling setEnableReviews(data.enableReviews) add logic to force
setEnablePrSummary(false) whenever data.enableReviews is false (i.e., if
(!data.enableReviews) then setEnablePrSummary(false) else
setEnablePrSummary(data.enablePrSummary)). This ensures the UI and saved state
are consistent when the backend returns inconsistent/legacy records.
In
`@apps/platform/app/`(platform)/repositories/[repository]/settings/components/SettingsTab.tsx:
- Around line 58-59: The loaded settings may be inconsistent (e.g.,
enableReviews=false but enablePrSummary=true) causing a checked-but-disabled PR
Summary switch; normalize after fetch in the SettingsTab load logic by setting
setEnableReviews(data.enableReviews) and then setting setEnablePrSummary to
data.enablePrSummary only when data.enableReviews is true (otherwise force
false), so the component state always reflects the valid dependency between
enableReviews and enablePrSummary.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2c284fe9-d9f4-42b2-9946-287499bb1c2d
📒 Files selected for processing (2)
apps/platform/app/(platform)/organization-settings/components/OrganizationSettingsTab.tsxapps/platform/app/(platform)/repositories/[repository]/settings/components/SettingsTab.tsx
Summary by Sourcery
Ensure PR summary settings are only enabled and saved when reviews are enabled at both repository and organization levels.
New Features:
Bug Fixes:
Summary by CodeRabbit