Skip to content

fix: match Scale-Up plan ids case-insensitively - #8249

Open
Holmus wants to merge 2 commits into
mainfrom
fix/scale-up-plan-id-case-insensitive
Open

fix: match Scale-Up plan ids case-insensitively#8249
Holmus wants to merge 2 commits into
mainfrom
fix/scale-up-plan-id-case-insensitive

Conversation

@Holmus

@Holmus Holmus commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Scale-Up returned as v4 with mixed-case Chargebee plan ids (Scale-Up-v4-USD-Yearly / Scale-Up-v4-USD-Monthly), but two plan-id checks still match case-sensitively:

  • Subscription.get_scaleup_plan_version() fails to match the v4 ids and falls back to version 1, so v4 Scale-Up organisations are treated as pre-v4 and keep unlimited audit log visibility (audit_log_visibility_days = None).
  • ReadOnlyIfNotValidPlanMixin compiles invalid_plans_regex case-sensitively, so ProjectCreateSerializer's scale-up.* gate misses v4 plans and the plan-gated project fields (stale_flags_limit_days, enable_realtime_updates) become writable for Scale-Up v4 organisations.

Both now match case-insensitively. Chargebee plan ids cannot be renamed, and SubscriptionPlanFamily.get_by_plan_id already normalises its input for exactly this reason — this brings the remaining two checks in line.

Part of #8074 (the two backend acceptance criteria in this repo; the stale-flags tagging item lives in flagsmith-private and the billing-page plan descriptions are a separate frontend change).

Test plan

  • Extended test_get_scaleup_plan_version__given_plan__returns_expected with the production v4 plan ids — fails without the fix.
  • Extended the ReadOnlyIfNotValidPlanMixin read-only parametrisation with a mixed-case plan id against the production regex from ProjectCreateSerializer.
  • Ran locally: 9/9 plan-version tests and 5/5 mixin tests pass.

🤖 Generated with Claude Code

@Holmus
Holmus requested a review from a team as a code owner August 10, 2026 13:03
@Holmus
Holmus requested review from khvn26 and removed request for a team August 10, 2026 13:03
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 10, 2026 1:08pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ignored Ignored Preview Aug 10, 2026 1:08pm
flagsmith-frontend-staging Ignored Ignored Preview Aug 10, 2026 1:08pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cec47580-4057-4c87-96ef-5985b080f2be

📥 Commits

Reviewing files that changed from the base of the PR and between 6ab7f51 and ae75e80.

📒 Files selected for processing (2)
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md
  • openapi.yaml

📝 Walkthrough

Walkthrough

Scale-Up plan version extraction now matches plan identifiers without regard to letter case. Invalid-plan regular expressions also use case-insensitive matching. Unit tests cover mixed-case yearly and monthly Scale-Up v4 identifiers and an invalid-plan expression. The event catalogue source line was corrected. OpenAPI URL schemas now include URI format and maximum length metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added api Issue related to the REST API fix labels Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

Scale-Up v4 Chargebee plan ids are mixed-case (Scale-Up-v4-USD-Yearly),
but get_scaleup_plan_version() and ReadOnlyIfNotValidPlanMixin matched
plan ids case-sensitively, so v4 organisations were treated as pre-v4
(unlimited audit log visibility) and plan-gated project fields became
writable.

Part of #8074.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Holmus
Holmus force-pushed the fix/scale-up-plan-id-case-insensitive branch from 3f96109 to 6ab7f51 Compare August 10, 2026 13:06
@github-actions github-actions Bot added fix and removed fix docs Documentation updates labels Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
✅ oss · depot-ubuntu-latest-16 — run #19151 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.2 seconds
commit  ae75e80
info  🔄 Run: #19151 (attempt 1)

🗂️ Previous results
✅ oss · depot-ubuntu-latest-arm-16 — run #19151 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  46.5 seconds
commit  ae75e80
info  🔄 Run: #19151 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19150 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  33 seconds
commit  6ab7f51
info  🔄 Run: #19150 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19150 (attempt 1)

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

passed  23 passed
skipped  1 skipped

Details

stats  24 tests across 18 suites
duration  1 minute, 22 seconds
commit  6ab7f51
info  🔄 Run: #19150 (attempt 1)

Skipped tests

firefox › tests/onboarding-tests.pw.ts › Onboarding › New user connects via the single-page onboarding flow @oss

✅ oss · depot-ubuntu-latest-arm-16 — run #19150 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  46.2 seconds
commit  6ab7f51
info  🔄 Run: #19150 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19150 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.1 seconds
commit  6ab7f51
info  🔄 Run: #19150 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19148 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.9 seconds
commit  2b08759
info  🔄 Run: #19148 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19148 (attempt 1)

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

passed  4 passed

Details

stats  4 tests across 4 suites
duration  35.1 seconds
commit  2b08759
info  🔄 Run: #19148 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19149 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.8 seconds
commit  3f96109
info  🔄 Run: #19149 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19148 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  37 seconds
commit  2b08759
info  🔄 Run: #19148 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19149 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  41.3 seconds
commit  3f96109
info  🔄 Run: #19149 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19148 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.6 seconds
commit  2b08759
info  🔄 Run: #19148 (attempt 1)

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.72%. Comparing base (eeac6b3) to head (ae75e80).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8249   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files        1558     1558           
  Lines       61948    61948           
=======================================
  Hits        61160    61160           
  Misses        788      788           

☔ View full report in Codecov by Harness.
📢 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.

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 docs Documentation updates fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant