Skip to content

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

Merged
brendan-kellam merged 3 commits intosourcebot-dev:mainfrom
drew-u410:drew/set_require_new_via_config_option
Feb 5, 2026
Merged

[config] new env var: REQUIRE_APPROVAL_NEW_MEMBERS to set requiring…#858
brendan-kellam merged 3 commits 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.
image

Summary by CodeRabbit

  • New Features

    • Add an environment-variable option to require approval for new members; when set the UI toggle is disabled and reflects the env setting.
    • Initialization now synchronizes single-tenant orgs to honor the env-driven approval setting on startup.
  • Documentation

    • Updated configuration docs to describe the new environment variable and its effect on the UI.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a REQUIRE_APPROVAL_NEW_MEMBERS environment variable and server schema entry, synchronizes single-tenant org member-approval on init when set, disables the UI toggle and shows an informational message when the env var controls the setting, and updates docs and changelog.

Changes

Cohort / File(s) Summary
Changelog & Docs
CHANGELOG.md, docs/docs/configuration/auth/access-settings.mdx, docs/docs/configuration/environment-variables.mdx
Documented REQUIRE_APPROVAL_NEW_MEMBERS, its behavior, and that the UI toggle is disabled when the env var is set.
Server env schema
packages/shared/src/env.server.ts
Added optional boolean REQUIRE_APPROVAL_NEW_MEMBERS to the server environment schema export.
Initialization sync
packages/web/src/initialize.ts
On single-tenant init, read REQUIRE_APPROVAL_NEW_MEMBERS; if defined, fetch the org and update memberApprovalRequired to match the env var when different, logging the change.
UI components
packages/web/src/app/components/memberApprovalRequiredToggle.tsx, packages/web/src/app/components/organizationAccessSettings.tsx, packages/web/src/app/components/organizationAccessSettingsWrapper.tsx
Propagated a flag (isControlledByEnvVar / memberApprovalEnvVarSet) to disable the member-approval toggle, apply disabled styling, and render an informational message when controlled by the env var.
Misc docs
CLAUDE.md
Added a Tailwind CSS guidance section (documentation-only).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Init as Initialization
participant Env as Env (REQUIRE_APPROVAL_NEW_MEMBERS)
participant API as Org API / DB
Init->>Env: Read REQUIRE_APPROVAL_NEW_MEMBERS
alt Env var defined
Init->>API: Fetch org by SINGLE_TENANT_ORG_DOMAIN
API-->>Init: Org data (memberApprovalRequired)
alt value differs
Init->>API: Update org.memberApprovalRequired to env value
API-->>Init: Update confirmation
Init->>Init: Log change
else no change
Init-->>Init: No-op
end
else Env var not defined
Init-->>Init: No env-driven sync
end

mermaid
sequenceDiagram
participant Browser as Browser UI
participant Web as Web App Components
participant Env as Server Env
Browser->>Web: Render Access Settings
Web->>Env: Query memberApprovalEnvVarSet
alt env var set
Web-->>Browser: Render disabled toggle + informational message
else env var not set
Web-->>Browser: Render interactive toggle (normal flow)
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 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
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a new environment variable REQUIRE_APPROVAL_NEW_MEMBERS to configure member approval requirements.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

brendan-kellam and others added 2 commits February 5, 2026 14:52
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@brendan-kellam brendan-kellam merged commit fec4211 into sourcebot-dev:main Feb 5, 2026
5 of 7 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