-
Notifications
You must be signed in to change notification settings - Fork 212
[Chore] Improve core coverage CI and merge queue readiness #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ddc983d
chore: split packages/core integration coverage lane
roomote 2e38dac
[Chore] Fix core integration lane follow-up issues
roomote e2e68b3
[Chore] Relax Windows worktree integration matching
roomote b68d562
[Chore] Align worktree delete integration assertion with service cont…
roomote ab68d96
chore: Move core dual-lane test:coverage inside the package
edelauna 35a5e2d
chore: Flag core unit/integration Codecov uploads separately
edelauna a0b2cbf
chore: tighten core coverage lane wiring
roomote 7b41a12
Optimize CI cache and coverage uploads
roomote 5f137ab
chore: add merge queue triggers for required CI
roomote File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
158 changes: 158 additions & 0 deletions
158
packages/core/src/custom-tools/__tests__/custom-tool-registry.integration.spec.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| // pnpm --filter @roo-code/core test src/custom-tools/__tests__/custom-tool-registry.integration.spec.ts | ||
|
|
||
| import path from "path" | ||
| import { fileURLToPath } from "url" | ||
|
|
||
| import { CustomToolRegistry } from "../custom-tool-registry.js" | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
|
|
||
| const TEST_FIXTURES_DIR = path.join(__dirname, "fixtures") | ||
| const TEST_FIXTURES_OVERRIDE_DIR = path.join(__dirname, "fixtures-override") | ||
|
|
||
| describe.sequential("CustomToolRegistry integration", () => { | ||
| let registry: CustomToolRegistry | ||
|
|
||
| beforeEach(() => { | ||
| registry = new CustomToolRegistry() | ||
| }) | ||
|
|
||
| describe("loadFromDirectory", () => { | ||
| it("should load tools from TypeScript files", async () => { | ||
| const result = await registry.loadFromDirectory(TEST_FIXTURES_DIR) | ||
|
|
||
| expect(result.loaded).toContain("simple") | ||
| expect(registry.has("simple")).toBe(true) | ||
| }, 300_000) | ||
|
|
||
| it("should handle named exports", async () => { | ||
| const result = await registry.loadFromDirectory(TEST_FIXTURES_DIR) | ||
|
|
||
| expect(result.loaded).toContain("multi_toolA") | ||
| expect(result.loaded).toContain("multi_toolB") | ||
| }, 30_000) | ||
|
|
||
| it("should report validation failures", async () => { | ||
| const result = await registry.loadFromDirectory(TEST_FIXTURES_DIR) | ||
|
|
||
| const invalidFailure = result.failed.find((failure) => failure.file === "invalid.ts") | ||
| expect(invalidFailure).toBeDefined() | ||
| expect(invalidFailure?.error).toContain("Invalid tool definition") | ||
| }, 30_000) | ||
|
|
||
| it("should return empty results for non-existent directory", async () => { | ||
| const result = await registry.loadFromDirectory("/nonexistent/path") | ||
|
|
||
| expect(result.loaded).toHaveLength(0) | ||
| expect(result.failed).toHaveLength(0) | ||
| }) | ||
|
|
||
| it("should skip non-tool exports silently", async () => { | ||
| const result = await registry.loadFromDirectory(TEST_FIXTURES_DIR) | ||
|
|
||
| expect(result.loaded).toContain("mixed_validTool") | ||
| expect(result.loaded).not.toContain("mixed_someString") | ||
| expect(result.loaded).not.toContain("mixed_someNumber") | ||
| expect(result.loaded).not.toContain("mixed_someObject") | ||
| }, 30_000) | ||
|
|
||
| it("should support args as alias for parameters", async () => { | ||
| const result = await registry.loadFromDirectory(TEST_FIXTURES_DIR) | ||
|
|
||
| expect(result.loaded).toContain("legacy") | ||
|
|
||
| const tool = registry.get("legacy") | ||
| expect(tool?.parameters).toBeDefined() | ||
| }, 30_000) | ||
| }) | ||
|
|
||
| describe("clearCache", () => { | ||
| it("should clear the TypeScript compilation cache", async () => { | ||
| await registry.loadFromDirectory(TEST_FIXTURES_DIR) | ||
| registry.clearCache() | ||
|
|
||
| registry.clear() | ||
| const result = await registry.loadFromDirectory(TEST_FIXTURES_DIR) | ||
|
|
||
| expect(result.loaded).toContain("cached") | ||
| }, 300_000) | ||
| }) | ||
|
|
||
| describe("loadFromDirectories", () => { | ||
| it("should load tools from multiple directories", async () => { | ||
| const result = await registry.loadFromDirectories([TEST_FIXTURES_DIR, TEST_FIXTURES_OVERRIDE_DIR]) | ||
|
|
||
| expect(result.loaded).toContain("simple") | ||
| expect(result.loaded).toContain("unique_override") | ||
| expect(result.loaded).toContain("multi_toolA") | ||
| }, 60_000) | ||
|
|
||
| it("should allow later directories to override earlier ones", async () => { | ||
| await registry.loadFromDirectories([TEST_FIXTURES_DIR, TEST_FIXTURES_OVERRIDE_DIR]) | ||
|
|
||
| const simpleTool = registry.get("simple") | ||
| expect(simpleTool).toBeDefined() | ||
| expect(simpleTool?.description).toBe("Simple tool - OVERRIDDEN") | ||
| }, 60_000) | ||
|
|
||
| it("should preserve order: first directory loaded first, second overrides", async () => { | ||
| await registry.loadFromDirectories([TEST_FIXTURES_OVERRIDE_DIR, TEST_FIXTURES_DIR]) | ||
|
|
||
| const simpleTool = registry.get("simple") | ||
| expect(simpleTool).toBeDefined() | ||
| expect(simpleTool?.description).toBe("Simple tool") | ||
| }, 60_000) | ||
|
|
||
| it("should handle non-existent directories in the array", async () => { | ||
| const result = await registry.loadFromDirectories([ | ||
| "/nonexistent/path", | ||
| TEST_FIXTURES_DIR, | ||
| "/another/nonexistent", | ||
| ]) | ||
|
|
||
| expect(result.loaded).toContain("simple") | ||
| expect(result.failed).toHaveLength(1) | ||
| }, 60_000) | ||
|
|
||
| it("should handle empty array", async () => { | ||
| const result = await registry.loadFromDirectories([]) | ||
|
|
||
| expect(result.loaded).toHaveLength(0) | ||
| expect(result.failed).toHaveLength(0) | ||
| }) | ||
|
|
||
| it("should combine results from all directories", async () => { | ||
| const result = await registry.loadFromDirectories([TEST_FIXTURES_DIR, TEST_FIXTURES_OVERRIDE_DIR]) | ||
|
|
||
| const simpleCount = result.loaded.filter((name) => name === "simple").length | ||
| expect(simpleCount).toBe(2) | ||
| }, 60_000) | ||
| }) | ||
|
|
||
| describe("loadFromDirectoriesIfStale", () => { | ||
| it("should load tools from multiple directories when stale", async () => { | ||
| const result = await registry.loadFromDirectoriesIfStale([TEST_FIXTURES_DIR, TEST_FIXTURES_OVERRIDE_DIR]) | ||
|
|
||
| expect(result.loaded).toContain("simple") | ||
| expect(result.loaded).toContain("unique_override") | ||
| }, 60_000) | ||
|
|
||
| it("should not reload if directories are not stale", async () => { | ||
| await registry.loadFromDirectoriesIfStale([TEST_FIXTURES_DIR]) | ||
| registry.clear() | ||
|
|
||
| const result = await registry.loadFromDirectoriesIfStale([TEST_FIXTURES_DIR]) | ||
|
|
||
| expect(result.loaded).toEqual([]) | ||
| }, 30_000) | ||
|
|
||
| it("should handle mixed stale and non-stale directories", async () => { | ||
| await registry.loadFromDirectoriesIfStale([TEST_FIXTURES_DIR]) | ||
|
|
||
| const result = await registry.loadFromDirectoriesIfStale([TEST_FIXTURES_DIR, TEST_FIXTURES_OVERRIDE_DIR]) | ||
|
|
||
| expect(result.loaded).toContain("simple") | ||
| expect(result.loaded).toContain("unique_override") | ||
| }, 60_000) | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.