Implement dashboard mapping for homepage rollout

What does this MR do and why?

This MR implements a dashboard mapping strategy to enable the safe rollout of the new personal homepage feature. The implementation uses a "flipped enum mapping" approach that allows us to gradually migrate users to the new homepage while maintaining backward compatibility and avoiding breaking changes.

The Challenge

During the homepage rollout, we need to:

  1. Make the new homepage the default for new users
  2. Migrate existing users from the Projects dashboard to the new homepage
  3. Ensure the rollout is reversible and doesn't break existing user preferences (for external users)
  4. Handle the transition period where some users have the feature flag enabled and others don't

The Solution: Flipped Dashboard Mapping

This MR introduces a temporary mapping system that flips the enum values for dashboard when the personal_homepage feature flag is enabled:

  • Database value 0 (projects)Routes to homepage
  • Database value 12 (homepage)Routes to projects

This approach allows us to:

  • Set all GitLab employees to dashboard = 0 (projects) in the database
  • Route them to the new homepage when the feature flag is enabled
  • Maintain the ability to rollback by simply disabling the feature flag

User Experience

For External Users

  • Behavior: Continue using their current dashboard preference as normal
  • Database: Values remain unchanged
  • Routing: Standard enum mapping (0 = projects, 12 = homepage)

For Internal Users

  • Behavior: Users with "projects" preference get routed to the new homepage
  • Database: Value shows as "projects" (0) but they see the homepage
  • Routing: Flipped enum mapping (0 = homepage, 12 = projects)
  • Preferences UI: Shows accurate labels reflecting what they actually see

Example Scenarios

User Type Database Value Feature Flag Routes To Preferences Shows
Regular user dashboard = 0 (projects) Disabled Projects page "Your Contributed Projects"
GitLab employee dashboard = 0 (projects) Enabled Homepage "Personal homepage (default)"

Query Plan:

https://console.postgres.ai/gitlab/gitlab-production-main/sessions/43072/commands/131691

References

Closes #549602

Screenshots or screen recordings

Before After
For a user without the FF active, there will be no active changes for them.

For a user with active FF, they will be redirected to the new homepage

The user preferences show projects as default without FF

The user preferences show homepage as default after FF

How to set up and validate locally

Example:

  1. In rails console enable the feature flag
    Feature.enable(:personal_homepage, User.first)
  2. Login as root
  3. You will be redirected to the new homepage
  4. Turn off the FF and you will be redirected to projects page.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #549602

Edited by Anas Shahid

Merge request reports

Loading