Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds basic global feature flags #7459

Merged
merged 21 commits into from Mar 25, 2023
Merged

Adds basic global feature flags #7459

merged 21 commits into from Mar 25, 2023

Conversation

zomars
Copy link
Member

@zomars zomars commented Mar 2, 2023

What does this PR do?

  • Fixes [CAL-1143] RFC: Feature Flags #7304
  • Adds basic global feature flags that allow us to
    • Disable sending emails (kill switch)
    • Enable Workflows (operational switch)
    • Enable Teams (operational switch)
    • Enable Webhooks (operational switch)

So far operational switches only hides the navigation bar. We still need to add more checks in the core logic.

TODO:

  • Allow checking flags per user (override globals/permissions)
  • Find more flags to add

Environment: Staging(main branch) / Production

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • As an admin user, go to /settings/admin/flags
  • Enable email kill switch, emails should not be sent anymore
  • Disable workflows, they should disappear from nav bar (TODO: Prevent accessing directly via URL)
  • Disable teams, they should disappear from nav bar (TODO: Prevent accessing directly via URL)
  • Disable webhooks, they should disappear from settings nav bar (TODO: Prevent accessing directly via URL)

Checklist

  • I haven't read the contributing guide
  • I haven't performed a self-review of my own code and corrected any misspellings
  • I haven't checked if my changes generate no new warnings
  • I haven't added tests that prove my fix is effective or that my feature works

@vercel
Copy link

vercel bot commented Mar 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
cal ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 24, 2023 at 0:20AM (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 24, 2023 at 0:20AM (UTC)

@github-actions github-actions bot added the ❗️ migrations contains migration files label Mar 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 233.22 KB (🟡 +161 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

New Page Added

The following page was added to the bundle from the code in this PR:

Page Size (compressed) First Load % of Budget (350 KB)
/settings/admin/flags 159.93 KB 393.15 KB 112.33%

Fifty-nine Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/[user] 103.33 KB 336.55 KB 96.16% (🟡 +0.03%)
/[user]/[type] 91.82 KB 325.04 KB 92.87% (🟡 +0.03%)
/[user]/[type]/embed 91.85 KB 325.07 KB 92.88% (🟡 +0.03%)
/[user]/book 183.23 KB 416.45 KB 118.99% (🟡 +0.03%)
/[user]/embed 103.4 KB 336.62 KB 96.18% (🟡 +0.03%)
/apps 167.05 KB 400.27 KB 114.36% (🟡 +0.05%)
/apps/[slug] 190.78 KB 424 KB 121.14% (🟡 +0.04%)
/apps/[slug]/[...pages] 392.19 KB 625.41 KB 178.69% (🟡 +0.04%)
/apps/categories 151.95 KB 385.17 KB 110.05% (🟡 +0.04%)
/apps/categories/[category] 155.82 KB 389.04 KB 111.15% (🟡 +0.05%)
/apps/installed/[category] 196.92 KB 430.14 KB 122.90% (🟡 +0.04%)
/auth/setup 79.41 KB 312.63 KB 89.32% (🟡 +0.03%)
/availability 155.16 KB 388.38 KB 110.97% (🟡 +0.04%)
/availability/[schedule] 271.87 KB 505.09 KB 144.31% (🟡 +0.04%)
/availability/troubleshoot 152.64 KB 385.86 KB 110.25% (🟡 +0.04%)
/booking/[uid] 123.42 KB 356.64 KB 101.90% (🟡 +0.03%)
/bookings/[status] 272.29 KB 505.51 KB 144.43% (🟡 +0.04%)
/d/[link]/[slug] 91.47 KB 324.69 KB 92.77% (🟡 +0.03%)
/d/[link]/[slug]/embed 91.5 KB 324.72 KB 92.78% (🟡 +0.03%)
/d/[link]/book 182.88 KB 416.1 KB 118.89% (🟡 +0.03%)
/event-types 349.19 KB 582.41 KB 166.40% (🟡 +0.05%)
/event-types/[type] 382.24 KB 615.46 KB 175.85% (🟡 +0.04%)
/getting-started/[[...step]] 302.9 KB 536.12 KB 153.18% (+/- <0.01%)
/insights 386.12 KB 619.34 KB 176.95% (🟡 +0.05%)
/more 151.58 KB 384.8 KB 109.94% (🟡 +0.04%)
/payment/[uid] 60.74 KB 293.96 KB 83.99% (🟡 +0.03%)
/settings/admin 157.03 KB 390.25 KB 111.50% (🟡 +0.05%)
/settings/admin/apps 165.72 KB 398.94 KB 113.98% (🟡 +0.05%)
/settings/admin/apps/[category] 165.7 KB 398.92 KB 113.98% (🟡 +0.05%)
/settings/admin/impersonation 157.32 KB 390.54 KB 111.58% (🟡 +0.05%)
/settings/billing 157.15 KB 390.37 KB 111.53% (🟡 +0.05%)
/settings/developer/api-keys 186.3 KB 419.52 KB 119.86% (🟡 +0.05%)
/settings/developer/webhooks 159.64 KB 392.86 KB 112.24% (🟡 +0.05%)
/settings/developer/webhooks/[id] 190.49 KB 423.71 KB 121.06% (🟡 +0.05%)
/settings/developer/webhooks/new 190.35 KB 423.57 KB 121.02% (🟡 +0.05%)
/settings/my-account/appearance 171.11 KB 404.33 KB 115.52% (🟡 +0.05%)
/settings/my-account/calendars 191.33 KB 424.55 KB 121.30% (🟡 +0.05%)
/settings/my-account/conferencing 162.91 KB 396.13 KB 113.18% (🟡 +0.05%)
/settings/my-account/general 266.21 KB 499.43 KB 142.69% (🟡 +0.05%)
/settings/my-account/profile 274.19 KB 507.41 KB 144.98% (🟡 +0.04%)
/settings/security/impersonation 159.19 KB 392.41 KB 112.12% (🟡 +0.04%)
/settings/security/password 192.48 KB 425.7 KB 121.63% (🟡 +0.04%)
/settings/security/sso 166.88 KB 400.1 KB 114.31% (🟡 +0.05%)
/settings/security/two-factor-auth 161.64 KB 394.86 KB 112.82% (🟡 +0.04%)
/settings/teams 156.78 KB 390 KB 111.43% (🟡 +0.04%)
/settings/teams/[id]/appearance 171.13 KB 404.35 KB 115.53% (🟡 +0.05%)
/settings/teams/[id]/billing 157.01 KB 390.23 KB 111.50% (🟡 +0.04%)
/settings/teams/[id]/members 296.92 KB 530.14 KB 151.47% (🟡 +0.05%)
/settings/teams/[id]/profile 269.4 KB 502.62 KB 143.61% (🟡 +0.04%)
/settings/teams/[id]/sso 166.97 KB 400.19 KB 114.34% (🟡 +0.05%)
/settings/teams/new 92.67 KB 325.89 KB 93.11% (🟡 +0.03%)
/team/[slug] 105.87 KB 339.09 KB 96.88% (🟡 +0.03%)
/team/[slug]/[type] 91.47 KB 324.69 KB 92.77% (🟡 +0.03%)
/team/[slug]/[type]/embed 91.5 KB 324.72 KB 92.78% (🟡 +0.03%)
/team/[slug]/book 182.89 KB 416.11 KB 118.89% (🟡 +0.03%)
/team/[slug]/embed 105.94 KB 339.16 KB 96.90% (🟡 +0.03%)
/teams 151.79 KB 385.01 KB 110.00% (🟡 +0.05%)
/workflows 164.69 KB 397.91 KB 113.69% (🟡 +0.04%)
/workflows/[workflow] 293.88 KB 527.1 KB 150.60% (🟡 +0.04%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@zomars zomars added the docs area: docs, documentation, cal.com/docs label Mar 3, 2023
@zomars zomars changed the title Adds basic feature flag model Adds basic global feature flags Mar 3, 2023
@zomars zomars marked this pull request as ready for review March 3, 2023 20:40
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
@roae
Copy link
Contributor

roae commented Mar 23, 2023

@zomars what is the reason for this increase in page size?

imagen

@zomars
Copy link
Member Author

zomars commented Mar 23, 2023

@zomars what is the reason for this increase in page size?

imagen

That's a good question. I can't seem to find a specific reason. Will analyze locally.

@zomars zomars closed this Mar 24, 2023
@zomars zomars reopened this Mar 24, 2023
@zomars
Copy link
Member Author

zomars commented Mar 24, 2023

@zomars what is the reason for this increase in page size?
imagen

That's a good question. I can't seem to find a specific reason. Will analyze locally.

@roae seems like the bundle size normalized itself 🤔

Copy link
Contributor

@roae roae left a comment

Choose a reason for hiding this comment

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

It works for me, It's a solid start!

export const FlagListingView = () => {
return (
<>
<Meta title="Feature Flags" description="Here you can toggle your Cal.com instance features." />
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: translation

teams: boolean;
webhooks: boolean;
workflows: boolean;
"booking-page-v2": boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we improve this to be v2-booking-page? As mentioned in a example down below v2-workflows

Copy link
Contributor

@alannnc alannnc left a comment

Choose a reason for hiding this comment

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

Code looks clean! Excited about this.
Worked for me

@zomars zomars merged commit 69491d5 into main Mar 25, 2023
20 of 34 checks passed
@zomars zomars deleted the feature/flags branch March 25, 2023 00:59
@alishaz-polymath alishaz-polymath removed the docs area: docs, documentation, cal.com/docs label Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗️ migrations contains migration files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-1143] RFC: Feature Flags
7 participants