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:
- Make the new homepage the default for new users
- Migrate existing users from the Projects dashboard to the new homepage
- Ensure the rollout is reversible and doesn't break existing user preferences (for external users)
- 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) |
|
Projects page | "Your Contributed Projects" |
| GitLab employee |
dashboard = 0 (projects) |
|
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
How to set up and validate locally
Example:
- In rails console enable the feature flag
Feature.enable(:personal_homepage, User.first) - Login as root
- You will be redirected to the new homepage
- 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