Skip to content

feat: bypass pre versioning scaleup unlimited audit and feature visibility#7497

Open
Zaimwa9 wants to merge 8 commits into
mainfrom
fix/remove-scale-up-extra-audit-and-feature-visibility
Open

feat: bypass pre versioning scaleup unlimited audit and feature visibility#7497
Zaimwa9 wants to merge 8 commits into
mainfrom
fix/remove-scale-up-extra-audit-and-feature-visibility

Conversation

@Zaimwa9
Copy link
Copy Markdown
Contributor

@Zaimwa9 Zaimwa9 commented May 12, 2026

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

  • scale-up-v4 plans branch out of the VERSIONING_RELEASE_DATE to use the real subscription_metadata_cache related to audit log and feature history
  • Audit log and feature history were previously set to unlimited for old subscriptions

How did you test this code?

  • New tests

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner May 12, 2026 10:34
@Zaimwa9 Zaimwa9 requested review from gagantrivedi and removed request for a team May 12, 2026 10:34
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview May 12, 2026 4:45pm
flagsmith-frontend-preview Ignored Ignored Preview May 12, 2026 4:45pm
flagsmith-frontend-staging Ignored Ignored Preview May 12, 2026 4:45pm

Request Review

@github-actions github-actions Bot added the api Issue related to the REST API label May 12, 2026
@Zaimwa9 Zaimwa9 requested a review from matthewelwell May 12, 2026 10:35
@Zaimwa9 Zaimwa9 changed the title feat: bypass pre versioning scaleup grandfathering audit and feature visibility feat: bypass pre versioning scaleup unlimited audit and feature visibility May 12, 2026
@github-actions github-actions Bot added the feature New feature or request label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Docker builds report

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.46%. Comparing base (7a17c35) to head (8989b71).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7497      +/-   ##
==========================================
+ Coverage   98.44%   98.46%   +0.01%     
==========================================
  Files        1399     1398       -1     
  Lines       52669    52666       -3     
==========================================
+ Hits        51849    51856       +7     
+ Misses        820      810      -10     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.8 seconds
commit  9ec8e6f
info  🔄 Run: #16700 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  41.8 seconds
commit  9ec8e6f
info  🔄 Run: #16700 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  31.9 seconds
commit  279f95b
info  🔄 Run: #16699 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.4 seconds
commit  279f95b
info  🔄 Run: #16699 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 4 suites
duration  32.9 seconds
commit  279f95b
info  🔄 Run: #16699 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.8 seconds
commit  279f95b
info  🔄 Run: #16699 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  35.2 seconds
commit  ff0c611
info  🔄 Run: #16705 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  32.9 seconds
commit  ff0c611
info  🔄 Run: #16705 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.5 seconds
commit  ff0c611
info  🔄 Run: #16705 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  56.1 seconds
commit  ff0c611
info  🔄 Run: #16705 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  18 passed

Details

stats  18 tests across 14 suites
duration  1 minute, 11 seconds
commit  8989b71
info  🔄 Run: #16708 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  38.3 seconds
commit  8989b71
info  🔄 Run: #16708 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.6 seconds
commit  8989b71
info  🔄 Run: #16708 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  42.2 seconds
commit  8989b71
info  🔄 Run: #16708 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  39 seconds
commit  33b659b
info  🔄 Run: #16713 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  50.7 seconds
commit  33b659b
info  🔄 Run: #16713 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  37 seconds
commit  33b659b
info  🔄 Run: #16713 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  51.2 seconds
commit  33b659b
info  🔄 Run: #16713 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Visual Regression

16 screenshots compared. See report for details.
View full report

gagantrivedi
gagantrivedi previously approved these changes May 12, 2026
Copy link
Copy Markdown
Member

@gagantrivedi gagantrivedi left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread api/organisations/models.py Outdated
Comment thread api/organisations/models.py Outdated
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels May 12, 2026
Comment thread api/organisations/models.py Outdated

@property
def is_sub_before_versioning_release(self) -> bool:
return settings.VERSIONING_RELEASE_DATE is None or (
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.

Looks like this setting isn't actually populated in any of our deployments. Should it be?

Copy link
Copy Markdown
Contributor Author

@Zaimwa9 Zaimwa9 May 12, 2026

Choose a reason for hiding this comment

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

Ok then that explains everything. It depends how you see it, we could:

  1. Remove my new code, set the variable to a date up to which we give all previous advantages (2 weeks ago?)
  2. Remove the variable and keep previous advantages on versions below v4 (using the versioning you suggested below) ?

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.

I think (2) - I don't think the versioning release date should factor into this at all, right?

In my eyes, what we need to support is:

audit log history:

  • scale-up-v2 = unlimited
  • scale-up-v4+ = 14 days

version history:

  • scale-up-v2+ = 14 days

Copy link
Copy Markdown
Contributor Author

@Zaimwa9 Zaimwa9 May 12, 2026

Choose a reason for hiding this comment

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

All addressed in 33b659b

Comment thread api/organisations/models.py Outdated
Comment thread api/organisations/models.py Outdated
# feature history. Scale-Up v4 (and later) plans always honour the
# cache values.
is_scale_up = self.subscription_plan_family == SubscriptionPlanFamily.SCALE_UP
is_scale_up_v4 = (self.plan or "").startswith("scale-up-v4")
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.

Should we also try to do something smarter here and determine the version number of the plan to do an inequality check?

e.g. something like (but better):

scale_up_plan_version = int(re.match(r"scale-up-v([0-9]+)", "scale-up-v4").groups()[0])

Then we can change the conditional below to:

if is_scale_up and scale_up_plan_version < 4 and self.is_sub_before_versioning_release:

Copy link
Copy Markdown
Contributor Author

@Zaimwa9 Zaimwa9 May 12, 2026

Choose a reason for hiding this comment

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

Addressed in 33b659b

Co-authored-by: Matthew Elwell <matthew.elwell@flagsmith.com>
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels May 12, 2026
@Zaimwa9 Zaimwa9 requested a review from matthewelwell May 12, 2026 16:29
@github-actions github-actions Bot removed the feature New feature or request label May 12, 2026
@github-actions github-actions Bot added the feature New feature or request label May 12, 2026
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 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants