Remove stale with_actor(nil) scaffolding from CI config specs
Summary
Four spec files carry around/before blocks wrapping
Gitlab::Ci::Config::FeatureFlags.with_actor(nil) for feature flags that no longer exist.
spec/lib/gitlab/ci/config/header/input_spec.rbspec/lib/gitlab/ci/config/header/inputs_spec.rbspec/lib/gitlab/ci/config/header/inputs/validator_spec.rbspec/lib/gitlab/ci/config/normalizer_spec.rb
spec/lib/gitlab/ci/config/feature_flags_spec.rb also has it and should keep it, because it
tests the mechanism.
Why it matters
spec/spec_helper.rb wraps every example in Gitlab::Ci::Config::FeatureFlags.ensure_correct_usage,
so a flag read with no actor reaches track_and_raise_for_dev_exception and fails the spec.
with_actor(nil) stores NO_ACTOR_VALUE, so current_actor returns nil without raising.
While the block is in place, a future flag added to those code paths without a real actor
evaluates against nil instead of failing the spec. The block removes a guard that exists
to catch exactly that.
This keeps happening
Each block came from a different flag's work, and every one of those flags is already gone.
| file | added by | flag |
|---|---|---|
header/input_spec.rb, header/inputs_spec.rb, header/inputs/validator_spec.rb |
2bb09e170622 Use FeatureFlags instead of Feature for flag check |
since removed |
normalizer_spec.rb |
a654e20689e0 Expand policy job needs for parallelized jobs |
since removed |
!255832 (merged) removed the same scaffolding
from 11 more files after ci_reject_yaml_tags_in_inputs was removed. That makes three
separate changes that left it behind. Deleting these four fixes the current instances. The
reason it recurs is that a flag cleanup does not obviously own the spec scaffolding its
rollout added.
Proposal
- Remove the blocks from the four files and confirm the specs still pass. !256154 (merged)
- Consider whether
with_actor(nil)belongs in specs at all. An opt-out per example would make suppressing the guard explicit and visible, rather than a block that outlives the flag that needed it. - If the pattern stays, note in the feature flag docs that cleaning up a CI config flag includes removing the spec scaffolding its rollout added.
Related
- !255832 (comment 3842141531)
lib/gitlab/ci/config/feature_flags.rbdoc/development/cicd/configuration.md