Skip to content

fix(self-hosted): misc. visbility checks#5675

Closed
icecrasher321 wants to merge 3 commits into
stagingfrom
staging-v1
Closed

fix(self-hosted): misc. visbility checks#5675
icecrasher321 wants to merge 3 commits into
stagingfrom
staging-v1

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add tests for section visibility + env var checks. Match server side behavior.

Type of Change

  • Code cleanup

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 14, 2026 3:41pm

Request Review

@cursor

cursor Bot commented Jul 14, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes client-side gating for billing, organizations, and access control plus workspace settings navigation; misconfigured NEXT_PUBLIC_* twins could desync UI from server behavior.

Overview
Fixes self-hosted deployments showing settings links and feature flags that the server would block or that never apply off hosted Sim.

Account Chat keys (copilot) is hidden in the standalone account settings shell and redirects to General when the section URL is hit on non-hosted installs, matching requiresHosted in the registry.

Workspace settings sidebar now derives org-plane unified sections from SETTINGS_SECTION_REGISTRY via ORGANIZATION_PLANE_UNIFIED_SECTIONS and hides those items for viewers who are not host-org admins when selfHostedOverride applies—aligned with the organization gate on the workspace settings page so non-admins do not get dead links.

Client env flags for isBillingEnabled, isAccessControlEnabled, and isOrganizationsEnabled read NEXT_PUBLIC_* twins in the browser (server-only vars were always undefined client-side), with docs noting both vars must be set together.

Agent block API-key visibility uses new isOllamaAvailable() so browser code treats Ollama as configured when the providers store lists Ollama models, not only when server OLLAMA_URL is set.

Adds a navigation test asserting the org-plane unified section set from the registry.

Reviewed by Cursor Bugbot for commit 2c20b79. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR tightens settings visibility for self-hosted and client-side configuration paths. The main changes are:

  • Added account Copilot redirects and sidebar filtering for non-hosted deployments.
  • Derived organization-plane settings sections from the shared registry.
  • Updated browser env flag reads to use NEXT_PUBLIC_* runtime values.
  • Used the provider store to detect browser-side Ollama availability.
  • Added tests for organization-plane section derivation.

Confidence Score: 4/5

The self-hosted Billing sidebar path needs a fix before merging.

  • Non-org-admin workspace users can see a Billing link that the server page rejects.
  • The env flag and Ollama visibility changes look consistent with the inspected callers.
  • The remaining issue is contained to settings navigation visibility.

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx Adds self-hosted organization-plane filtering, but misses Billing because Billing does not use the self-hosted override branch.
apps/sim/components/settings/navigation.ts Adds a derived set for organization-plane unified settings sections.
apps/sim/lib/core/config/env-flags.ts Splits browser and server reads for billing, access-control, and organization env flags.
apps/sim/blocks/utils.ts Adds browser-side Ollama availability detection through the provider store.
apps/sim/app/account/settings/[section]/page.tsx Adds a server redirect for Copilot settings on non-hosted deployments.
apps/sim/components/settings/standalone-settings-shell.tsx Hides account Copilot settings from the standalone shell on non-hosted deployments.
apps/sim/components/settings/navigation.test.ts Adds coverage for the derived organization-plane settings set.

Reviews (1): Last reviewed commit: "add tests" | Re-trigger Greptile

* which 404s other viewers — mirror it here so the item never links to
* a dead page.
*/
if (ORGANIZATION_PLANE_UNIFIED_SECTIONS.has(item.id) && !isOrgAdminOrOwner) {

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.

P1 Billing Link Reaches 404

On self-hosted instances with billing enabled and a host organization configured, Billing is still shown to non-org-admin workspace users because it is an organization-plane section without selfHostedOverride, so this branch never checks it. The workspace settings page routes Billing through the host-organization admin gate, so clicking the visible sidebar item opens a 404.

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