Repository navigation
Python: Normalize Windows path separators in changed-package routing - #9769
leilei3167 wants to merge 2 commits into
Conversation
Repository-relative --files paths that use backslashes skipped the python/ prefix and resolved under python/python, so changed packages came back empty. Co-authored-by: leilei3167 <imleilei123@gmail.com>
|
The separator normalization is in 8dc4ac0. A repository-relative backslash path now selects the same package as the forward-slash form. |
There was a problem hiding this comment.
🟡 Changes recommended
The regression suite needs CI integration, and its global Rich stub can disrupt later imports.
2 open issues
What changed in this PR
This PR addresses #9742 by normalizing Windows path separators before package routing, so native repository-relative paths select the intended Python packages.
Changes:
- Normalize backslashes before stripping the
python/prefix. - Add regression tests for repository-relative, workspace-relative, absolute, and unrelated paths.
| File | Description |
|---|---|
python/scripts/tests/test_run_tasks_in_changed_packages.py |
Adds path-routing and core-change detection tests. |
python/scripts/run_tasks_in_changed_packages.py |
Normalizes separators before removing the repository prefix. |
Review effort: Balanced
| import types | ||
| import unittest | ||
| from pathlib import Path | ||
|
|
||
| # The router imports rich for CLI output. These tests only call get_changed_packages. | ||
| if "rich" not in sys.modules: | ||
| _rich = types.ModuleType("rich") | ||
| _rich.print = lambda *_args, **_kwargs: None | ||
| sys.modules["rich"] = _rich |
| from scripts.run_tasks_in_changed_packages import get_changed_packages | ||
|
|
||
|
|
||
| class GetChangedPackagesTests(unittest.TestCase): |
Stop installing a stand-in Rich module, and run scripts/tests on the existing Windows and Linux test matrix. Co-authored-by: leilei3167 <imleilei123@gmail.com>
|
The script tests now import Rich from the tool-runtime group, and the existing Windows/Linux matrix runs scripts/tests. 7c5452e |
|
leilei3167, thanks for fixing the Windows changed-package routing gap. We’re going to continue with #9775 because its native-path approach also covers dot-prefixed repository paths and UNC paths while preserving literal backslashes in POSIX filenames. I’m closing this competing implementation so #9742 has one active PR. |

Motivation & Context
On Windows,
get_changed_packages()inpython/scripts/run_tasks_in_changed_packages.pyonly strips apython/prefix. A repository-relative--filespath that uses backslashes, such aspython\packages\core\agent_framework\_types.py, never matches that prefix. The remainder is joined ontoworkspace_root, which already ends inpython, so the path points atpython/python/.... The changed-package set comes back empty and the script skips the tasks.Forward-slash repository-relative paths already select the right package. Native Windows spellings of those same paths should too.
Description & Review Guide
\to/before the existingpython/prefix strip.python/.Related Issue
Fixes #9742
No other open pull request changes this script. This is a small separator correction; the expected routing is the behavior described in the issue.
AI Assistance
AI assistance details: Implementation, regression test, and this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.