Skip to content

refactor(agentflow): update import paths and clean up test utilities#5789

Merged
jocelynlin-wd merged 2 commits intomainfrom
refactor/agentflow-sdk-alias-path-cleanup
Feb 19, 2026
Merged

refactor(agentflow): update import paths and clean up test utilities#5789
jocelynlin-wd merged 2 commits intomainfrom
refactor/agentflow-sdk-alias-path-cleanup

Conversation

@jocelynlin-wd
Copy link
Copy Markdown
Contributor

  • Refactor import paths to use absolute paths (alias) for better readability and maintainability.
  • Remove unused function initializeDefaultNodeData from nodeFactory and its related tests.
  • Update TESTS.md to reflect the current testing status of various modules.
  • Minor adjustments to Vite configuration for improved development experience.

- Refactor import paths to use absolute paths (alias) for better readability and maintainability.
- Remove unused function `initializeDefaultNodeData` from `nodeFactory` and its related tests.
- Update `TESTS.md` to reflect the current testing status of various modules.
- Minor adjustments to Vite configuration for improved development experience.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jocelynlin-wd, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on improving the developer experience and code quality within the agentflow package. It introduces absolute import paths for better module resolution and readability, cleans up an obsolete utility function and its tests, and refines the logic for initializing node data. Additionally, the documentation for testing status has been updated to accurately reflect the current state of the project.

Highlights

  • Import Path Refactoring: Refactored numerous relative import paths across the agentflow package to use absolute aliases (e.g., @/core/types), enhancing readability and maintainability.
  • Test Utility Cleanup: Removed the unused initializeDefaultNodeData function from nodeFactory and its corresponding test suite, streamlining the codebase.
  • Vite Configuration Update: Adjusted the Vite configuration to include a new @ alias, supporting the absolute import paths introduced in this refactor.
  • Node Initialization Logic Refinement: Updated the initNode function to ensure that node parameters without an explicit default value now fall back to an empty string (''), aligning with Agentflow v2 behavior for show/hide conditions.
  • Documentation Update: The TESTS.md file was updated to reflect the current testing status and provide clearer descriptions for various modules.
Changelog
  • packages/agentflow/TESTS.md
    • Updated table formatting and descriptions for test coverage.
    • Updated list formatting for consistency.
  • packages/agentflow/examples/vite.config.ts
    • Added a new alias @ for absolute imports.
  • packages/agentflow/src/test_utils/factories.ts
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/atoms/Input.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/atoms/NodeInputHandler.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/core/utils/index.ts
    • Removed initializeDefaultNodeData from public exports.
  • packages/agentflow/src/core/utils/nodeFactory.test.ts
    • Updated import path to use the new absolute alias.
    • Removed tests for initializeDefaultNodeData.
    • Updated initNode test for default value behavior.
  • packages/agentflow/src/core/utils/nodeFactory.ts
    • Removed a TODO comment.
    • Made initializeDefaultNodeData private and updated its JSDoc.
    • Refactored initNode to use initializeDefaultNodeData for input initialization.
  • packages/agentflow/src/features/canvas/components/AgentflowHeader.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/canvas/components/ConnectionLine.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/canvas/components/NodeIcon.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/canvas/components/NodeModelConfigs.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/canvas/components/NodeOutputHandles.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/canvas/components/NodeToolbarActions.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/canvas/containers/AgentFlowEdge.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/containers/AgentFlowNode.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/containers/IterationNode.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/containers/StickyNote.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/hooks/useDragAndDrop.ts
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/hooks/useFlowHandlers.ts
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/hooks/useFlowNodes.ts
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/nodeIcons.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/canvas/styled.ts
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/generator/GenerateFlowDialog.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/generator/SuggestionChips.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/node-editor/EditNodeDialog.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/node-palette/AddNodesDrawer.tsx
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/features/node-palette/StyledFab.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/features/node-palette/search.ts
    • Updated import paths to use the new absolute alias.
  • packages/agentflow/src/infrastructure/api/chatflows.ts
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/infrastructure/api/nodes.ts
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/infrastructure/store/AgentflowContext.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/infrastructure/store/ConfigContext.tsx
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/infrastructure/store/agentflowReducer.test.ts
    • Updated import path to use the new absolute alias.
  • packages/agentflow/src/infrastructure/store/agentflowReducer.ts
    • Updated import path to use the new absolute alias.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great refactoring effort. The transition to absolute import paths using aliases significantly improves code readability and maintainability. The cleanup of the test utilities, including making a function private and updating its usage, is also a welcome improvement. The logic change to initialize default node data is well-contained and documented. I have one suggestion regarding the formatting of TESTS.md to improve the maintainability of the documentation source. Overall, this is a solid contribution that enhances the codebase's quality.

@jocelynlin-wd
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a solid refactoring effort that significantly improves the project's maintainability by switching to absolute import paths using the @ alias. The cleanup of the nodeFactory utility by internalizing initializeDefaultNodeData and simplifying initNode is a good improvement, and the accompanying test updates and documentation changes in TESTS.md are consistent.

My main feedback is to ensure the test setup is also updated. While the Vite config is correctly adjusted for the example app, the Jest configuration will also need to be updated to recognize the new @ alias to prevent test failures. I've left a specific comment with a suggestion on how to address this.

@jocelynlin-wd jocelynlin-wd merged commit a1e9af7 into main Feb 19, 2026
7 checks passed
@jocelynlin-wd jocelynlin-wd deleted the refactor/agentflow-sdk-alias-path-cleanup branch February 19, 2026 23:35
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.

3 participants