Skip to content

enable toggle#296

Merged
CloudM22 merged 1 commit into
mainfrom
off-summary
Jun 19, 2026
Merged

enable toggle#296
CloudM22 merged 1 commit into
mainfrom
off-summary

Conversation

@Tarun-Masapuram

@Tarun-Masapuram Tarun-Masapuram commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Ensure PR summary settings are only enabled and saved when reviews are enabled at both repository and organization levels.

New Features:

  • Disable PR summary toggles when reviews are turned off in repository and organization settings.

Bug Fixes:

  • Prevent saving PR summary as enabled when reviews are disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Enforced dependency between Enable Reviews and Enable PR Summary settings. When reviews are disabled, PR summary is automatically turned off and its toggle becomes unavailable to prevent inconsistent configuration states.

Review Change Stack

@vercel

vercel Bot commented May 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
thinkthroo-github-app Ready Ready Preview, Comment May 15, 2026 5:21pm
thinkthroo-platform Ready Ready Preview, Comment May 15, 2026 5:21pm
thinkthroo-www Ready Ready Preview, Comment May 15, 2026 5:21pm

Request Review

@thinkthroo

thinkthroo Bot commented May 15, 2026

Copy link
Copy Markdown

Currently reviewing new changes in this PR...

Commits Files that changed from the base of the PR and between 373ec89 and 89a80f9 commits.
Files selected (2)
  • apps/platform/app/(platform)/organization-settings/components/OrganizationSettingsTab.tsx (3)
  • apps/platform/app/(platform)/repositories/[repository]/settings/components/SettingsTab.tsx (3)

@sourcery-ai

sourcery-ai Bot commented May 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds 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

Change Details Files
Couple PR summary enablement to the main reviews toggle in repository settings UI and persistence.
  • Introduce a handler for the reviews switch that also turns off PR summary when reviews are disabled
  • Ensure the payload sent on save forces PR summary to false when reviews are disabled
  • Wire the reviews switch to the new handler instead of directly setting state
  • Disable the PR summary switch when reviews are disabled in the UI
apps/platform/app/(platform)/repositories/[repository]/settings/components/SettingsTab.tsx
Mirror the reviews/PR summary coupling logic in organization-level settings.
  • Introduce a handler for the organization-level reviews switch that also turns off PR summary when reviews are disabled
  • Ensure the organization settings save payload forces PR summary to false when reviews are disabled
  • Wire the organization-level reviews switch to the new handler
  • Disable the PR summary switch in the organization settings when reviews are disabled
apps/platform/app/(platform)/organization-settings/components/OrganizationSettingsTab.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Both 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.

Changes

Enable Reviews and PR Summary Dependency

Layer / File(s) Summary
Organization settings dependency
apps/platform/app/(platform)/organization-settings/components/OrganizationSettingsTab.tsx
Introduces handleEnableReviewsChange handler that clears enablePrSummary when reviews are turned off. The Enable Reviews switch is rewired to use this handler, and the PR Summary switch is disabled when enableReviews is false.
Repository settings dependency
apps/platform/app/(platform)/repositories/[repository]/settings/components/SettingsTab.tsx
Adds the same handleEnableReviewsChange handler logic, updates handleSave to conditionally persist enablePrSummary as false when reviews are disabled, rewires the Enable Reviews switch, and disables the PR Summary switch when reviews are off.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Two toggles dance in harmony true,
When Reviews bid farewell, Summary must bid adieu,
No state survives when Reviews fade to black,
The UI locks its gates and won't turn back,
Saves persist the truth with logical care.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'enable toggle' is vague and generic. It does not clearly describe what toggles are being enabled or what the actual changes accomplish. Use a more specific title that describes the actual change, such as 'Enforce dependency between Enable Reviews and Enable PR Summary toggles' or 'Disable PR Summary toggle when reviews are disabled'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch off-summary

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/platform/app/(platform)/repositories/[repository]/settings/components/SettingsTab.tsx (1)

58-59: ⚡ Quick win

Consider normalizing state on load to handle inconsistent data.

If the backend returns enableReviews: false with enablePrSummary: 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 persists false, 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 win

Consider normalizing state on load to handle inconsistent data.

If the backend returns enableReviews: false with enablePrSummary: 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 persists false, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 373ec89 and 89a80f9.

📒 Files selected for processing (2)
  • apps/platform/app/(platform)/organization-settings/components/OrganizationSettingsTab.tsx
  • apps/platform/app/(platform)/repositories/[repository]/settings/components/SettingsTab.tsx

@CloudM22 CloudM22 merged commit 1571f06 into main Jun 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants