Remove unused constant Admin::JobsController::BUILDS_PER_PAGE

Summary

Removes the unused constant Admin::JobsController::BUILDS_PER_PAGE from app/controllers/admin/jobs_controller.rb.

The Admin::JobsController#index action renders a Vue mount point (app/views/admin/jobs/index.html.haml) and performs no server-side pagination, so BUILDS_PER_PAGE = 30 had no callers. Its only reference was a stale stub_const in the controller spec. The constant was left behind by !131881 (merged) (Remove unused job values fetched in controllers).

Related to #542966 (closed)

Verification

This constant was verified as unused by:

  • keela --type constants flagged it as unused
  • Word-boundary grep (grep -rnw) across app/ lib/ ee/ found no callers (definition line only)
  • No metaprogramming patterns reference it (const_get, :BUILDS_PER_PAGE, "BUILDS_PER_PAGE")
  • Not a Rails convention constant
  • Not referenced in any HAML/ERB view

Cascade Removals

None - this was a standalone removal.

Metrics

Source File Complexity (flog)

Metric Before After Improvement
File flog total 11.8 11.8 0 (constant assignment carries no flog)
Constant flog score 0 N/A 0 removed

Spec File Complexity (flog)

Metric Before After Improvement
Spec file flog total 34.1 30.5 -3.6 (-10.6%)
Spec block flog score 3.6 N/A -3.6 removed

Combined Flog Summary

File Flog Removed
app/controllers/admin/jobs_controller.rb 0
spec/controllers/admin/jobs_controller_spec.rb 3.6
Total 0 + 3.6

Test Suite Impact

  • Specs removed: 0 examples (1 example reworked, 1 untouched)
  • Spec file: spec/controllers/admin/jobs_controller_spec.rb
  • Time saved per run: 0.00 seconds

The spec example paginates builds without a total count was reworked, not removed. It preserves the real coverage it always provided (admin authorization + the index view rendering, get :index → :ok) while dropping only the stale setup that referenced the removed constant: the stub_const("Admin::JobsController::BUILDS_PER_PAGE", 1) line and the now-pointless create_list(:ci_build, 2). It is renamed to renders the index for an admin to describe what it actually verifies, and :aggregate_failures is dropped since it now has a single expectation. The second example (without admin access → not_found) is untouched. Because no example is removed, there is no measurable spec-time CI savings for this removal — the value is code-hygiene, not runtime.

Estimated CI Savings

Estimate Pipelines/Month Time Saved Cost Saved/Month Cost Saved/Year
Pessimistic 15,000 0.00 hrs/month $0.00 $0.00
Moderate 30,000 0.00 hrs/month $0.00 $0.00
Optimistic 50,000 0.00 hrs/month $0.00 $0.00

Based on 0.00 seconds saved per pipeline × $0.03/minute (large runners: 3x cost factor on $10/1000 base minutes). No examples were removed, so runtime savings are zero; the benefit is dead-code removal.

Files Modified

  • app/controllers/admin/jobs_controller.rb (constant removed - 2 lines)
  • spec/controllers/admin/jobs_controller_spec.rb (1 example reworked - 3 lines removed)
  • scripts/lint/keela_baseline.yml (entry removed - 2 lines)
  • Related to #542966 (closed) (Improve unused helper methods workflow)
  • Part of dead code cleanup effort
  • Constant was listed in scripts/lint/keela_baseline.yml

Note on group label: labelled ~"group::development tooling" as the owner of the dead-code-cleanup effort. The controller and spec carry feature_category :continuous_integration, so a CI-area reviewer is welcome to reassign the group label if they prefer.

Edited by Kerri Miller

Merge request reports

Loading
Loading