Remove dead feature flags and unused glFeatures params from Jest specs
Summary
This issue tracks unused glFeatures setup in Jest spec files. Merge request !256677 (merged) already fixed the original six files named in the discussion below. This issue now covers the wider cleanup that a full scan found.
Background
Parent epic: &23520
Originating discussion: !256677 (comment 3882984375)
A spec can set a feature flag, or declare a glFeatures parameter, that looks like it drives the component under test. In many cases, the flag or parameter does nothing. The setup misleads a reader. CI cannot catch this. The tests pass whether the dead setup stays or goes.
Scope
The scan checked 6,556 Jest spec files in spec/frontend and ee/spec/frontend. It ran against master at commit 8e4773ad. It ran two separate checks. Each check found one work stream.
Work stream 1: dead feature flags in spec setup
A spec sets a flag through glFeatures: or gon.features. The flag no longer exists.
The scan found 32 occurrences in 29 files. Verification before each edit showed that 8 of them were not dead. 24 occurrences in 21 files were dead, and MR 1 and MR 2 remove them.
Check: the flag has no YAML file in config/feature_flags or ee/config/feature_flags (937 definitions checked). The flag also has no reference in app, ee/app, lib, ee/lib, config, or ee/config.
Most cases delete one key from an object that still holds live flags. A few are the only key, so the whole glFeatures object goes.
Work stream 2: never-supplied glFeatures factory params
A spec factory declares a glFeatures or features parameter. No call in the file ever supplies it. The parameter always takes its default value. This is the exact pattern the originating discussion described.
Count: 20 files.
Check: search the file for every call to the factory. Confirm that none of the calls passes the glFeatures or features parameter.
Why this is safe
glFeatureFlagsMixin injects glFeatures with default: () => ({}). 238 components use this mixin. Removing glFeatures from a spec's provide changes nothing for these components.
One component injects glFeatures without a default: app/assets/javascripts/vue_shared/components/source_viewer/components/chunk.vue. No file in this scope mounts that component.
Merge request plan
-
MR 1 — !256955 (merged) — dead flags, security and work items (11 files, 13 flags)
Security:
ee/spec/frontend/dependencies/components/dependency_vulnerability_spec.js— standaloneVulnDependencyListee/spec/frontend/security_dashboard/components/shared/vulnerability_report/selection_summary_spec.js— enhancedVulnerabilityBulkActions, newIssueAttachmentFromVulnerabilityBulkActionee/spec/frontend/security_dashboard/components/shared/vulnerability_report/vulnerability_report_spec.js— vulnerabilityOwaspTop10Groupee/spec/frontend/security_orchestration/components/policies/list_component_spec.js— securityPoliciesSpepDryRunee/spec/frontend/vue_merge_request_widget/widgets/security_reports/mr_widget_security_reports_spec.js— mrSecurityWidgetGraphql
Work items:
ee/spec/frontend/integration/work_items/awards/award_emoji_spec.js— notificationsTodosButtons, workItemRestApiIndexee/spec/frontend/integration/work_items/list/preferences_spec.js— workItemViewForIssuesee/spec/frontend/work_items/components/work_item_links/work_item_links_form_spec.js— createGroupLevelWorkItemsspec/frontend/work_items/components/work_item_links/work_item_links_form_spec.js— createGroupLevelWorkItemsspec/frontend/work_items/components/work_item_links/work_item_tree_spec.js— useCachedRolledUpWeightsspec/frontend/work_items/pages/planning_view_spec.js— workItemListDisplaySettingsDrawer
This MR also includes a call-site edit, already done. One call in
spec/frontend/work_items/components/work_item_links/work_item_links_form_spec.jssupplied the flagcreateGroupLevelWorkItems. That call is updated. -
MR 2 — !257192 (merged) — dead flags, remaining areas (10 files, 11 flags)
ee/spec/frontend/ai/duo_agentic_chat/components/duo_agentic_chat_state_manager_spec.js— aiAgenticWorkflows, duoChatRetryee/spec/frontend/vue_shared/components/notes/system_note_spec.js— saveDescriptionVersionsspec/frontend/admin/projects/index/components/app_spec.js— customAbilityReadAdminProjectsspec/frontend/batch_comments/components/preview_item_spec.js— improvedReviewExperiencespec/frontend/ci/pipeline_editor/components/editor/ci_editor_header_spec.js— aiCiConfigGeneratorspec/frontend/diffs/components/diff_file_spec.js— commentOnFilesspec/frontend/diffs/components/diff_row_spec.js— dragCommentSelectionspec/frontend/service_accounts/components/create_edit_service_account_modal_spec.js— editServiceAccountEmailspec/frontend/sidebar/components/reviewers/reviewer_title_spec.js— reviewerAssignDrawerspec/frontend/tooltips/index_spec.js— glTooltips
spec/frontend/admin/projects/index/components/app_spec.jsalso appears in work stream 2. Do both edits in this MR, so the file changes once. -
MR 3 — !257194 (merged) — never-supplied params, security_orchestration (12 files)
All 12 files use
createWrapper(glFeatures). One shape, one reviewer.ee/spec/frontend/security_orchestration/integration/policy_editor/pipeline_execution/pipeline_execution_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/pipeline_execution/skip_ci_configuration_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/policy_scope/all_projects_with_exceptions_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/policy_scope/compliance_frameworks_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/policy_scope/linked_groups_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/policy_scope/specific_projects_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/policy_selector_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/scan_execution/scan_execution_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/scan_execution/skip_ci_configuration_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/scan_execution/split_view_layout_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/scan_result/scan_result_spec.jsee/spec/frontend/security_orchestration/integration/policy_editor/scan_result/split_view_layout_spec.js
-
MR 4 — !257201 (merged) — never-supplied params, remaining (6 files)
spec/frontend/notes/components/comment_form_spec.js— mountComponent(features)spec/frontend/security_configuration/components/app_spec.js— createComponent(glFeatures)ee/spec/frontend/ai/catalog/components/ai_catalog_item_actions_spec.js— createComponent(glFeatures)ee/spec/frontend/billings/pricing_information/components/premium_plan_section_spec.js— createComponent(glFeatures)ee/spec/frontend/notes/components/comment_form_spec.js— mountComponent(features)ee/spec/frontend/pages/projects/get_started/components/get_familiar_spec.js— createComponent(glFeatures)
What verification changed
Every flag was checked again against the default branch immediately before its edit. Three kinds of false positive appeared.
- Licensed features, not feature flags.
runnerMaintenanceNoteandrunnerPerformanceInsightsare live. They are listed inee/app/models/gitlab_subscriptions/features.rb, and the runner components read them. This removed six files underee/spec/frontend/ci/runner. - A local variable, not a flag. In
prompt_input_actions_spec.js,attachmentsOnis the name of a constant that holds aglFeaturesobject. The flag inside it isdapWebChatFileAttachments, which the scan did not check. - Already fixed.
spec/frontend/wikis/components/wiki_form_spec.jswas cleaned by commit 12b60f9a on the default branch.
One more file left work stream 2. In ee/spec/frontend/security_orchestration/components/policy_editor/dependency_firewall/editor_component_spec.js, no call supplies the glFeatures parameter, but its default is not empty. It is { dependencyFirewallPhase2: true }, and that flag is live. It has a YAML file in config/feature_flags/wip/, ee/app/controllers/groups/security/policies_controller.rb pushes it, and editor_component.vue reads it. Removing the parameter there means writing the value in place, not deleting setup. That is a different change and needs its own merge request.
The cause of the first false positive was the scan itself. It converted a camelCase flag name to snake_case to look it up. That conversion breaks on an acronym, so groupDependenciesGraphQL became group_dependencies_graph_q_l and never matched the real flag group_dependencies_graphql. The scan now allows an optional underscore between every character and matches without case.
How to validate
- Confirm each removed flag has zero hits in
app,ee/app,lib,ee/lib,config, andee/config. - Run the default Jest lane.
- Run the
VUE_VERSION=3Jest lane.
Follow-up work
Two new issues track the rest of the scan's findings. Both sit under the same parent epic as this issue.
- #631446 covers 109 cases. In each case, a spec factory drops a value that the caller passed. The test then runs with the factory default. These are defects in test coverage, not dead weight. Nobody is working on them now.
- #631447 (closed) covers about 1,400 unused factory parameters. Common names are
props,provide, andmountFn. Removing them makes each factory state what its file needs.
One file stays outside both issues: ee/spec/frontend/security_orchestration/components/policy_editor/dependency_firewall/editor_component_spec.js. It declares an unused glFeatures parameter. The parameter default carries a live feature flag. If a person deletes the parameter, the test covers something different. Issue 631447 records this file as a worked example of that risk.