Skip to content

[config] new env var: REQUIRE_APPROVAL_NEW_MEMBERS to set requiring…#858

Open
drew-u410 wants to merge 1 commit intosourcebot-dev:mainfrom
drew-u410:drew/set_require_new_via_config_option
Open

[config] new env var: REQUIRE_APPROVAL_NEW_MEMBERS to set requiring…#858
drew-u410 wants to merge 1 commit intosourcebot-dev:mainfrom
drew-u410:drew/set_require_new_via_config_option

Conversation

@drew-u410
Copy link
Contributor

@drew-u410 drew-u410 commented Feb 5, 2026

  • Adds REQUIRE_APPROVAL_NEW_MEMBERS so that this can be set via config vs. UI toggle on each upgrade/deployment.
  • Respects UI toggle if not set. If set, disables UI toggle.

Summary by CodeRabbit

  • New Features

    • Added environment variable configuration option to control member approval requirements
    • Access settings interface now displays when this setting is managed by environment variable
  • Documentation

    • Updated configuration guides to document the new environment variable and its effect on the UI

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Walkthrough

This PR adds environment variable control for the member approval requirement setting. It introduces a new REQUIRE_APPROVAL_NEW_MEMBERS environment variable that allows admins to enforce the member approval policy at the application level. When set, the environment variable controls the setting and disables the UI toggle. The change includes documentation updates, environment schema definition, UI component modifications, and initialization synchronization logic.

Changes

Cohort / File(s) Summary
Documentation & Changelog
CHANGELOG.md, docs/docs/configuration/auth/access-settings.mdx, docs/docs/configuration/environment-variables.mdx
Updated documentation to reflect the new REQUIRE_APPROVAL_NEW_MEMBERS environment variable as an alternative configuration method via Settings → Access, and documented its behavior and UI disable behavior when set.
Environment Schema
packages/shared/src/env.server.ts
Added optional boolean schema entry for REQUIRE_APPROVAL_NEW_MEMBERS environment variable to the server environment configuration.
UI Components
packages/web/src/app/components/memberApprovalRequiredToggle.tsx, packages/web/src/app/components/organizationAccessSettings.tsx, packages/web/src/app/components/organizationAccessSettingsWrapper.tsx
Enhanced components to accept and propagate isControlledByEnvVar prop through the component hierarchy. When environment variable is set, the toggle is disabled and an informational message is displayed.
Initialization Sync
packages/web/src/initialize.ts
Added synchronization logic to check the REQUIRE_APPROVAL_NEW_MEMBERS environment variable during initialization and update the organization's memberApprovalRequired setting if necessary.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • msukkari
🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding a new environment variable REQUIRE_APPROVAL_NEW_MEMBERS to configure member approval requirements.

✏️ 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

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Around line 8-9: The changelog entry for "Added support to set 'Require
approval for new members' via config (`REQUIRE_APPROVAL_NEW_MEMBERS`)" is
missing a category header; move or insert this bullet under the existing "###
Added" subsection within the Unreleased section so it follows the project's
changelog conventions (use the exact header text "### Added" and keep the
current bullet content intact).

Comment on lines 8 to +9
## [Unreleased]
- Added support to set "Require approval for new members" via config with (`REQUIRE_APPROVAL_NEW_MEMBERS`). [#858](https://github.com/sourcebot-dev/sourcebot/pull/858)
Copy link
Contributor

@coderabbitai coderabbitai bot Feb 5, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing category header for changelog entry.

The changelog entry should be placed under an ### Added header to follow the existing conventions. All other entries in the file are categorized under headers like ### Added, ### Fixed, ### Changed, etc.

📝 Suggested fix
 ## [Unreleased]
+
+### Added
 - Added support to set "Require approval for new members" via config with (`REQUIRE_APPROVAL_NEW_MEMBERS`). [`#858`](https://github.com/sourcebot-dev/sourcebot/pull/858)

As per coding guidelines, entries must be parented under a header (Added, Changed, Deprecated, Removed, Fixed, or Security).

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

Suggested change
## [Unreleased]
- Added support to set "Require approval for new members" via config with (`REQUIRE_APPROVAL_NEW_MEMBERS`). [#858](https://github.com/sourcebot-dev/sourcebot/pull/858)
## [Unreleased]
### Added
- Added support to set "Require approval for new members" via config with (`REQUIRE_APPROVAL_NEW_MEMBERS`). [`#858`](https://github.com/sourcebot-dev/sourcebot/pull/858)
🤖 Prompt for AI Agents
In `@CHANGELOG.md` around lines 8 - 9, The changelog entry for "Added support to
set 'Require approval for new members' via config
(`REQUIRE_APPROVAL_NEW_MEMBERS`)" is missing a category header; move or insert
this bullet under the existing "### Added" subsection within the Unreleased
section so it follows the project's changelog conventions (use the exact header
text "### Added" and keep the current bullet content intact).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to move but this is unreleased. Silly AI?

Copy link
Contributor

Choose a reason for hiding this comment

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

@drew-u410, I understand the confusion! Let me clarify: "Unreleased" is the version section (like "4.10.27" or "4.10.26"), not a category. Even within the Unreleased section, entries still need to be organized under category headers like ### Added, ### Fixed, ### Changed, etc.

This follows the Keep a Changelog format that the project uses. Looking at the file, you can see that every other version section has category headers organizing the changes.

So the structure should be:

## [Unreleased]

### Added
- Added support to set "Require approval for new members" via config...

Not a silly suggestion at all—just following the established conventions! 😊


🧠 Learnings used
Learnt from: CR
Repo: sourcebot-dev/sourcebot PR: 0
File: .cursor/rules/cloud_agent.mdc:0-0
Timestamp: 2025-12-29T18:02:55.419Z
Learning: Applies to CHANGELOG.md : After creating a GitHub PR, create a follow-up commit with a Changelog entry in CHANGELOG.md with a short description of the change. Follow the existing conventions: entries must be parented under a header (Added, Changed, Deprecated, Removed, Fixed, or Security), and entries must include the GitHub pull request id at the end of the line, formatted as [#<id>](<url>)

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.

1 participant