cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

chore: Chore team metadata table + isOrganization migration from metadata

Open sean-brydon opened this issue 2 years ago • 6 comments

What does this PR do?

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] Chore (refactoring code, technical debt, workflow improvements)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [X] Tests (Unit/Integration/E2E or any other test)
  • [ ] This change requires a documentation update

How should this be tested?

  1. Seed the database
  2. Connect to DB
  3. UPDATE "Team" SET "metadata" = '{"isOrganization": "true", "isOrganizationConfigured": "true", "orgAutoAcceptEmail": "[email protected]", "isOrganizationVerified": "false"}' WHERE "id" in (1,2,3); UPDATE "Team" SET "isOrganization" = true WHERE "id" in (1,2,3);
  4. Run SQL above to set metadata
  5. Run migrations - ensure migrations have ran successfully and each team in the above query has a OrganizationSettings table associated with it

Mandatory Tasks

  • [ ] Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my PR needs changes to the documentation
  • 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
  • I haven't checked if new and existing unit tests pass locally with my changes

sean-brydon avatar Dec 16 '23 09:12 sean-brydon

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

Name Status Preview Comments Updated (UTC)
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 16, 2024 10:08am
dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 16, 2024 10:08am
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2024 10:08am
cal ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2024 10:08am
cal-demo ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2024 10:08am
qa ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2024 10:08am
ui ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2024 10:08am

vercel[bot] avatar Dec 16 '23 09:12 vercel[bot]

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

github-actions[bot] avatar Dec 16 '23 09:12 github-actions[bot]

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Three 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)
/insights 465.62 KB 630.43 KB 180.12% (🟢 -2.15%)
/settings/teams/[id]/members 372.63 KB 537.43 KB 153.55% (🟢 -1.96%)
/workflows 278.42 KB 443.22 KB 126.64% (🟢 -2.13%)
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 "+/-

github-actions[bot] avatar Dec 16 '23 09:12 github-actions[bot]

Current Playwright Test Results Summary

✅ 380 Passing - ⚠️ 17 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 01/16/2024 10:16:04am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 905cffb3536275ab31462ea46ee365bf81744ef3

Started: 01/16/2024 10:04:22am UTC

⚠️ Flakes

📄   apps/web/playwright/booking/radioGroupQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Radio Question and Each Other Question Booking With Radio Question and Address Question Booking With Radio Question and Long text Question Radio required and Long text required
Retry 1Initial Attempt
0% (0) 0 / 361 runs
failed over last 7 days
2.49% (9) 9 / 361 runs
flaked over last 7 days

📄   apps/web/playwright/booking/checkboxGroupQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Checkbox Group Question and Each Other Question Booking With Checkbox Group Question and Address Question Booking With Checkbox Group Question and Short text question Checkbox Group required and Short Text required
Retry 1Initial Attempt
0% (0) 0 / 362 runs
failed over last 7 days
1.66% (6) 6 / 362 runs
flaked over last 7 days

📄   apps/web/playwright/login.2fa.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
2FA Tests should allow a user to enable 2FA and login using 2FA
Retry 1Initial Attempt
0% (0) 0 / 263 runs
failed over last 7 days
35.74% (94) 94 / 263 runs
flaked over last 7 days

📄   apps/web/playwright/booking/availability.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Check availability tab in a event-type Check availability in event type
Retry 1Initial Attempt
27.27% (9) 9 / 33 runs
failed over last 7 days
30.30% (10) 10 / 33 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should be able to reschedule
Retry 1Initial Attempt
13.21% (51) 51 / 386 runs
failed over last 7 days
82.38% (318) 318 / 386 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1Initial Attempt
2.86% (11) 11 / 385 runs
failed over last 7 days
76.62% (295) 295 / 385 runs
flaked over last 7 days

📄   apps/web/playwright/booking/multipleEmailQuestion.e2e.ts • 3 Flakes

Top 1 Common Error Messages

null

3 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Multiple Email Question and Each Other Question Booking With Multiple Email Question and checkbox Question Multiple Email and checkbox not required
Retry 1Initial Attempt
0% (0) 0 / 367 runs
failed over last 7 days
3% (11) 11 / 367 runs
flaked over last 7 days
Booking With Multiple Email Question and Each Other Question Booking With Multiple Email Question and Radio group Question Multiple Email required and Radio group required
Retry 1Initial Attempt
0.27% (1) 1 / 364 run
failed over last 7 days
3.02% (11) 11 / 364 runs
flaked over last 7 days
Booking With Multiple Email Question and Each Other Question Booking With Multiple Email Question and Radio group Question Multiple Email and Radio group not required
Retry 1Initial Attempt
0.27% (1) 1 / 364 run
failed over last 7 days
2.75% (10) 10 / 364 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/inline.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Inline Iframe Inline Iframe - Configured with Dark Theme
Retry 1Initial Attempt
2.29% (9) 9 / 393 runs
failed over last 7 days
33.08% (130) 130 / 393 runs
flaked over last 7 days

📄   apps/web/playwright/event-types.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests user -- future Different Locations Tests can select 'display on booking page' option when multiple organizer input type are present
Retry 1Initial Attempt
0% (0) 0 / 377 runs
failed over last 7 days
3.45% (13) 13 / 377 runs
flaked over last 7 days

📄   apps/web/playwright/organization/organization-invitation.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Organization Email not matching orgAutoAcceptEmail Org Invitation
Retry 1Initial Attempt
2.33% (9) 9 / 387 runs
failed over last 7 days
12.92% (50) 50 / 387 runs
flaked over last 7 days

📄   apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Address Question and Each Other Question Booking With Address Question and Multi email Question Address required and Multi email required
Retry 1Initial Attempt
0.53% (2) 2 / 375 runs
failed over last 7 days
1.07% (4) 4 / 375 runs
flaked over last 7 days

📄   apps/web/playwright/oauth-provider.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
OAuth Provider should create valid access token & refresh token for team
Retry 1Initial Attempt
0% (0) 0 / 391 runs
failed over last 7 days
17.39% (68) 68 / 391 runs
flaked over last 7 days

📄   apps/web/playwright/embed-code-generator.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Embed Code Generator Tests Non-Organization Event Types Page open Embed Dialog and choose Inline for First Event Type
Retry 1Initial Attempt
0.25% (1) 1 / 399 run
failed over last 7 days
4.26% (17) 17 / 399 runs
flaked over last 7 days

📄   packages/app-store/routing-forms/playwright/tests/basic.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Routing Forms Seeded Routing Form Router URL should work
Retry 1Initial Attempt
0.25% (1) 1 / 395 run
failed over last 7 days
12.15% (48) 48 / 395 runs
flaked over last 7 days
Routing Forms Seeded Routing Form Routing Link should validate fields
Retry 1Initial Attempt
0.51% (2) 2 / 395 runs
failed over last 7 days
10.63% (42) 42 / 395 runs
flaked over last 7 days

View Detailed Build Results


deploysentinel[bot] avatar Dec 28 '23 12:12 deploysentinel[bot]

oh nice! metadata as json was a bad idea from the get go. great job refactoring!

PeerRich avatar Dec 29 '23 18:12 PeerRich

Note : e2e suite has some failing test but it isn’t shown with the new changes

sean-brydon avatar Dec 29 '23 22:12 sean-brydon

Heads up. the migration in this PR is failing on prod. Blocking the latest release.

zomars avatar Jan 16 '24 19:01 zomars

@calcom/foundation @sean-brydon had to revert this PR due to migration not being compatible with actual prod data. Causing it to fail.

zomars avatar Jan 16 '24 19:01 zomars

From internal chat:

... parentId isn't being taking into account for the new unique constrain just slug and isOrganization So one of those is a subteam and another one is a stantalone team (non-org) with slug "advisors". Both have metadata→isOrganization as null/false. The former because is a subteam in an org and the latter because is not on an org. Hence the conflict.

zomars avatar Jan 16 '24 19:01 zomars