Skip to content

Conversation

@bonigarcia
Copy link
Member

@bonigarcia bonigarcia commented Jan 15, 2026

User description

💥 What does this PR do?

This PR replace the use fs::rename by file::move_file for Grid artifacts, since rename isn't allowed across filesystems.

🔧 Implementation Notes

💡 Additional Considerations

🔄 Types of changes

  • Bug fix (backwards compatible)

PR Type

Bug fix


Description

  • Replace fs::rename with file::move_file for Grid artifacts

  • Enables cross-filesystem driver file movement in Grid environments

  • Adds fs_extra crate dependency for improved file operations


Diagram Walkthrough

flowchart LR
  A["fs::rename<br/>limited to same filesystem"] -- "replaced by" --> B["file::move_file<br/>supports cross-filesystem moves"]
  B --> C["Grid artifact handling<br/>now works across filesystems"]
Loading

File Walkthrough

Relevant files
Bug fix
lib.rs
Replace fs::rename with file::move_file for Grid                 

rust/src/lib.rs

  • Added imports for fs_extra::file module and CopyOptions
  • Replaced fs::rename call with file::move_file for Grid driver
    artifacts
  • Uses CopyOptions::new() to configure the move operation
+3/-1     

@bonigarcia bonigarcia added the C-rust Rust code is mostly Selenium Manager label Jan 15, 2026
@bonigarcia bonigarcia moved this to In Progress in Selenium Manager Jan 15, 2026
@selenium-ci selenium-ci added the B-manager Selenium Manager label Jan 15, 2026
@bonigarcia bonigarcia requested a review from cgoldberg January 15, 2026 15:57
@qodo-code-review
Copy link
Contributor

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: 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 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:
Missing error context: The new file::move_file(...) ? propagates errors without adding actionable context (e.g.,
source/destination paths), reducing debuggability for cross-filesystem move failures.

Referred Code
    file::move_file(driver_zip_file, driver_path_in_cache, &CopyOptions::new())?;
} else {

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

Generic: Comprehensive Audit Trails

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

Status:
No move audit log: The newly added cross-filesystem artifact move operation is not explicitly logged, so it
is unclear whether Grid artifact movements are captured in audit trails when required.

Referred Code
    file::move_file(driver_zip_file, driver_path_in_cache, &CopyOptions::new())?;
} else {

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:
Error exposure unclear: It is not visible from the diff whether the propagated move_file error (potentially
containing filesystem paths) is surfaced to end-users or confined to internal
logs/handlers.

Referred Code
    file::move_file(driver_zip_file, driver_path_in_cache, &CopyOptions::new())?;
} else {

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

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

Copy link
Member

@cgoldberg cgoldberg left a comment

Choose a reason for hiding this comment

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

LGTM

@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Enable overwriting to prevent move failures

Set the overwrite option to true in CopyOptions for the file::move_file call to
prevent failures if the destination file already exists.

rust/src/lib.rs [227]

-file::move_file(driver_zip_file, driver_path_in_cache, &CopyOptions::new())?;
+let mut options = CopyOptions::new();
+options.overwrite = true;
+file::move_file(driver_zip_file, driver_path_in_cache, &options)?;
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that file::move_file will fail if the destination file exists and proposes enabling overwrite to improve the operation's robustness, which is a valid improvement.

Low
  • More

@bonigarcia bonigarcia merged commit b1489f9 into trunk Jan 15, 2026
32 of 33 checks passed
@bonigarcia bonigarcia deleted the sm_grid_move branch January 15, 2026 16:32
@github-project-automation github-project-automation bot moved this from In Progress to Done in Selenium Manager Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-manager Selenium Manager C-rust Rust code is mostly Selenium Manager Review effort 2/5

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants