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

fix: audit and version limits for existing subscriptions #4780

Merged

Conversation

matthewelwell
Copy link
Contributor

Changes

After releasing #4433, I found an issue in testing where existing enterprise organisations are unable to view the audit log history.

This could have been solved in a number of ways:

  1. Using the existing VERSIONING_RELEASE_DATE setting that handles the same logic for scale up plans
  2. Manually updating the database in SaaS for all enterprise organisations
  3. Triggering CB webhooks for all current enterprise plans

I settled on writing a migration to handle it as it seemed the best solution. The reason I didn't do this for scale up plans, however, is that the scale up plans in chargebee have the values set for new subscriptions, which will overwrite the existing cache information every time a webhook is triggered related to a given subscription.

Unfortunately, this will mean that the data in the database for any scale up subscriptions before the VERSIONING_RELEASE_DATE will not match the actual behaviour for a given organisation, however, the alternative is creating a new scale up plan in chargebee with the new limits, etc. which seemed like more work than just coding around it.

How did you test this code?

Wrote a comprehensive migration test.

@matthewelwell matthewelwell requested a review from a team as a code owner October 29, 2024 12:14
@matthewelwell matthewelwell requested review from khvn26 and removed request for a team October 29, 2024 12:14
Copy link

vercel bot commented Oct 29, 2024

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Oct 29, 2024 0:14am
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Oct 29, 2024 0:14am
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Oct 29, 2024 0:14am

@github-actions github-actions bot added the api Issue related to the REST API label Oct 29, 2024
Copy link
Contributor

github-actions bot commented Oct 29, 2024

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-4780 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-4780 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-4780 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-4780 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4780 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4780 Finished ✅ Results

@github-actions github-actions bot added the fix label Oct 29, 2024
Copy link
Contributor

github-actions bot commented Oct 29, 2024

Uffizzi Preview deployment-57735 was deleted.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.30%. Comparing base (56a266d) to head (74ed8cc).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4780   +/-   ##
=======================================
  Coverage   97.30%   97.30%           
=======================================
  Files        1174     1175    +1     
  Lines       40846    40903   +57     
=======================================
+ Hits        39744    39801   +57     
  Misses       1102     1102           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matthewelwell matthewelwell added this pull request to the merge queue Oct 29, 2024
Merged via the queue into main with commit 5827e07 Oct 29, 2024
35 checks passed
@matthewelwell matthewelwell deleted the fix/audit-and-version-limits-for-existing-subscriptions branch October 29, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants