Revert visibility-based model access level defaults (!241157, !241182)

What does this MR do and why?

This reverts !241157 (merged) and !241182 (merged) together, and disables their post-deployment migrations, to resolve the project-creation incident.

!241157 (merged) dropped the DEFAULT 20 on the NOT NULL columns project_features.model_registry_access_level and model_experiments_access_level (post-deploy migration 20260617130000) in the same release that moved default population into a ProjectFeature after_initialize callback. Because config.active_record.partial_inserts is enabled, nodes running the previous release omit these columns from inserts and relied on the database default. With the default gone, those inserts wrote NULL into NOT NULL columns and raised PG::NotNullViolation, which broke project creation on staging during the rolling deploy (qa-smoke ResourceFabricationFailedError, API 400).

!241182 (merged) enqueued a batched background migration to set these columns to PRIVATE on existing non-public projects, to match the reverted behavior. It is reverted in the same MR so the default change and the backfill move together, and so the backfill is not left running against behavior that no longer exists. It will be resubmitted alongside the feature later. Running it twice would be a confusing experience for self-managed and Dedicated.

What this MR does:

  • Restores the DEFAULT 20 for environments where the removal already ran (post-deploy migration 20260624225217). A static default of 20 is safe because ProjectPolicy already restricts read access to members on non-public projects, so the stored value is observably equivalent to the visibility-based default the callback computed.
  • Disables the two original post-deploy migrations (20260617130000 and 20260617140000) by turning them into no-ops, per the deleting migrations guidance, so neither the default drop nor the backfill enqueue runs on environments where they have not yet run.
  • Stops and removes the backfill batched background migration on environments where it was already enqueued (post-deploy migration 20260625005917 calling delete_batched_background_migration). The migration job class, its spec, and its dictionary entry are intentionally kept so in-flight jobs do not fail, and will be removed in a follow-up after this is deployed everywhere.
  • Reverts the model and test changes from !241157 (merged). With the default restored, ActiveRecord seeds the column before the callback runs, so the callback can no longer take effect. The callback and the now-unused safe-default wiring are removed, the model-level ENABLED defaults are restored, and the spec, factory, and seed changes are reverted so the model and its tests stay consistent.

References

How to set up and validate locally

  1. Check out the branch and run bundle exec rails db:migrate.
  2. Confirm db/structure.sql shows DEFAULT 20 on both model_registry_access_level and model_experiments_access_level.
  3. Run bundle exec rspec spec/models/project_feature_spec.rb and confirm it is green.
  4. In a rails console, confirm ProjectFeature.new.model_registry_access_level returns 20.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Diane Russel

Merge request reports

Loading
Loading