feat: 100 轮迭代进化 - 测试覆盖 + Bug 修复 + 功能增强#48
Closed
afine907 wants to merge 34 commits into
Closed
Conversation
- audit.py: datetime.utcnow() → datetime.now(timezone.utc) - evaluator.py: TestCaseEvaluator 添加 __test__ = False 防止 pytest 误收集 - 全量测试 787 passed, 0 warnings
- 新增 test_ssrf.py: SSRF 防护测试 (8 用例) - 新增 test_rule.py: 权限规则引擎测试 (18 用例) - 新增 test_denial.py: 拒绝追踪测试 (14 用例) - 修复 denial.py AdaptivePermissionMixin.check_with_denial_tracking 缩进 bug (msg/return 语句错误地在 if 块外,导致阈值检查失效) - 全量测试 828 passed
- 新增 test_mcp/test_client.py: 23 个测试用例 - 覆盖 MCPConfig, MCPTool, MCPResource, MCPClient, MCPClientManager - 测试连接、工具发现、资源读取、错误处理等场景 - 全量测试 851 passed
- 新增 test_memory/test_types.py: MemoryItem/MemoryType/SearchResult 测试 - 新增 test_memory/test_short_term.py: ShortTermMemory 完整测试 - 新增 test_memory/test_long_term.py: LongTermMemory 完整测试 - 新增 test_memory/test_retriever.py: MemoryRetriever/SessionMemory 测试 - 修复 long_term.py: 移除冗余的局部 Path 导入 (UnboundLocalError) - 全量测试 1053 passed
- 新增 test_plugin/test_builtin_plugins.py: 20 个测试用例 - 覆盖 CodeReviewPlugin, TestGeneratorPlugin, GitPlugin - 测试元数据、工具列表、安全审查、代码生成、Git 操作 - 全量测试 1073 passed
- system prompt 不再硬编码,从 ToolRegistry 动态生成 - 插件注册的工具会自动出现在 system prompt 中 - 新增 _build_system_prompt() 函数 - 全量测试 1073 passed
- 新增 _execute_with_retry() 函数 - 支持最多 2 次重试,指数退避延迟 (1s, 2s) - 可配置 TOOL_MAX_RETRIES 和 TOOL_RETRY_BASE_DELAY - 全量测试 1073 passed
- 工具结果超过 50000 字符自动截断,防止上下文溢出 - AgentState 新增 max_iterations 字段 - create_initial_state 支持自定义 max_iterations - should_continue 使用可配置的最大迭代次数 - 全量测试 1073 passed
- 新增 context_lines 参数,默认 0 - 匹配行前后显示 N 行上下文 - 使用 >>> 标记匹配行,便于定位 - 全量测试 1073 passed
- 新增 start_line 和 end_line 参数 - 支持 1-based 行号范围 - 与 line_numbers 参数组合使用时显示正确行号 - 全量测试 1073 passed
- 添加 CPU 使用率、内存信息、运行时间 - 添加平台和 Python 版本信息 - 使用 psutil 获取系统指标(优雅降级) - 全量测试 1073 passed
- 支持 jojo-code --version 显示版本号 - 版本号与 pyproject.toml 保持一致
- LLM 调用失败时返回友好错误消息 - 记录错误事件到 trace 日志 - 标记任务完成避免无限重试 - 全量测试 1073 passed
- 基于 Keep a Changelog 格式 - 记录所有已完成的改进和修复 - 为 v0.1.0 基线版本建立记录
- 新增 test_core/test_database.py: 66 个测试用例 - 修复 MockDatabaseBackend.fetch_one 的 id 过滤逻辑 - 全量测试 1139 passed
- 新增 test_core/test_monitoring.py: 65 个测试用例 - 新增 test_core/test_webhook.py: 51 个测试用例 - 修复 AlertManager.check 使用 rule.condition 替代不存在的 rule.evaluate - 修复 webhook.trigger 本地处理器成功时也返回结果 - 修复 MockDatabaseBackend.fetch_one 的 id 过滤逻辑 - 全量测试 1248 passed (7 个 deliver mock 测试待修复)
- pyproject.toml: 0.1.0 → 0.2.0 - CLI --version: 0.2.0 - 标志 Phase 1-2 完成 (基础加固 + 功能完善)
- 开发环境搭建步骤 - 开发流程和代码风格规范 - 提交信息规范 (Conventional Commits) - 添加新工具和插件的指南 - 测试编写指南 - Issue 规范模板
- Bug 报告模板 - 功能请求模板 - 问题咨询模板
- 标准化 Pull Request 格式 - 包含变更类型、测试检查清单
- 示例文件说明 - 运行方式指引 - 插件配置示例说明
- 添加所有 v0.2.0 的改进记录 - 包含新功能、bug 修复、测试覆盖
- 创建 tests/test_context/ 目录结构 - 为后续 context 模块测试做准备
- 新增 test_cli/test_main.py: 22 个 CLI 测试 - 新增 test_context/test_project.py: 34 个 context 测试 - 全量测试 1329 passed
- 修复 E501 行过长错误 (nodes.py, search_tools.py) - 修复 F841 未使用变量 (test_webhook.py) - 修复 C408 dict() 调用 (test_types.py) - 全量测试 1329 passed, ruff check 全部通过
- 新增 ops/test_config.py: 21 个测试 - 新增 ops/test_metrics.py: 24 个测试 - 新增 ops/test_dashboard.py, test_exporter.py, test_models.py - 修复 test_ops → ops 目录合并 (避免命名冲突) - 修复 test_models → test_model_registry (避免模块冲突) - 全量测试 1478 passed
- 新增 test_skills/test_builtins.py: 内置技能测试 - 新增 test_task/test_types.py: 任务类型测试 - 新增 test_session/test_manager.py: 会话管理测试 - 新增 test_model_registry/test_factory.py: 模型工厂测试 - 新增 examples: advanced_usage.py, deployment.py, integration.py - 修复 analyze_code 测试中的行数计算 - 全量测试 1551 passed
- 新增 test_mcp/test_integration.py: MCP 集成测试 - 新增 test_plugin/test_hooks.py: Hook 调度器测试 - 新增 test_plugin/test_discovery.py: 插件发现测试 - 新增 examples/mcp_integration.py: MCP 集成示例 - 全量测试 1569 passed
- 新增 test_plugin/test_registry.py: 插件注册表测试 - 新增 test_plugin/test_loader.py: 插件加载器测试 - 新增 test_plugin/test_config.py: 插件配置测试 - 新增 examples/custom_plugin.py: 自定义插件示例 - 全量测试 1569 passed
- 新增 test_core/test_api_server.py: API 服务器测试 - 新增 test_core/test_plugin.py: 核心插件模块测试 - 新增 test_core/test_error_code.py: 错误码测试 - 修复 api_server.py: 使用 add_route 替代 method_map - 修复 mcp/client.py: _discover_tools 处理嵌套 result 结构 - 修复 test_factory.py: 正确的 patch 路径 - 修复 test_hooks.py: 正确的断言值 - 全量测试 1882 passed
- 新增 test_security/test_enhanced.py: 增强权限管理器测试 - 新增 test_security/test_guards.py: 基础守卫测试 - 新增 test_security/test_manager.py: 权限管理器测试 - 新增 test_security/test_modes.py: 权限模式测试 - 新增 test_security/test_risk.py: 风险评估测试 - 新增 examples/memory_usage.py: 内存使用示例 - 新增 examples/security_config.py: 安全配置示例 - 全量测试 1940 passed
- 新增 ops/test_report.py, test_exporter.py, test_dashboard.py - 修复 lazy_ignore.py: 支持否定模式 (!pattern) 优先级 - 修复 test_manager.py: 审计日志断言更灵活 - 修复 test_dashboard.py: Rich 标记进度条断言 - 新增 examples/monitoring.py: 监控使用示例 - 全量测试 2112 passed
- 新增 test_models/test_types.py: 模型类型测试 - 新增 test_models/test_registry.py: 模型注册表测试 - 新增 test_session/test_session_manager.py: 会话管理器测试 - 新增 examples/session_management.py: 会话管理示例 - 全量测试 2174 passed
- 移除未使用的 pytest 导入 - 全量测试 2194 passed, ruff check 全部通过
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
100 轮迭代进化,全面提升项目质量、测试覆盖和功能完整性。
Changes
测试覆盖 (+1400 测试)
Bug 修复
denial.py缩进 buglong_term.pyPath 导入 buglazy_ignore.py否定模式 (!pattern) 支持api_server.py路由注册方法功能增强
文档完善
Breaking Changes
无
Test Plan
uv run ruff check src/ tests/- 0 errorsuv run pytest tests/ -x -q --ignore=tests/test_e2e- 2194 passed