Resolve "Validate `Environment.tier` presence always"
What does this MR do and why?
Always Ensure tier attribute validation for Environment model as the backfill migration and its finalize migration completion work are already merged.
Rolling out this change with FF validate_environment_tier_presence
Related to #385253 (closed) and the technical proposal is discussed in #385253 (closed)
Screenshots or screen recordings
1. Feature flag enabled
pry(main)> Feature.enable(:validate_environment_tier_presence)
=> true
1.1 Record Create
pry(main)> env = Environment.new(name: 'Test Environment', tier: nil, project_id: Project.last.id)
pry(main)> env.save! # Does not error, since the before validation callback sets the tier
=> true
1.2 Record update
pry(main)> env = Environment.last
=> true
pry(main)> env.tier
=> "development"
pry(main)> env.tier = nil
pry(main)> env.save! # Does not error, since the before validation callback sets the tier
=> true
2. Feature flag disabled
pry(main)> Feature.disable(:validate_environment_tier_presence)
=> true
2.1 Record Create
pry(main)> env = Environment.new(name: 'Test Environment', tier: nil, project_id: Project.last.id)
pry(main)> env.save! # Does not error, since the before validation callback sets the tier
=> true
2.2 Record update
pry(main)> env = Environment.last
=> true
pry(main)> env.tier
=> "development"
pry(main)> env.tier = nil
pry(main)> env.save! # Does not error, since the before validation callback sets the tier
=> true
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Bala Kumar