Skip to content

Conversation

@emyller
Copy link
Contributor

@emyller emyller commented Nov 11, 2025

Closes #5825

Changes

  • Make Segment.version_of = null the indication for a live segment

Implementation Notes

Warning

Migration 0031_set_version_of_to_null_for_canonical_segments:

  • Migrates canonical segments from version_of=self to version_of=NULL
  • May block during deployment depending on segment count
  • Follows same pattern as migration 0023 which originally set version_of=id

@emyller emyller requested a review from a team as a code owner November 11, 2025 18:59
@emyller emyller requested review from khvn26 and removed request for a team November 11, 2025 18:59
@vercel
Copy link

vercel bot commented Nov 11, 2025

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

3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs Ignored Ignored Preview Nov 11, 2025 10:26pm
flagsmith-frontend-preview Ignored Ignored Preview Nov 11, 2025 10:26pm
flagsmith-frontend-staging Ignored Ignored Preview Nov 11, 2025 10:26pm

@github-actions github-actions bot added api Issue related to the REST API fix labels Nov 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

Docker builds report

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

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

]
# Note: project.segments is prefetched with Segment.live_objects which already
# filters by version_of__isnull=True, so no need to filter again here.
project_segments = list(project.segments.all())
Copy link

Choose a reason for hiding this comment

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

Bug: Unfiltered Segment Versions Create Duplicates

The comment claims project.segments is prefetched with Segment.live_objects which filters by version_of__isnull=True, but the segments related_name uses the default Segment.objects manager. Without explicit filtering, this will include all segment versions (both canonical and revisions), causing duplicate segments to be mapped to the engine environment model.

Fix in Cursor Fix in Web

@emyller emyller marked this pull request as draft November 11, 2025 19:18
@emyller emyller self-assigned this Nov 11, 2025
@emyller emyller changed the base branch from main to refactor/segment-change-requests-cleanup November 11, 2025 19:32
@emyller emyller force-pushed the refactor/segment-version-of-null branch from 106ec2e to fbcf1b3 Compare November 11, 2025 19:37
@github-actions github-actions bot added fix and removed fix labels Nov 11, 2025
@emyller emyller force-pushed the refactor/segment-version-of-null branch from fbcf1b3 to d2729ac Compare November 11, 2025 19:43
@github-actions github-actions bot added fix and removed fix labels Nov 11, 2025
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.02%. Comparing base (ec45a23) to head (d2729ac).

Additional details and impacted files
@@                            Coverage Diff                            @@
##           refactor/segment-change-requests-cleanup    #6275   +/-   ##
=========================================================================
  Coverage                                     98.02%   98.02%           
=========================================================================
  Files                                          1280     1281    +1     
  Lines                                         45399    45401    +2     
=========================================================================
+ Hits                                          44501    44503    +2     
  Misses                                          898      898           

☔ 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.

@emyller emyller force-pushed the refactor/segment-version-of-null branch from d2729ac to 15948bd Compare November 11, 2025 22:25
@github-actions github-actions bot added fix and removed fix labels Nov 11, 2025
Base automatically changed from refactor/segment-change-requests-cleanup to main November 12, 2025 09:45
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.

Clean up

2 participants