Skip to content

fix: Add migration to fix deleted themes when branch was deleted#14957

Merged
sharat87 merged 8 commits intoreleasefrom
fix/theme-deleted-when-delete-branch
Jul 27, 2022
Merged

fix: Add migration to fix deleted themes when branch was deleted#14957
sharat87 merged 8 commits intoreleasefrom
fix/theme-deleted-when-delete-branch

Conversation

@nayan-rafiq
Copy link
Copy Markdown
Contributor

@nayan-rafiq nayan-rafiq commented Jul 1, 2022

Description

Due to a bug, customized themes set to the parent branch where deleted when user deletes git branch. The bug has been fixed already. This PR adds a DB migration that fixes the data if there is any.

Fixes #15247

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Manually

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@nayan-rafiq nayan-rafiq self-assigned this Jul 1, 2022
@vercel
Copy link
Copy Markdown

vercel bot commented Jul 1, 2022

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

Name Status Preview Updated
appsmith ✅ Ready (Inspect) Visit Preview Jul 26, 2022 at 10:09AM (UTC)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 1, 2022

Unable to find test scripts. Please add necessary tests to the PR.

@nayan-rafiq nayan-rafiq force-pushed the fix/theme-deleted-when-delete-branch branch from 94ecbce to a6a0871 Compare July 3, 2022 11:32
@nayan-rafiq nayan-rafiq marked this pull request as ready for review July 3, 2022 11:33
@nayan-rafiq nayan-rafiq requested a review from abhvsn July 3, 2022 11:33
@nayan-rafiq nayan-rafiq added the Test Plan Approved Manual/Cypress tests covers changes made on the PR. Else, add skip-testPlan label if not applicable label Jul 3, 2022
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 3, 2022

Unable to find test scripts. Please add necessary tests to the PR.

1 similar comment
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 3, 2022

Unable to find test scripts. Please add necessary tests to the PR.

Criteria deletedCustomThemes = Criteria.where(fieldName(QTheme.theme.id)).in(set)
.and(fieldName(QTheme.theme.deleted)).is(true);

mongockTemplate.updateMulti(new Query(deletedCustomThemes), update, Theme.class);
Copy link
Copy Markdown
Contributor

@abhvsn abhvsn Jul 3, 2022

Choose a reason for hiding this comment

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

@nayan-rafiq the issue is happening when users have a custom theme with multiple branches and if any of the branches is deleted all the branches will end up in a broken state. This is happening because the same themeIds are referenced in all the branched applications, where we expect separate objects in Theme collection with separate themeIds for different branches. With the current migration, I'm not getting where are we inserting new documents in the Theme collection and updating the corresponding ids in the branched application object in DB. IIUC this migration will only revert the deleted custom themes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When user has customized the theme and created a new branch, the newly created branch have the same theme ids as parent branch (it should've been copied). Now, if user deletes the new branch, it deletes the themes as well. So, if we set deleted=false to those themes, would it not be enough? It'll be a problem if we've option to restore a deleted branch. Is that happening today?

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.

@nayan-rafiq consider user has already created 3 branches before we fixed the issue for the custom theme app. As per our expectation we should have 3 seperate theme ids attached to these apps which will not be the case. Now consider after we run the migration there won't be any change considering all the branches are still active.
In this scenario (after we run the migration) what will happen if user tries to delete the earlier branch (out of 3 branches created earlier)? As we are not checking if the theme id is being used in some other branch, it will get deleted and we will end up in same situation again.

@nayan-rafiq nayan-rafiq requested a review from AnaghHegde July 4, 2022 16:15
@github-actions
Copy link
Copy Markdown

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Jul 12, 2022
@github-actions
Copy link
Copy Markdown

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Jul 19, 2022
@AnaghHegde AnaghHegde reopened this Jul 20, 2022
@AnaghHegde AnaghHegde self-assigned this Jul 21, 2022
@github-actions github-actions bot added Critical This issue needs immediate attention. Drop everything else Git Product Issues related to version control product Needs Triaging Needs attention from maintainers to triage Platform Administration Pod Issues related to platform administration & management labels Jul 21, 2022
@AnaghHegde
Copy link
Copy Markdown
Contributor

/ok-to-test sha=1a29e4e

@github-actions
Copy link
Copy Markdown

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2713807557.
Workflow: Appsmith External Integration Test Workflow.
Commit: 1a29e4e.
PR: 14957.

@AnaghHegde AnaghHegde requested review from trishaanand and removed request for AnaghHegde July 21, 2022 18:14
@github-actions github-actions bot removed the Stale label Jul 22, 2022
@AnaghHegde AnaghHegde requested a review from mohanarpit July 26, 2022 10:09
@AnaghHegde
Copy link
Copy Markdown
Contributor

/ok-to-test sha=7b12b2a

@github-actions
Copy link
Copy Markdown

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/2738704052.
Workflow: Appsmith External Integration Test Workflow.
Commit: 7b12b2a.
PR: 14957.

@AnaghHegde AnaghHegde requested a review from abhvsn July 26, 2022 10:35
@github-actions
Copy link
Copy Markdown

UI Performance test run logs and artifacts: https://github.com/appsmithorg/appsmith/actions/runs/2738704052.
Commit: 7b12b2a.
Results:

Click to view performance test results

Run 1 Run 2 Run 3 Run 4 Run 5 Median Mean SD.Sample SD.Population
SELECT_CATEGORY
scripting 608.58 1334.03 565.23 612.48 577.72 608.58 739.61 45.01 40.26
painting 12.85 4.52 3.77 9.52 3.45 4.52 6.82 61.14 54.69
rendering 94.76 94.96 92.97 96.27 93.62 94.76 94.52 1.35 1.21
BIND_TABLE_DATA
scripting 2354.71 2274.59 2237.86 2252.34 2278.34 2274.59 2279.57 1.98 1.77
painting 13.41 14.63 15.04 5.74 15.37 14.63 12.84 31.46 28.12
rendering 682.38 713.17 680.95 691.85 713.47 691.85 696.36 2.30 2.06
CLICK_ON_TABLE_ROW
scripting 1280.25 1478 1345.03 1301.38 1429.44 1345.03 1366.82 6.18 5.53
painting 10.46 10.53 21.01 12.63 10.79 10.79 13.08 34.56 30.89
rendering 276.53 284.03 290.17 281.77 288.46 284.03 284.19 1.91 1.71
UPDATE_POST_TITLE
scripting 2472.85 2352.83 2441.55 2425.31 2404.99 2425.31 2419.51 1.85 1.66
painting 16.26 17.66 19.54 14.84 17.5 17.5 17.16 10.20 9.09
rendering 393.71 410.49 384.33 402.92 393.71 393.71 397.03 2.52 2.25
OPEN_MODAL
scripting 784.57 824.73 745.97 775.49 823.84 784.57 790.92 4.25 3.80
painting 9.14 9.79 9.69 9.56 8.4 9.56 9.32 6.12 5.47
rendering 309.06 318.3 299.56 303.41 307.89 307.89 307.64 2.29 2.05
CLOSE_MODAL
scripting 497.4 456.69 447.03 506.96 452.83 456.69 472.18 5.89 5.27
painting 4.43 4.5 4.05 4.88 4.81 4.5 4.53 7.28 6.62
rendering 488.36 506.52 459.15 473.26 483.75 483.75 482.21 3.66 3.27
SELECT_WIDGET_MENU_OPEN
scripting 1102.55 1101.16 1125.03 1116.05 1150.15 1116.05 1118.99 1.79 1.60
painting 7.26 6.64 6.99 8.83 5.2 6.99 6.98 18.62 16.62
rendering 494.38 483.02 479.04 499.35 498.22 494.38 490.8 1.88 1.68
SELECT_WIDGET_SELECT_OPTION
scripting 156.86 161.88 185.65 150.81 152.82 156.86 161.6 8.72 7.80
painting 3.16 5.57 2.29 3.71 12.4 3.71 5.43 75.14 67.22
rendering 12.12 11.45 15.47 11.19 11.21 11.45 12.29 14.81 13.26

@sharat87 sharat87 merged commit 9489484 into release Jul 27, 2022
@sharat87 sharat87 deleted the fix/theme-deleted-when-delete-branch branch July 27, 2022 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Critical This issue needs immediate attention. Drop everything else Git Product Issues related to version control product Needs Triaging Needs attention from maintainers to triage Platform Administration Pod Issues related to platform administration & management Test Plan Approved Manual/Cypress tests covers changes made on the PR. Else, add skip-testPlan label if not applicable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]-[4932]:Cannot read properties of undefined (reading 'properties')

5 participants