Skip to content

improvement(enterprise): slack wizard UI, enterprise docs, data retention updates#4241

Merged
waleedlatif1 merged 12 commits intostagingfrom
fix/slack-ui
Apr 21, 2026
Merged

improvement(enterprise): slack wizard UI, enterprise docs, data retention updates#4241
waleedlatif1 merged 12 commits intostagingfrom
fix/slack-ui

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Updated Slack setup wizard UI and base wizard component styling
  • Added enterprise docs pages: Access Control, Audit Logs, Whitelabeling, Data Retention (with screenshot)
  • Updated data retention settings UI styling and increased retention limits
  • Added data retention skeleton component
  • Aligned data retention feature flags with other enterprise features in navigation and feature-flags config
  • Fixed recently-deleted settings component

Type of Change

  • Improvement (non-breaking change that improves existing functionality)

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
Copy link
Copy Markdown

vercel bot commented Apr 21, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 21, 2026 6:14am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 21, 2026

PR Summary

Medium Risk
Touches retention policy defaults and relaxes plan checks when billing is disabled, which can change data deletion behavior and feature exposure in self-hosted environments; remaining changes are mostly UI/docs.

Overview
Adds new Enterprise docs pages for Access Control, Audit Logs, Whitelabeling, and Data Retention, updates the Enterprise meta.json nav, and enhances the SSO doc with an inline screenshot.

Updates Data Retention behavior and UX: non-enterprise cleanup defaults are increased (cleanup-logs to 30 days; cleanup-soft-deletes to 30/90 days), the settings UI is restyled (combobox selectors, save button only enabled on changes, toast-based feedback) and gets a dedicated DataRetentionSkeleton, and the API/plan gating now treats self-hosted (billing disabled) as enterprise and skips the enterprise-plan check.

Improves enterprise settings consistency by introducing a shared SettingRow component, adding DATA_RETENTION_ENABLED / NEXT_PUBLIC_DATA_RETENTION_ENABLED feature flags and wiring them into settings navigation, plus small UI fixes/tweaks in Recently Deleted, the Slack setup wizard, and the base Wizard progress header.

Reviewed by Cursor Bugbot for commit 5c671b7. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 21, 2026

Greptile Summary

This PR polishes the enterprise settings surface: it updates the Slack setup wizard UI, adds enterprise doc pages (Access Control, Audit Logs, Whitelabeling, Data Retention), extracts a shared SettingRow component, adds a DataRetentionSkeleton, aligns data-retention navigation flags with other enterprise features, and fixes the recently-deleted settings container height. It also wires up a self-hosted bypass (DATA_RETENTION_ENABLED / isBillingEnabled guard) so non-billed deployments can configure data retention.

  • The self-hosted bypass in the API route (route.ts) correctly unlocks GET and PUT for non-billed instances, but dispatchCleanupJobs in cleanup-dispatcher.ts still queries enterprise workspaces via an INNER JOIN on subscription filtered to plan = 'enterprise' — a self-hosted instance has no subscription rows, so the configured retention values are saved but cleanup jobs are never dispatched.

Confidence Score: 4/5

Safe to merge with the understanding that self-hosted data-retention cleanup will be silently inoperative until the dispatcher is fixed.

The UI, API route, feature flag, navigation, and skeleton changes are all clean and the two prior review comments (shared SettingRow, recently-deleted h-full) are resolved. The one remaining P1 is in cleanup-dispatcher.ts: self-hosted workspaces that configure retention values won't have cleanup jobs dispatched because the enterprise-rows query still requires a subscription record, which won't exist when billing is disabled.

apps/sim/lib/billing/cleanup-dispatcher.ts — the enterprise workspace query needs an isBillingEnabled guard to handle self-hosted instances.

Important Files Changed

Filename Overview
apps/sim/lib/billing/cleanup-dispatcher.ts Enterprise cleanup job dispatch still requires a subscription record; self-hosted workspaces with configured retention will never have their data cleaned up.
apps/sim/app/api/workspaces/[id]/data-retention/route.ts Correctly bypasses the enterprise gate for GET (returns enterprise-level data) and PUT (skips subscription check) when billing is disabled. MAX_HOURS increased to 43800 (5 years) matching the UI.
apps/sim/ee/data-retention/components/data-retention-settings.tsx Now uses shared SettingRow, adds formInitialized guard to prevent form reset after save, and shows correct UI for non-enterprise/non-admin cases.
apps/sim/ee/components/setting-row.tsx Extracted shared SettingRow component, resolving the previous review comment about duplication between data-retention and whitelabeling settings.
apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx Adds recently-deleted to the flex h-full flex-col condition (addressing previous review comment) and wires up DataRetentionSkeleton.
apps/sim/app/workspace/[workspaceId]/settings/navigation.ts Aligns data-retention nav item with other enterprise features: requiresHosted, requiresEnterprise, selfHostedOverride, and adds showWhenLocked.
apps/sim/ee/data-retention/components/data-retention-skeleton.tsx New skeleton component that correctly mirrors the data-retention-settings layout.
packages/testing/src/mocks/feature-flags.mock.ts Adds isDataRetentionEnabled: false to the test mock, keeping it in sync with the new feature flag.

Sequence Diagram

sequenceDiagram
    participant Admin as Workspace Admin
    participant UI as DataRetentionSettings
    participant API as PUT /data-retention
    participant DB as Database
    participant Cron as Cron Job
    participant Dispatcher as dispatchCleanupJobs

    Admin->>UI: Configure retention values
    UI->>API: PUT retention settings
    API->>API: isBillingEnabled? skip enterprise check
    API->>DB: Save retention values ✓

    Note over Cron,Dispatcher: Cleanup flow (self-hosted issue)
    Cron->>Dispatcher: dispatchCleanupJobs(jobType)
    Dispatcher->>DB: SELECT workspaces INNER JOIN subscription WHERE plan='enterprise'
    DB-->>Dispatcher: [] (no subscription rows on self-hosted)
    Dispatcher-->>Cron: enterpriseCount=0, no jobs dispatched ✗

    Note over Dispatcher: Saved retention values are never enforced
Loading

Comments Outside Diff (1)

  1. apps/sim/lib/billing/cleanup-dispatcher.ts, line 218-231 (link)

    P1 Self-hosted workspaces never get cleanup jobs dispatched

    When isBillingEnabled is false, any workspace can now save custom retention values (the PUT endpoint was fixed in this PR). However, dispatchCleanupJobs still uses an INNER JOIN on subscription filtered to plan = 'enterprise'. A self-hosted instance has no subscription rows, so enterpriseRows will always be empty and no cleanup jobs are ever enqueued — even though the DB has non-null retention column values.

    Self-hosted admins will see their settings saved and displayed correctly, but data will never actually be purged according to those retention policies.

    The fix needs to short-circuit to a different query path when billing is disabled:

    import { isBillingEnabled } from '@/lib/core/config/feature-flags'
    
    // … inside dispatchCleanupJobs, replacing the current enterpriseRows query:
    
    let enterpriseRows: { id: string }[]
    if (!isBillingEnabled) {
      // Self-hosted: any workspace that has set a custom retention value is "enterprise"
      enterpriseRows = await db
        .select({ id: workspace.id })
        .from(workspace)
        .where(and(isNull(workspace.archivedAt), isNotNull(retentionCol)))
    } else {
      enterpriseRows = await db
        .select({ id: workspace.id })
        .from(workspace)
        .innerJoin(
          subscription,
          and(
            eq(subscription.referenceId, workspace.billedAccountUserId),
            inArray(subscription.status, ENTITLED_SUBSCRIPTION_STATUSES),
            eq(subscription.plan, 'enterprise')
          )
        )
        .where(and(isNull(workspace.archivedAt), isNotNull(retentionCol)))
        .groupBy(workspace.id)
    }

Reviews (5): Last reviewed commit: "fix(data-retention): bypass enterprise g..." | Re-trigger Greptile

Comment thread apps/sim/ee/whitelabeling/components/whitelabeling-settings.tsx Outdated
…red SettingRow, toast UX, stale form fix, emcn tokens
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

Addressed both Greptile comments in commit 2211363:

P1 — h-full for recently-deleted: Added recently-deleted alongside access-control in the cn() condition on the settings container div. Both sections now get flex h-full flex-col so the scroll area works correctly.

P2 — Duplicated SettingRow: Extracted to apps/sim/ee/components/setting-row.tsx and updated both data-retention-settings.tsx and whitelabeling-settings.tsx to import from that shared location. Visual parity is now enforced at the source.

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/core/config/feature-flags.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/core/config/feature-flags.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/workspace/[workspaceId]/settings/navigation.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5c671b7. Configure here.

@waleedlatif1 waleedlatif1 merged commit 0e1ff0a into staging Apr 21, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/slack-ui branch April 21, 2026 06:24
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