[rust][selenium-manager]: do not ignore browser path when version is specified#17659
[rust][selenium-manager]: do not ignore browser path when version is specified#17659Delta456 wants to merge 6 commits into
Conversation
Code Review by Qodo
Context used 1. --browser-path major mismatch allowed
|
|
Code review by qodo was updated up to the latest commit 26efb88 |
f79f7c2 to
02638fb
Compare
|
Code review by qodo was updated up to the latest commit c179266 |
|
Code review by qodo was updated up to the latest commit 4f3546e |
|
Code review by qodo was updated up to the latest commit ac6d270 |
| } else if self.is_browser_version_specific() | ||
| && !self.get_browser_version().eq(&discovered_version) | ||
| { |
There was a problem hiding this comment.
1. --browser-path major mismatch allowed 📎 Requirement gap ≡ Correctness
The new mismatch error path in discover_local_browser() only triggers when is_browser_version_specific() is true (i.e., the requested --browser-version contains a .), so a major-only version like 114/105 can still mismatch the detected version at an explicit --browser-path without failing fast. In that case, later major-version handling can set download_browser=true and effectively ignore the user-provided path, violating the requirement to clearly fail when --browser-path and --browser-version conflict.
Agent Prompt
## Issue description
When `--browser-path` is provided together with a major-only `--browser-version` (e.g., `114`/`105`), a mismatch between the detected browser version at that path and the requested major version does not trigger the new fail-fast mismatch error because it is gated by `is_browser_version_specific()` (versions containing `.`). This can allow later major-version mismatch handling to set `download_browser = true` and effectively ignore the explicit browser path, contrary to the requirement to clearly fail on `--browser-path`/`--browser-version` conflicts.
## Issue Context
Compliance ID 1 requires a clear failure when `--browser-path` and `--browser-version` conflict.
The current mismatch error path only runs when `is_browser_version_specific()` is true (implemented as `version.contains(".")`), so major-only version requests bypass it.
Major-version mismatch handling happens later during major comparisons/reconciliation and can still set `download_browser = true` without checking whether `original_browser_path` / an explicit `--browser-path` was provided.
## Fix Focus Areas
- rust/src/lib.rs[508-610]
- rust/src/lib.rs[855-867]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
PR Summary by Qodo
Rust Selenium Manager: error on browser-path/version mismatch with ignore escape hatch
🐞 Bug fix🧪 Tests🕐 20-40 MinutesWalkthroughs
User Description
🔗 Related Issues
Fixes #17540
💥 What does this PR do?
SM silently discarded
--browser-pathand downloaded the requested version when versions didn't match. No error, no warning.This PR fixes that.
🔧 Implementation Notes
🤖 AI assistance
💡 Additional Considerations
🔄 Types of changes
AI Description
Diagram
graph TD A["selenium-manager CLI"] --> B["Parse args"] --> C["Discover browser version"] --> D{"browser-version == ignore?"} D -->|yes| E["Warn if browser-path set"] --> F["Use detected version"] D -->|no| G{"Specific version requested\nAND differs?"} G -->|yes, browser-path set| H["Error: mismatch + guidance"] G -->|yes, no browser-path| I["Download requested browser"] G -->|no| J["Proceed with detected version"]High-Level Assessment
The following are alternative approaches to this PR:
1. Add explicit flag (e.g., --ignore-browser-version-check)
2. Keep current behavior but emit warning and continue downloading
Recommendation: The PR’s approach is the safer default: treat --browser-path as authoritative and error on mismatches to prevent accidental browser swaps. If UX concerns arise, consider a dedicated --ignore-browser-version-check flag later; for now, the sentinel value
--browser-version ignoreprovides an explicit opt-out without expanding the flag surface.File Changes
Bug fix (1)
Tests (1)