Skip to content

[build] run Rust tests and build Selenium Manager from source on Windows - #17998

Merged
titusfortner merged 5 commits into
SeleniumHQ:trunkfrom
titusfortner:windows-rust-ci
Sep 8, 2026
Merged

titusfortner merged 5 commits into
SeleniumHQ:trunkfrom
titusfortner:windows-rust-ci

Conversation

@titusfortner

Copy link
Copy Markdown
Member

🔗 Related Issues

💥 What does this PR do?

  • All GitHub Actions tests on Windows that run with --pin_browsers=false now build Selenium Manager from the current commit, rather than downloading an older, pre-built binary.
  • CI Rust Tests on Windows will run

🔧 Implementation Notes

  • Fixing this with an msvc exec platform because rules_rs ships an msvc-host rustc for Windows and the crate universe only lists msvc triples; a gnullvm exec platform makes every crate incompatible.
  • To get this working we needed to patch rules_rs to shorten its toolchain directory names so the link line stays under MAX_PATH.

🤖 AI assistance

  • AI assisted (complete below)
    • Tool(s): Claude Code (Fable 5.1)
    • What was generated: the diagnosis of the skipped tests and the MAX_PATH link failure, the path-length measurements, the changes, and this description
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

🔄 Types of changes

  • Bug fix (backwards compatible)

@selenium-ci selenium-ci added the B-build Includes scripting, bazel and CI integrations label Sep 7, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Restore Windows Rust CI and source-build Selenium Manager

🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Restores Rust test execution on Windows with an MSVC-compatible Bazel platform.
• Builds Selenium Manager from trunk for unpinned Windows CI runs.
• Patches rules_rs toolchain names to avoid Windows MAX_PATH link failures.
Diagram

graph TD
  CI["Windows CI"] --> Config["Bazel config"] --> Platform["MSVC platform"] --> Toolchains["Rust and MSVC"] --> Source["Source manager"]
  CI --> Choice{"Pinned browsers?"}
  Choice -->|No| Source --> Tests["Windows tests"]
  Choice -->|Yes| Prebuilt["Released manager"] --> Tests
Loading
High-Level Assessment

The proposed approach is the best available interim solution: it matches the crate universe's MSVC triples, scopes the autoconfigured C/C++ toolchain to Windows, and preserves pinned release behavior. Waiting for upstream hermetic MSVC support or shorter rules_rs names would leave Windows Rust tests and trunk Selenium Manager coverage broken; the local patch should be removed once upstream resolves the path-length issue.

Files changed (5) +69 / -11

Bug fix (1) +4 / -3
BUILD.bazelBuild Windows Selenium Manager for unpinned runs +4/-3

Build Windows Selenium Manager for unpinned runs

• Changes the Windows manager alias to mirror Linux and macOS selection behavior. Pinned-browser runs use the downloaded release, while default runs build the current Rust target.

common/manager/BUILD.bazel

Other (4) +65 / -8
.bazelrcSelect the MSVC execution platform on Windows +5/-1

Select the MSVC execution platform on Windows

• Replaces the gnullvm Windows host platform with the MSVC-compatible platform. Registers the autoconfigured local C/C++ toolchains so Rust build scripts and native actions can resolve on Windows.

.bazelrc

BUILD.bazelDefine a path-conscious Windows MSVC platform +4/-7

Define a path-conscious Windows MSVC platform

• Replaces the gnullvm platform with a tersely named MSVC ABI platform. The shorter name also reduces generated Bazel path lengths near the Windows MAX_PATH limit.

BUILD.bazel

MODULE.bazelPatch rules_rs and expose local MSVC toolchains +14/-0

Patch rules_rs and expose local MSVC toolchains

• Applies a repository patch that shortens generated rules_rs toolchain names. Adds the rules_cc configuration extension and exposes local MSVC repositories for Windows-specific registration.

MODULE.bazel

rules_rs_short_toolchain_names.patchShorten generated rules_rs toolchain identifiers +42/-0

Shorten generated rules_rs toolchain identifiers

• Adds a temporary upstream dependency patch that abbreviates default, Rust toolchain, and bootstrap names. This keeps generated Windows sysroot and linker paths below MAX_PATH.

third_party/bazel/rules_rs_short_toolchain_names.patch

@qodo-code-review

qodo-code-review Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. Dependency updates can erase the patch 📘 Rule violation ⚙ Maintainability
Description
rules_rs_short_toolchain_names.patch is added directly under third_party/ as a
repository-maintained dependency override. A refresh of that directory can overwrite the file, while
MODULE.bazel now depends on it to keep Windows Rust builds within the path-length limit.
Code

third_party/bazel/rules_rs_short_toolchain_names.patch[R1-3]

+diff --git a/rs/private/toolchains_repository.bzl b/rs/private/toolchains_repository.bzl
+--- a/rs/private/toolchains_repository.bzl
++++ b/rs/private/toolchains_repository.bzl
Evidence
Compliance rule 2 prohibits direct edits under third_party/. The cited file is newly added under
that directory, and its contents directly modify the external rules_rs toolchain definitions.

AGENTS.md: Do Not Modify Third-Party or Generated Output Directories
third_party/bazel/rules_rs_short_toolchain_names.patch[1-42]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new `rules_rs` patch is stored directly under `third_party/`, which is prohibited for repository-maintained modifications.

## Issue Context
Move the patch to a maintained build-support or patches directory and update the `single_version_override` label without changing its behavior.

## Fix Focus Areas
- third_party/bazel/rules_rs_short_toolchain_names.patch[1-42]
- MODULE.bazel[46-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Web pages:
  +2 more
Review mode: ⚖️ Balanced: This is a localized but behavior-affecting Bazel/Windows toolchain configuration change with real CI and Rust build compatibility risk, warranting a careful single-pass review.

Grey Divider

Tip of the day
💡 Did you know, you can tweak Display preferences with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit e12429d

@titusfortner titusfortner added this to the 4.49 milestone Sep 8, 2026
@titusfortner
titusfortner merged commit 438558b into SeleniumHQ:trunk Sep 8, 2026
58 checks passed
This was referenced Sep 9, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants