Skip to content

Conversation

@fang-tech
Copy link
Contributor

AgentScope-Java Version

1.0.5-SNAPSHOT

Description

Allow users to create a FileSystemSkillRepository based on an empty folder, and complete the usage process of "empty directory -> save skills".

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@fang-tech fang-tech requested review from a team and Copilot December 30, 2025 13:27
@fang-tech fang-tech changed the title remove empty directory validation fix(skill): remove FileSystemSkillRepository empty directory validation Dec 30, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the validation that required FileSystemSkillRepository base directories to contain at least one subdirectory, enabling users to initialize repositories from empty folders and subsequently save skills to them.

Key Changes:

  • Removed the empty directory validation check from the FileSystemSkillRepository constructor
  • Updated the corresponding test to verify that empty directories are now accepted
  • Added a test for relative-to-absolute path transformation in the constructor

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
agentscope-core/src/main/java/io/agentscope/core/skill/repository/FileSystemSkillRepository.java Removed the validation logic that threw IllegalArgumentException when base directory contained no subdirectories, enabling empty directory initialization
agentscope-core/src/test/java/io/agentscope/core/skill/repository/FileSystemSkillRepositoryTest.java Updated test expectations to assert successful construction from empty directories and added test for path transformation behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +115 to 134
@Test
@DisplayName("Should transform relative path to absolute in constructor")
void testConstructor_RelativePath() throws IOException {
Path relativePath = Path.of("relative-skills");
Files.createDirectories(relativePath);

try {
FileSystemSkillRepository fileSystemSkillRepository =
new FileSystemSkillRepository(relativePath);
assertNotNull(fileSystemSkillRepository);
assertEquals(
relativePath.toAbsolutePath().normalize().toString(),
fileSystemSkillRepository.getRepositoryInfo().getLocation());
} finally {
if (Files.exists(relativePath)) {
Files.delete(relativePath);
}
}
}

Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case appears to be out of scope for this PR. The PR description states the purpose is to "Allow users to create a FileSystemSkillRepository based on an empty folder, and complete the usage process of 'empty directory -> save skills'". However, this test validates relative-to-absolute path transformation, which is existing functionality (already implemented at line 87 of FileSystemSkillRepository.java) and unrelated to the empty directory validation removal. Consider moving this test to a separate PR focused on path handling, or remove it from this PR to maintain focus on the stated objective.

Suggested change
@Test
@DisplayName("Should transform relative path to absolute in constructor")
void testConstructor_RelativePath() throws IOException {
Path relativePath = Path.of("relative-skills");
Files.createDirectories(relativePath);
try {
FileSystemSkillRepository fileSystemSkillRepository =
new FileSystemSkillRepository(relativePath);
assertNotNull(fileSystemSkillRepository);
assertEquals(
relativePath.toAbsolutePath().normalize().toString(),
fileSystemSkillRepository.getRepositoryInfo().getLocation());
} finally {
if (Files.exists(relativePath)) {
Files.delete(relativePath);
}
}
}

Copilot uses AI. Check for mistakes.
Comment on lines 105 to +113
@Test
@DisplayName("Should throw exception when base directory is empty")
@DisplayName("Should not throw exception when base directory is empty")
void testConstructor_EmptyBaseDir() throws IOException {
Path emptyDir = tempDir.resolve("empty");
Files.createDirectories(emptyDir);
assertThrows(IllegalArgumentException.class, () -> new FileSystemSkillRepository(emptyDir));
FileSystemSkillRepository fileSystemSkillRepository =
new FileSystemSkillRepository(emptyDir);
assertNotNull(fileSystemSkillRepository);
}
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test coverage for the core use case described in the PR: "empty directory -> save skills". While this test verifies that an empty directory can be used to construct a FileSystemSkillRepository, it doesn't validate that skills can actually be saved to it. Consider adding a test that creates a repository from an empty directory and then successfully saves a skill to it, verifying the complete workflow mentioned in the PR description.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AlbumenJ AlbumenJ merged commit b3b901d into agentscope-ai:main Dec 30, 2025
10 checks passed
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.

2 participants