refactor: make join_path tolerate optional segments - #862
Open
AlexanderLanin wants to merge 2 commits into
Open
AlexanderLanin wants to merge 2 commits into
AlexanderLanin wants to merge 2 commits into
Conversation
AlexanderLanin
requested review from
MaximilianSoerenPollak,
a-zw,
dcalavrezo-qorix and
nradakovic
as code owners
September 26, 2026 09:25
AlexanderLanin
added this pull request to stack #865
September 26, 2026 09:25
Contributor
|
Documentation preview for this pull request is available at: |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The implementation unintentionally accepts all falsy values, and its documentation contradicts trailing-slash normalization.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Updates join_path to support optional path segments while retaining normalization.
Changes:
- Converts absent segments to empty paths.
- Adds regression tests for
Noneand empty segments. - Updates helper documentation.
| File | Description |
|---|---|
bzl/basics.bzl |
Adds optional-segment handling and documentation. |
bzl/tests/basics_test.bzl |
Covers absent and empty segment combinations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
Optional Bazel path segments are used by the documentation configuration and URL handling. join_path previously assumed both inputs were strings, so callers needed defensive handling for absent segments.
What changed
join_path now treats None like an empty path segment while preserving the existing trailing-slash and dot-segment normalization. The tests cover absent and empty prefix/rest segments.