Skip to content

fix(scripts): normalize jj and hg added paths on Windows - #7046

Open
claxman wants to merge 1 commit into
google:mainfrom
claxman:fix/7029-windows-jj-hg-paths
Open

fix(scripts): normalize jj and hg added paths on Windows#7046
claxman wants to merge 1 commit into
google:mainfrom
claxman:fix/7029-windows-jj-hg-paths

Conversation

@claxman

@claxman claxman commented Sep 7, 2026

Copy link
Copy Markdown

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Problem:
get_vcs_added_files joins jj and hg roots with os.path.join and never calls .replace(os.sep, '/'). A snippet mocked os.path to ntpath and os.sep to \\, then called get_vcs_added_files('.') with a fake jj diff --summary of A src/google/adk/agents/_jj_agent.py. Without the replace, the set is {'/workspace\\src/google/adk/agents/_jj_agent.py'}.

Solution:
Normalize the jj and hg joined paths with .replace(os.sep, '/'), matching find_py_files. git, g4, and p4 are unchanged.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
PYTHONPATH=. .venv/bin/python -m pytest -q tests/unittests/scripts/test_check_new_py_files.py

31 passed.

With scripts/check_new_py_files.py checked out from b0180620, test_get_vcs_added_files_jj[True] and test_get_vcs_added_files_hg[True] fail. They compare {'/workspace\\src/google/adk/agents/_jj_agent.py'} and {'/workspace\\src/google/adk/agents/_hg_agent.py'} to the forward-slash expected set. The posix cases ([False]) still pass.

Manual End-to-End (E2E) Tests:

Not run. No Windows host and no live jj or hg checkout.

Additional context

Claim: #7029 (comment)

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

get_vcs_added_files joined jj and hg roots with os.path.join and never
called .replace(os.sep, '/'). Parametrized jj/hg tests that patch
os.path to ntpath and os.sep to \\ fail on b018062 with
{'/workspace\\src/google/adk/agents/_jj_agent.py'} and the hg equivalent.

Add .replace(os.sep, '/') on those two backends, matching find_py_files.

Verification: test_check_new_py_files.py 31 passed. Base script fails
jj[True] and hg[True].

Fixes google#7029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scripts/check_new_py_files.py misses added files on Windows under jj and hg

2 participants