Skip to content

[build] Remove legacy rake helpers and unused code#16978

Merged
titusfortner merged 8 commits intotrunkfrom
dead-code
Jan 22, 2026
Merged

[build] Remove legacy rake helpers and unused code#16978
titusfortner merged 8 commits intotrunkfrom
dead-code

Conversation

@titusfortner
Copy link
Member

@titusfortner titusfortner commented Jan 22, 2026

User description

💥 What does this PR do?

Remove legacy rake helpers and top-level aliases that are no longer needed
Most of these are not referenced or used.
Files Deleted:

File Reason
rake_tasks/selenium_rake/cpp_formatter.rb Required but never used
rake_tasks/selenium_rake/java_formatter.rb Required but never used
rake_tasks/selenium_rake/type_definitions_generator.rb Required but never used
rake_tasks/selenium_rake/ie_generator.rb Generates IEReturnTypes.h but output never created
rake_tasks/rake/dsl.rb Defines bazel DSL method, never called
rake_tasks/bazel/task.rb Defines Bazel::Task class, never instantiated
rake_tasks/python.rb References Python 2.7, obsolete
.git-fixfiles References non-existent cpp/iedriver/Generated/atoms.h
cpp/iedriverserver/build.desc CrazyFun build descriptor, unused
rake_tasks/rake/task.rb CrazyFun-only Task#out shim, not used after cleanup
rake_tasks/selenium_rake/browsers.rb Legacy helper with no remaining call sites

Rakefile Changes:

  • Drop requires for deleted helpers
  • Remove legacy top-level tasks/aliases (tests/build/driver shortcuts)
  • Remove the webserver spoof task and sizzle header helper
  • Replace SeleniumRake::Checks usage with RbConfig where needed

🔧 Implementation Notes

I'm keeping the ios_driver task because I think @jlipps uses it.

💡 Additional Considerations

More cleanup to come

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Enhancement


Description

  • Remove 11 unused legacy rake helper files and modules

  • Replace SeleniumRake::Checks with direct RbConfig usage

  • Delete obsolete IE driver code generation tasks and utilities

  • Remove CrazyFun build descriptors and deprecated Python 2.7 support

  • Simplify Rakefile by eliminating 150+ lines of dead code and aliases


Diagram Walkthrough

flowchart LR
  A["Legacy Rake Helpers"] -->|deleted| B["Checks, Browsers, Formatters"]
  C["IE Code Generators"] -->|deleted| D["CppFormatter, JavaFormatter, TypeDefinitionsGenerator"]
  E["Obsolete Build Files"] -->|deleted| F["build.desc, python.rb, dsl.rb"]
  G["Rakefile"] -->|simplified| H["Remove requires and dead tasks"]
  I["SeleniumRake::Checks"] -->|replaced| J["RbConfig direct usage"]
Loading

File Walkthrough

Relevant files
Refactoring
2 files
bazel.rb
Replace SeleniumRake::Checks with RbConfig                             
+5/-2     
Rakefile
Remove 150+ lines of dead code and tasks                                 
+5/-254 
Dead code removal
12 files
task.rb
Delete unused Bazel::Task class                                                   
+0/-13   
python.rb
Remove obsolete Python 2.7 helpers                                             
+0/-20   
dsl.rb
Delete unused Rake DSL bazel method                                           
+0/-7     
task.rb
Remove CrazyFun Task output shim                                                 
+0/-21   
browsers.rb
Delete legacy browser configuration helper                             
+0/-34   
checks.rb
Remove SeleniumRake::Checks utility class                               
+0/-82   
cpp_formatter.rb
Delete unused C++ code generator                                                 
+0/-26   
ie_generator.rb
Remove IE driver code generation task                                       
+0/-28   
java_formatter.rb
Delete unused Java code generator                                               
+0/-27   
type_definitions_generator.rb
Remove type mapping code generator                                             
+0/-38   
.git-fixfiles
Delete obsolete git index script                                                 
+0/-3     
build.desc
Delete CrazyFun build descriptor file                                       
+0/-29   

@titusfortner titusfortner requested a review from Copilot January 22, 2026 16:50
@selenium-ci selenium-ci added C-cpp C++ code is mostly Internet Explorer B-build Includes scripting, bazel and CI integrations labels Jan 22, 2026
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 22, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
OS detection edge-cases: The new windows? implementation relies on a limited host_os regex and may mis-detect some
Windows-like environments (e.g., cygwin/mingw variants), potentially breaking the
Windows-specific command execution path.

Referred Code
def self.windows?
  (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) != nil
end

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 22, 2026

PR Code Suggestions ✨

Latest suggestions up to f6d1329

CategorySuggestion                                                                                                                                    Impact
Possible issue
Harden cross-platform OS detection

Improve the Windows OS detection in Bazel.windows? to be more robust by
including patterns for mingw64 and cygwin and ensuring it returns a strict
boolean.

rake_tasks/bazel.rb [10-12]

 def self.windows?
-  (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) != nil
+  !!(RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin/i)
 end
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion improves the robustness of the Windows OS detection by including more patterns like mingw64 and cygwin, making it more reliable across different environments.

Medium
General
Centralize Windows detection logic

Replace the duplicated Windows OS detection logic with a call to the centralized
Bazel.windows? method to improve consistency and maintainability.

Rakefile [132-133]

-windows = RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/
+windows = Bazel.windows?
 cmd = cmd.tr('/', '\\').tr(':', ';') if windows
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly points out duplicated logic and proposes using the new centralized Bazel.windows? method, which improves code consistency and maintainability.

Low
  • More

Previous suggestions

Suggestions up to commit 026f17e
CategorySuggestion                                                                                                                                    Impact
Incremental [*]
Ensure tasks run every time

In the :release_update task, call reenable on each sub-task before invoke to
ensure they execute every time the :release_update task is run.

Rakefile [154-158]

 task :release_update do |_task, _arguments|
+  Rake::Task[:update_multitool].reenable
   Rake::Task[:update_multitool].invoke
+  Rake::Task['java:update'].reenable
   Rake::Task['java:update'].invoke
+  Rake::Task['node:update'].reenable
   Rake::Task['node:update'].invoke
 end
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly points out that invoke only runs once and proposes using reenable to ensure tasks run every time, which is a good practice for this type of meta-task.

Medium
Validate expected output file

In the :update_multitool task, verify that multitool.lock.json exists after the
Bazel command and before adding it to git to prevent crashes.

Rakefile [161-165]

 task :update_multitool do |_task, _arguments|
   puts 'Updating multitool binary versions'
   Bazel.execute('run', [], '//scripts:update_multitool_binaries')
+
+  raise 'multitool.lock.json was not generated' unless File.exist?('multitool.lock.json')
   @git.add('multitool.lock.json')
 end
Suggestion importance[1-10]: 6

__

Why: The suggestion improves robustness by adding a check for the existence of multitool.lock.json before attempting to add it to git, providing better error handling.

Low
✅ Suggestions up to commit e3cff26
CategorySuggestion                                                                                                                                    Impact
General
Use centralized Windows check

In Rakefile, replace the inline Windows OS check with a call to the centralized
Bazel.windows? helper method to avoid code duplication.

Rakefile [132-133]

-windows = RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
-cmd = cmd.tr('/', '\\').tr(':', ';') if windows
+cmd = cmd.tr('/', '\\').tr(':', ';') if Bazel.windows?
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies duplicate logic for OS detection and proposes centralizing it, which improves code maintainability and consistency by adhering to the DRY principle.

Medium
Broaden and clarify OS detection

In rake_tasks/bazel.rb, update the windows? method to include cygwin in its
regex and use boolean coercion (!!) for a clearer, more consistent return value.

rake_tasks/bazel.rb [9-11]

 def self.windows?
-  (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) != nil
+  !!(RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin/)
 end
Suggestion importance[1-10]: 7

__

Why: This suggestion correctly identifies an inconsistency in the Windows detection regex and proposes a fix that both unifies the logic and improves code style for clarity.

Medium
Learned
best practice
Avoid shell-joined command execution

Avoid backticks/cmd.join(' ') (shell parsing and injection risk); use
Open3.capture3/popen2e with array args on Windows too and capture stderr
explicitly.

rake_tasks/bazel.rb [25-38]

 if windows?
-  cmd += ['2>&1']
-  cmd_line = cmd.join(' ')
-  cmd_out = `#{cmd_line}`.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
+  cmd_out, cmd_err, status = Open3.capture3(*cmd)
+  cmd_out = (cmd_out.to_s + cmd_err.to_s).encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
+  cmd_exit_code = status.exitstatus
   puts cmd_out if verbose
 else
   Open3.popen2e(*cmd) do |stdin, stdout_and_stderr, wait_thr|
     stdin.close
     ...
   end
 end
Suggestion importance[1-10]: 6

__

Why:
Relevant best practice - Add explicit validation/sanitization at integration boundaries by avoiding shell-interpolated command execution with untrusted inputs.

Low
Require dependencies for OS detection
Suggestion Impact:The commit adds `require 'rbconfig'` to ensure `RbConfig` is loaded before OS detection logic uses it.

code diff:

@@ -3,6 +3,7 @@
 require 'English'
 require 'open3'
 require 'rake'
+require 'rbconfig'
 require 'io/wait'

Add an explicit require 'rbconfig' (or otherwise ensure RbConfig is loaded)
before using it, so OS detection does not fail depending on load order.

rake_tasks/bazel.rb [9-11]

 require 'English'
 require 'open3'
 require 'rake'
 require 'io/wait'
+require 'rbconfig'
 
 module Bazel
   def self.windows?
     (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32/) != nil
   end
Suggestion importance[1-10]: 5

__

Why:
Relevant best practice - Add explicit availability guards at integration boundaries (OS/env detection) and avoid relying on undeclared dependencies.

Low

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes legacy rake helpers and unused code from the Selenium build system, primarily focusing on obsolete IE driver code generation utilities, CrazyFun build artifacts, Python 2.7 references, and redundant task definitions.

Changes:

  • Deleted 11 unused files including IE driver generators, CrazyFun build descriptors, Python 2.7 helpers, and legacy rake utilities
  • Removed legacy top-level task aliases and shortcuts (tests, build, driver shortcuts)
  • Replaced SeleniumRake::Checks usage with direct RbConfig calls
  • Removed obsolete tasks: webserver spoof, sizzle header helper, release_update, update_multitool, side/node/rb atoms generation tasks

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rake_tasks/selenium_rake/type_definitions_generator.rb Deleted: IE driver type definitions generator (unused)
rake_tasks/selenium_rake/java_formatter.rb Deleted: Java code formatter for IE driver (unused)
rake_tasks/selenium_rake/ie_generator.rb Deleted: IE driver code generator (unused)
rake_tasks/selenium_rake/cpp_formatter.rb Deleted: C++ code formatter for IE driver (unused)
rake_tasks/selenium_rake/checks.rb Deleted: Platform checks utility (replaced with RbConfig)
rake_tasks/selenium_rake/browsers.rb Deleted: Legacy browser definitions (no call sites)
rake_tasks/rake/task.rb Deleted: CrazyFun Task#out shim (unused)
rake_tasks/rake/dsl.rb Deleted: Bazel DSL method (never called)
rake_tasks/python.rb Deleted: Python 2.7 references (obsolete)
rake_tasks/bazel/task.rb Deleted: Bazel::Task class (never instantiated)
rake_tasks/bazel.rb Added windows? method to replace SeleniumRake::Checks usage
cpp/iedriverserver/build.desc Deleted: CrazyFun build descriptor (unused)
.git-fixfiles Deleted: Git script for non-existent file (obsolete)
Rakefile Removed requires for deleted files, removed legacy task aliases, replaced SeleniumRake::Checks with RbConfig

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@titusfortner titusfortner merged commit fb761bd into trunk Jan 22, 2026
29 checks passed
@titusfortner titusfortner deleted the dead-code branch January 22, 2026 17:59
titusfortner added a commit that referenced this pull request Jan 22, 2026
* [build] Remove unused rake utilities

* Remove obsolete rake helpers

* remove obsolete rake checks

* [build] Remove obsolete atoms tasks except ios
titusfortner added a commit that referenced this pull request Jan 23, 2026
* [build] Remove unused rake utilities

* Remove obsolete rake helpers

* remove obsolete rake checks

* [build] Remove obsolete atoms tasks except ios
This was referenced Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations C-cpp C++ code is mostly Internet Explorer Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants