Spec failure: undefined method `allow_stale_runner_pruning' for FactoryBot

Job #2812288684 failed for cd5f01d4:

  86) Banzai::Filter::References::MilestoneReferenceFilter when milestone is closed project milestones behaves like String-based single-word references links to a valid reference
      Failure/Error: let_it_be(:parent_group) { create(:group, :public) }
      NoMethodError:
        undefined method `allow_stale_runner_pruning' for #<FactoryBot::SyntaxRunner:0x00007f6d2a235b88>
      Shared Example Group: "String-based single-word references" called from ./spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb:332
      Shared Example Group: "project milestones" called from ./spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb:473
      # ./ee/spec/factories/groups.rb:10:in `block (3 levels) in <main>'
      # ./spec/lib/banzai/filter/references/milestone_reference_filter_spec.rb:8:in `block (2 levels) in <main>'

It only happens on single-db jobs.

Investigation

It is failing in the line:

group.ci_cd_settings.allow_stale_runner_pruning = evaluator.allow_stale_runner_pruning

Because evaluator.allow_stale_runner_pruning is failing with the undefined method error.

But this is defined just below this line:

transient do
  # we can't assign the delegated `#ci_cd_settings` attributes directly, as the
  # `#ci_cd_settings` relation needs to be created first
  allow_stale_runner_pruning { false }
end
Edited by Peter Leitzen