Commit graph

3279 commits

Author SHA1 Message Date
Max
45c01f9c04 Update TODO_V2.md and .gitignore for New Test Plan Documentation
- Added `UPGRADE_PLAN.md` to .gitignore to exclude the new upgrade plan documentation from version control.
- Revised TODO_V2.md to include a detailed implementation plan for the Agent Test Framework, outlining phases for before/after scripts, agent-driven assertions, and dynamic mode features.
- Improved overall documentation clarity to facilitate understanding of upcoming enhancements and tasks within the framework.
2025-12-26 09:10:27 +08:00
Max
2ec28a1710 Enhance DESIGN_V2.md and TODO_V2.md with Before/After Script Support
- Updated DESIGN_V2.md to introduce support for `before` and `after` scripts in JSONL test cases, detailing their usage and execution order.
- Added examples for defining and utilizing before/after functions, including global initialization and cleanup processes.
- Revised TODO_V2.md to outline tasks for implementing before/after script functionality, ensuring clarity on remaining development efforts.
- Improved overall documentation to facilitate understanding of the new scripting capabilities in the Agent Test Framework.
2025-12-26 08:58:33 +08:00
Max
a5e974dc07 Update DESIGN_V2.md and TODO_V2.md for Output Format Enhancements
- Revised DESIGN_V2.md to clarify output formats for console and JSON, including detailed descriptions for standard, dynamic, and parallel modes.
- Updated the console output sections to provide clearer examples and summaries of test results, enhancing readability and usability.
- Modified TODO_V2.md to reflect the change from JSONL to JSON output format for message counts, ensuring consistency in documentation.
- Improved overall documentation to support better understanding of output handling in the Agent Test Framework.
2025-12-25 18:58:31 +08:00
Max
c34cae62e8 Update DESIGN_V2.md and TODO_V2.md for Input Field Enhancements
- Revised DESIGN_V2.md to clarify the `input` field's capabilities, allowing for string, single message, or message array formats for conversation context.
- Updated the test case format to reflect the new `input` structure, ensuring compatibility with existing single-turn tests.
- Enhanced TODO_V2.md to indicate the completion of message history support and outline remaining tasks, including options field support and JSONL output format updates.
- Improved documentation to ensure clarity on the new input handling and its implications for agent-driven testing.
2025-12-25 18:16:26 +08:00
Max
d03668e876 Enhance DESIGN_V2.md and TODO_V2.md for Message History Support
- Updated DESIGN_V2.md to introduce message history support in the Agent Test Framework, allowing tests to simulate multi-turn conversations without complex state management.
- Revised the test case format to include a `messages` field, enabling the passing of full conversation history directly to the agent.
- Enhanced TODO_V2.md to outline tasks for implementing message history support, including updates to the test case parser and output formats.
- Improved documentation on agent-driven assertions and error handling to reflect the new capabilities and ensure clarity for developers.
2025-12-25 18:10:52 +08:00
Max
d58aa12d4d Enhance DESIGN_V2.md and TODO_V2.md for Multi-Turn Testing
- Added detailed sections on Static and Dynamic modes in DESIGN_V2.md, outlining their characteristics and execution flows for multi-turn testing.
- Introduced a Quick Reference table for format rules, clarifying the usage of flags and assertions in test cases.
- Updated TODO_V2.md to reflect tasks for implementing mode support, including the addition of checkpoints and handling of order constraints in dynamic testing.
- Improved documentation for error handling in both static and dynamic modes, ensuring clarity on expected behaviors during test execution.
2025-12-25 17:57:26 +08:00
Max
38dd455cc5 Update DESIGN_V2.md and TODO_V2.md for Agent Test Framework
- Corrected references in DESIGN_V2.md to ensure consistent usage of agent identifiers, including updates to input sources and simulator configurations.
- Enhanced the documentation in TODO_V2.md with a summary of format rules for agent testing, clarifying the usage of prefixes for various contexts and options.
- Added tasks related to the dynamic simulator implementation and metadata handling to guide future development efforts.
2025-12-25 17:43:34 +08:00
Max
d7b84bdf36 Enhance Documentation and Add JSONL Support for Agent Assertions
- Updated the DESIGN_V2.md file to clarify the usage of agent-driven assertions in JSONL test cases, including detailed examples and API specifications.
- Introduced a new section on script testing with agent assertions, outlining the implementation and usage of the `t.assert.Agent()` method.
- Modified the TODO_V2.md file to reflect the addition of JSONL support for agent assertions and outlined tasks for further development in this area.
2025-12-25 17:35:30 +08:00
Max
e417944850 Enhance Test Framework with Standard Agent Interface and Options Support
- Introduced a comprehensive standard agent interface for agent-driven features, including generator, simulator, and validator modes.
- Added support for `context.Options` to pass parameters in test cases, allowing for flexible configuration of agent behavior.
- Updated test case format to include options at both the test and per-turn levels, enhancing customization and control over agent interactions.
- Expanded documentation to detail the usage of options in various agent modes, improving clarity for developers and users.
2025-12-25 17:26:58 +08:00
Max
2e2ce8bfad Refactor LoadWithRoot Function for Enhanced Clarity and Consistency
- Further streamlined the LoadWithRoot function by removing redundant checks and improving the overall readability of the path resolution logic.
- Ensured consistent resolution of the absolute path for the configuration root, enhancing maintainability and clarity in the codebase.
2025-12-25 14:18:27 +08:00
Max
17013f459f Update .gitignore and Refactor Path Resolution in Config
- Added MULTI_TURN_DESIGN.md to .gitignore to prevent tracking of design documents in the test directory.
- Refactored the LoadWithRoot function in config.go for improved readability by adjusting indentation for the absolute path resolution logic.
2025-12-25 12:13:04 +08:00
Max
8223a44885 Fix Redundant Code in LoadWithRoot Function for Path Resolution
- Removed unnecessary conditional check in the LoadWithRoot function, streamlining the path resolution logic for the configuration root.
- Ensured that the function consistently resolves the absolute path of the configuration root, improving code clarity and maintainability.
2025-12-25 12:05:49 +08:00
Max
7f44e442da Enhance File Handling and Input Parsing in Test Framework
- Introduced support for file attachments in test inputs using the `file://` protocol, allowing images, audio, and documents to be loaded and converted to appropriate formats.
- Updated `ParseInput` and related functions to handle file references, ensuring seamless integration of file content into messages.
- Enhanced error handling and path resolution for file loading, considering both relative paths and the `YAO_ROOT` environment variable.
- Expanded documentation to include examples of file attachments and their usage in test cases, improving clarity for users.
2025-12-25 11:50:58 +08:00
Max
97d0ad1d24 Add GetAuthorizedMap Method to Context for Authorization Data Retrieval
- Implemented GetAuthorizedMap method in the Context struct to return authorized information as a map.
- This method adheres to the AuthorizedProvider interface, facilitating authorization context access for MCP process calls.
- Enhances the ability of MCP tools to receive and utilize authorization data during Process transport interactions.
2025-12-25 10:16:23 +08:00
Max
8aa373b969 Refactor Logging in Mail Receiver to Use Structured Logging
- Replaced standard log statements with structured logging using the kun/log package for improved log clarity and consistency.
- Updated log messages in the MailReceiver to include contextual information, enhancing the ability to trace issues during email processing.
- This change aims to provide better insights into the email receiver's operations and error handling.
2025-12-24 09:51:05 +08:00
Max
809792c152 Add Authorized Data Sharing in Script Runner Execution
- Introduced functionality to set shared data with authorized information for Process calls in the ScriptRunner.
- Enhanced the executeTestFunction to include error handling for setting share data, improving robustness during script execution.
- This change ensures that authorization context is properly managed when calling JavaScript functions directly, enhancing security and functionality.
2025-12-23 08:20:47 +08:00
Max
4c80c3ffa0 Enhance Script Runner Error Handling and Fail-Fast Logic
- Updated the ScriptRunner to treat both StatusFailed and StatusError as failures, improving failure reporting in test results.
- Modified the fail-fast logic to stop execution on both failure statuses, ensuring quicker feedback during test runs.
- Enhanced error handling in executeTestFunction to recover from panics and provide clearer error messages for JavaScript exceptions, improving test reliability and debugging.
2025-12-22 18:41:13 +08:00
Max
6ce6b65567 Enhance Memory Namespace Isolation Tests and Functionality
- Expanded the memory isolation tests to cover user, team, chat, context, and key operations, ensuring comprehensive validation of namespace behavior.
- Implemented pattern-based key retrieval and length calculation in the Namespace struct for improved efficiency and flexibility.
- Added assertions to verify that operations on one namespace do not affect others, reinforcing the integrity of memory isolation across different contexts.
2025-12-22 14:54:42 +08:00
Max
fb4be8cb80 Update Memory Leak Test Comments and Thresholds
- Adjusted comments in the memory leak tests to clarify the rationale behind the threshold increase to 20KB, ensuring better understanding of expected memory behavior.
- Increased the memory growth threshold per iteration in the tests to accommodate higher usage observed in business scenarios, enhancing the accuracy of leak detection.
2025-12-22 11:45:17 +08:00
Max
01ddc3ad24 Update Memory Leak Test Thresholds to 20KB
- Increased the allowed memory growth threshold per iteration in the memory leak tests from 15KB to 20KB to accommodate higher memory usage observed in business scenarios and standard mode operations.
- Updated comments to reflect the rationale behind the new threshold and to clarify expected memory behavior during tests, ensuring better understanding and accuracy in leak detection.
2025-12-22 11:42:08 +08:00
Max
632c0f5674 Refactor Context Management to Use Memory Instead of Space
- Replaced all instances of `ctx.Space` with `ctx.Memory.Context` in the context management code, ensuring a more structured approach to handling temporary request-scoped data.
- Updated related test cases to reflect the changes in context memory usage, enhancing the reliability and clarity of tests.
- Removed the deprecated `Space` references and adjusted comments and documentation to align with the new memory management strategy.
2025-12-22 11:19:00 +08:00
Max
51be1844d5 Refactor Auth Integration Tests to Use Dynamic Collection IDs
- Removed hardcoded collection IDs in `search_auth_integration_test.go` and replaced them with dynamically generated IDs to ensure uniqueness during test runs.
- Simplified the setup and cleanup processes by introducing the `authTestCollections` struct, which manages the lifecycle of test collections.
- Updated test cases to utilize the new collection management approach, enhancing test reliability and reducing potential conflicts during parallel execution.
2025-12-22 09:36:50 +08:00
Max
e275116022 Refactor Store Management to Replace Badger with Xun
- Removed references to Badger in the `utils.go` and `utils_test.go` files, replacing it with Xun as the primary data store.
- Updated test cases and comments to reflect the change in store preference, ensuring consistency across the codebase.
- Adjusted the testing guide to provide accurate information regarding store management and fallback options.
2025-12-22 09:27:32 +08:00
Max
a966ad83ee Enhance Cleanup Logic in Auth Integration Tests
- Updated the cleanup process in `cleanupAuthCollections` to include a waiting mechanism for Qdrant to fully process deletions, improving reliability of test setups.
- Removed unnecessary sleep calls and added logging to warn if collections still exist after cleanup, ensuring better visibility during test execution.
- Refactored comments for clarity regarding the cleanup process in both `TestAuthSearchSetup` and `ensureAuthTestData` functions.
2025-12-22 09:19:23 +08:00
Max
47290d439d Refactor Data Store Implementation and Update Tests
- Replaced Badger with Xun as the primary data store across various components, including OAuth, agent memory, and knowledge base stores, enhancing performance and flexibility.
- Updated the configuration files to reflect the new Xun store paths and removed obsolete Badger store files.
- Refactored test cases to utilize the new Xun store, ensuring compatibility and improved test reliability.
- Enhanced test setup functions to initialize the Xun store correctly, streamlining the testing process and ensuring a consistent environment.
2025-12-22 09:07:41 +08:00
Max
5e64c78435 Implement Script Testing Framework and Enhance Test Context Management
- Introduced a new script testing mode to allow testing of agent handler scripts (hooks, tools, etc.) using a Go-like interface, enabling better unit testing of TypeScript/JavaScript code.
- Enhanced the `LoadScripts` function to skip test files during script loading, ensuring only relevant scripts are processed.
- Refactored the test context creation to support custom context configurations via a JSON file, allowing for flexible authorization and metadata management during tests.
- Updated the test runner to handle script tests, including the ability to filter tests using regex patterns and manage custom context data.
- Improved documentation to include details on script testing usage, input formats, and available assertions, enhancing developer experience and clarity.
2025-12-21 10:44:59 +08:00
Max
aacb81fb52 Enhance Test Cases and Improve Parallel Search Logic
- Updated multiple test cases in `jsapi_test.go` to utilize `testutils.Prepare` and `testutils.Clean` for better test setup and teardown, ensuring a consistent testing environment.
- Refactored the `parallelAny` and `parallelRace` methods in `search.go` to improve goroutine management and result handling, reducing unnecessary locking and enhancing performance.
- Implemented checks to prevent goroutines from executing after a successful result is found, optimizing resource usage during parallel searches.
2025-12-20 16:46:54 +08:00
Max
580da82033 Refactor Test Setup and Enhance Data Initialization
- Removed redundant test environment initialization code and replaced it with a streamlined approach using `testutils.Prepare` for better clarity and maintainability.
- Introduced utility functions `ensureAuthTestData` and `createAuthTestData` to manage the setup of test collections and documents, ensuring that necessary data is available for tests.
- Updated multiple test cases to utilize the new data initialization methods, improving test reliability and reducing setup complexity.
2025-12-20 15:50:57 +08:00
Max
e46645a986 Refactor Authorization Functions and Update Tests
- Renamed functions for consistency and clarity, changing `buildDBAuthWheres` to `BuildDBAuthWheres` and `filterKBCollectionsByAuth` to `FilterKBCollectionsByAuth`.
- Enhanced test cases to utilize the updated function names, ensuring proper authorization checks in the search functionality.
- Improved test environment initialization to streamline setup processes and ensure robust testing of authorization logic.
- Verified that search results adhere to authorization constraints, ensuring only accessible collections are queried based on user permissions.
2025-12-20 15:02:01 +08:00
Max
b63f3fe246 Refactor KB Search Handler and Update Test Cases
- Enhanced the KB search handler to utilize the KB API for executing search queries, improving search accuracy and performance.
- Implemented authorization checks for collections in the search requests, ensuring only accessible collections are queried.
- Updated the search request structure to include metadata filtering capabilities, allowing for more refined search results.
- Refactored unit tests to validate new search functionalities, including threshold handling and collection initialization checks, ensuring robust test coverage.
- Adjusted the Makefile to streamline test coverage reporting and updated GitHub Actions workflows to include Codecov integration for better visibility on test coverage metrics.
2025-12-20 14:43:00 +08:00
Max
f58aea7459 Update Dockerfiles and GitHub Actions to use version 1.0.0
- Updated the Dockerfiles and GitHub Actions workflows to reference version 1.0.0 of the Yao build environment and Go, ensuring compatibility with the latest features and improvements.
- Adjusted the Go version in the macOS workflow and updated the Dockerfile to install Go 1.25.0, enhancing the build process.
2025-12-20 12:12:57 +08:00
Max
f8bcea23fc Update GitHub Actions workflows to use Go version 1.25
- Changed the Go version in multiple workflow files from 1.24 to 1.25, ensuring compatibility with the latest features and improvements in the Go programming language.
2025-12-20 11:54:53 +08:00
Max
09d368dae7 Add KB Tests and Update Makefile for Test Management
- Introduced a new unit test target for KB tests in the Makefile, allowing for dedicated testing of the KB module.
- Updated the test folder selection logic to exclude additional AI-related components, ensuring focused testing.
- Enhanced the GitHub Actions workflows to include KB tests, setting up necessary services like Qdrant, Neo4j, and MongoDB for a comprehensive testing environment.
- Refactored search test functions to improve data existence checks and streamline test setup processes, enhancing test reliability and maintainability.
2025-12-20 11:44:09 +08:00
Max
53db8be522 Enhance Collection Retrieval and Existence Check Logic
- Updated the `GetCollection` method to first read from the database for existence and permissions, improving data integrity.
- Merged metadata from GraphRag into the result, ensuring backward compatibility and enhanced data representation.
- Refactored the `CollectionExists` method to check both the database and GraphRag for consistency, logging any mismatches for debugging purposes.
- Introduced new types and structures for search operations, including `SearchMode`, `Query`, and `SearchResult`, to support advanced search functionalities.
2025-12-20 11:25:02 +08:00
Max
fa471bc4c4 Update tests to use context and correct URL references
- Modified the `createTestContext` function to use `context.Background()` for improved context management in tests.
- Updated the URL in the `TestAddURL` function to point to the correct Yao Agent Caller resource, ensuring accurate test assertions for added URLs.
2025-12-19 20:10:16 +08:00
Max
493f9dbea2 Update test case for SerpAPIProvider to reflect new query and expected result
- Changed the query in the `TestSerpAPIProviderWithAssistantConfig` from "Yao App Engine" to "golang programming language" to align with updated test expectations.
- Updated the expected result assertion to match the new query, ensuring the test accurately verifies the functionality of the search handler.
2025-12-19 19:48:00 +08:00
Max
8dcb78fc37 Update serpAPIKnowledge struct to allow flexible type for 'Type' field
- Modified the 'Type' field in the serpAPIKnowledge struct to use an interface{}, enabling it to accept either a string or an object based on the query context.
- This change enhances the flexibility of the knowledge graph data representation in the search handler.
2025-12-19 15:26:18 +08:00
Max
324ee7dc92 Refactor Job System for Enhanced Function Execution and Error Handling
- Improved the `Job` struct to support dynamic function execution with the `AddFunc` method, allowing for flexible job management.
- Enhanced the `Goroutine` struct with the `ExecuteFunc` method to manage function execution, including robust error handling and context management.
- Updated unit tests for `AddFunc` to ensure proper function registration and execution, including memory cleanup verification.
- Revised documentation to reflect the new function execution capabilities within the job system.
2025-12-19 15:08:16 +08:00
Max
01820d9fe2 Add function execution support to Job system
- Introduced `AddFunc` method to the `Job` struct for adding Go functions as job executions, allowing for dynamic execution of functions with specified arguments.
- Enhanced internal execution handling to register functions in a global registry, ensuring proper cleanup after execution.
- Implemented `ExecuteFunc` method in the `Goroutine` struct to handle the execution of registered functions, including error handling and context management.
- Added comprehensive unit tests for `AddFunc`, verifying function registration, execution, and memory cleanup post-execution.
- Updated related documentation to reflect the new functionality and usage patterns for adding and executing Go functions within the job system.
2025-12-19 14:50:53 +08:00
Max
36939cd53a Enhance Search Execution Results with DSL Handling
- Added a `Results` field to the `SearchExecutionResult` struct to store raw search results, facilitating the extraction of DSL from database searches.
- Implemented logic in the `saveSearch` method to extract and store the first DSL from DB search results, improving data retention for search operations.
- Introduced a `dslToMap` method in the DB handler to convert QueryDSL to a map format for storage, enhancing the flexibility of result handling.
- Updated the `Result` struct to include a `DSL` field for generated QueryDSL, ensuring comprehensive data representation for database search results.
2025-12-19 09:38:55 +08:00
Max
3cf3060e0c Enhance Search Functionality with Keyword Extraction and Intent Detection
- Updated the search handling to incorporate keyword extraction with weights, improving the relevance of search results.
- Refactored the `shouldAutoSearch` method to return a `SearchIntent` struct, allowing for more nuanced control over search execution based on context.
- Enhanced the `buildSearchRequests` function to utilize extracted keywords, optimizing search queries based on user input.
- Improved the handling of search types and conditions, ensuring that the system can dynamically adjust search behavior based on intent and configuration.
- Updated documentation and prompts to reflect changes in keyword extraction and search intent classification, providing clearer guidelines for usage.
2025-12-18 20:16:56 +08:00
Max
99ac7abdf1 Refactor AgentReporter to Use Direct Response Handling
- Updated the AgentReporter to handle *context.Response directly instead of using type assertions, simplifying the response extraction process.
- Enhanced the extractContent method to prioritize accessing the Next field and completion content, improving robustness in data retrieval.
- Improved code readability by streamlining the response handling logic, aligning with recent refactorings in the agent's response processing.
2025-12-18 17:37:37 +08:00
Max
637a0c9cbd Refactor Agent Response Handling to Use Structured Response Types
- Updated the agent's Stream and response processing methods to return and handle *context.Response directly, eliminating the need for type assertions.
- Simplified test cases by removing unnecessary type conversions and directly accessing response fields.
- Enhanced the extraction of data from Next hook responses, ensuring more robust handling of custom data structures.
- Improved overall code readability and maintainability by streamlining response handling logic across various components.
2025-12-18 17:32:49 +08:00
Max
01bf7dce58 Refactor buildRequestMessage to use structured JSON format for agent communication
- Updated the buildRequestMessage function to construct a JSON object for structured communication with the agent, replacing the previous string formatting approach.
- Enhanced the handling of extra parameters, scenarios, and retry context by incorporating them into the JSON structure.
- Improved the parseResult function to extract additional fields such as explain and warnings from the response, ensuring comprehensive result handling.
- Streamlined the code for better readability and maintainability while preserving existing functionality.
2025-12-18 12:37:35 +08:00
Max
1d965420ad Add integration tests for graceful handling of nonexistent and partially existing models in search
- Introduced new test cases to validate the behavior of the search handler when querying with nonexistent models, ensuring it returns appropriate error messages without panicking.
- Added a test for scenarios where only some of the requested models exist, confirming that the search can still succeed with valid models while handling errors gracefully.
- Updated the search handler to improve error handling by checking for model existence before proceeding with the search, enhancing robustness in search operations.
2025-12-18 12:20:20 +08:00
Max
19153ee4a5 Refactor Test Files and Enhance Test Environment Initialization
- Reorganized import statements in test files to improve clarity and consistency.
- Updated comments in test cases to provide more detailed descriptions of the test environment initialization process.
- Enhanced the `Prepare` function in the test utilities to include registration of the default query engine, ensuring proper setup for database searches.
- Improved error handling during the loading of the knowledge base and query engine, enhancing robustness in test setups.
2025-12-18 12:11:51 +08:00
Max
a6864e8674 Update expr dependency to v1.17.7 in go.mod and go.sum
- Bumped the version of the expr-lang/expr package from v1.17.3 to v1.17.7 to incorporate the latest features and fixes.
- Updated the go.sum file to reflect the new dependency version and its associated checksums.
2025-12-18 11:56:37 +08:00
Max
2f1e4b9f33 Implement Context-Aware Search Functionality and Enhance QueryDSL Generation
- Refactored the Search method to support context-aware execution, allowing handlers to utilize context when performing searches.
- Introduced a new SearchWithContext method in the handler interface to facilitate context-based search operations.
- Updated the DB handler to implement the context-aware search, ensuring proper QueryDSL generation and execution.
- Enhanced test cases to validate the new context requirements and scenarios for database searches, improving error handling and robustness.
- Added scenario type support for QueryDSL generation, allowing for more complex query handling.
- Updated documentation to reflect the new context handling and scenario features in search operations.
2025-12-18 11:49:28 +08:00
Max
4abc7e41ef Enhance Options and Metadata Handling in Context and Test Cases
- Added support for a new `Metadata` field in the `Options` struct to allow passing custom data to hooks, enhancing flexibility in context management.
- Updated the `ToMap` and `OptionsFromMap` methods to include serialization and deserialization of the `Metadata` field.
- Enhanced the test case structure to include an `Options` field, allowing for per-test-case configuration, including metadata and skip options.
- Updated documentation to reflect the new `options` and `metadata` fields, providing clear examples for users on how to utilize these features in test cases.
2025-12-18 11:03:55 +08:00
Max
b8c5829eb0 Refactor Keyword Extraction and QueryDSL Generation for Context Requirement
- Updated the keyword extraction and QueryDSL generation processes to require a context parameter, enhancing the robustness of the extraction methods.
- Replaced the previous frequency-based extraction with a system agent approach, utilizing the __yao.keyword and __yao.querydsl agents for improved accuracy and context awareness.
- Removed obsolete builtin extraction implementations and tests, streamlining the codebase.
- Enhanced test cases to validate the new context requirements, ensuring proper error handling when context is not provided.
- Updated documentation to reflect changes in the extraction methods and their dependencies on context.
2025-12-17 17:55:58 +08:00