Conversation
|
Hi @innoprej, thank you for your contribution! We appreciate you taking the time to submit this pull request. Currently this PR is under review by our team, we will keep you posted if any additional information is required. thank you. |
MiloszSobczyk
left a comment
There was a problem hiding this comment.
Hello, thank you for your contribution.
One suggestion: the bug got through because CI runs only on Ubuntu, and this PR still adds no test that fails there. The Python fix added a test that simulates Windows paths. In Java, adding com.google.jimfs:jimfs as a test dependency would allow a test on jimfs.newFileSystem(Configuration.windows()). LocalSkillSource is already written to support non-default providers (see the comment in validatePathWithinBase), so that test would fail on main even on Linux.
8130cd0 to
101962e
Compare
|
Thanks for the suggestion in your review. I added Jimfs 1.3.2 as a test-scoped dependency and a test using With the original |
|
Helllo, could you please merge the newest changes that were introduced in the code? Afterwards, please ensure that the code still works correctly. |
LocalSkillSource.listResources turned each relative resource path into a string with Path.toString(), which uses the platform separator. On Windows it returned assets\file1.txt, while ClassPathSkillSource and InMemorySkillSource return assets/file1.txt, and LoadSkillResourceTool only accepts paths that start with assets/, references/ or scripts/. LocalSkillSourceTest.testListResources fails on Windows: expected: [assets/file1.txt, assets/subdir/file2.txt] but was : [assets\file1.txt, assets\subdir\file2.txt] Join the path's name elements with '/' instead, as adk-python now does for skill resources loaded from a directory. Nothing changes on Linux and macOS, where Path.toString() already uses '/'. CI runs on Ubuntu, so it could not catch this. - Reuse a static PATH_JOINER for each relative resource path. - Add a test-scoped Jimfs Windows filesystem regression test that also reads the listed resources, so Ubuntu CI covers the separator bug.
101962e to
2a2ab5c
Compare
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):
2. Or, if no issue exists, describe the change:
Problem:
LocalSkillSource.listResourcesturns each resource path, relative to the skill directory, into a string withPath.toString(), which uses the platform separator. On Windows it returnsassets\file1.txt, whileClassPathSkillSourceandInMemorySkillSourcereturnassets/file1.txtfor the same skill layout, andLoadSkillResourceToolrejects any path that does not start withassets/,references/orscripts/.LocalSkillSourceTest.testListResourcesfails on Windows:The existing test uses the host filesystem. CI runs on Ubuntu, where
Path.toString()already uses/, so that test misses the Windows bug. The code has been this way sinceLocalSkillSourcewas added in 1.3.0.Solution:
Join the relative path's name elements with
/using a staticPATH_JOINER(Joiner.on('/')). APathiterates over its name elements. This matches the other two implementations and adk-python, which made the same change for directory-loaded skill resources in google/adk-python@bc2c97c (str(relative_path)→relative_path.as_posix()). The returned Windows paths now satisfyLoadSkillResourceTool's prefix check.Add Jimfs 1.3.2 as a test-scoped dependency and a regression test using
Configuration.windows(). It checks direct and nested resource paths and reads each returned path throughloadResource, so the Windows separator bug is testable on Ubuntu too.Testing Plan
Unit Tests:
Windows 11, Microsoft OpenJDK 17.0.19, Maven 4.0.0-rc-3 via
mvnw. For the regression check, the new test and Jimfs dependency were kept while onlyLocalSkillSource.javawas restored to the original implementation from4092a1fa.LocalSkillSourceTestdefault-testandbasicLocalSkillSourceTest-pl core testdefault-testandbasiceach run 1,884 tests, 24 skipped, 0 failures and 0 errorsThe Ubuntu check ran the same compiled test class on a Linux JVM with JUnitCore. It was not an Ubuntu Maven build or an upstream CI run. macOS was not run.
The remaining core Surefire executions ran 2, 24 (1 skipped), 1, and 0 tests, with no failures or errors. The existing zero-test
apigee-llm-proxy-urlexecution is tracked separately in #1557. google-java-format checked 352 files and reformatted none.Manual End-to-End (E2E) Tests:
No application-level E2E test was run. The new unit test covers the
listResources→loadResourceround trip using a Windows filesystem on both Windows and Ubuntu.Checklist
Additional context
Jimfs is limited to test scope. The resolved test classpath retains the project's existing Guava 33.0.0-jre version.