-
Notifications
You must be signed in to change notification settings - Fork 0
feat: v0.6.0 - source_path param, stress_test error detail, docs - #2
feat: v0.6.0 - source_path param, stress_test error detail, docs #2SummerOneTwo merged 2 commits into
Conversation
- Add source_path parameter to all build tools (solution_build, generator_build, validator_build, checker_build, interactor_build) as alternative to passing full source code via code parameter - Add encoding fallback (UTF-8 -> latin-1) for source_path files - Add include_dirs support so relative includes work with source_path - Enhance stress_test_run error messages with seed, cmd_args, stdout, stderr, last_input for easier debugging - Distinguish generator failure modes (timeout/empty output/crash) with mode-specific hints - Document generator_args protocol and n_max parameter relationship - Add effective_n_max to stress_test_run success result - Add problem directory structure docs to CLAUDE.md - Bump version to 0.6.0
6b531ce to
d48c121
Compare
There was a problem hiding this 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 releases v0.6.0 by adding source_path support across build tools, improving stress_test_run generator failure diagnostics, and updating documentation/versioning.
Changes:
- Add
source_path(optional) to build tools, with encoding fallback and include-dir support for relative#include. - Enhance
stress_test_rungenerator failure reporting (seed/cmd_args/stdout/stderr/last_input) and exposeeffective_n_maxon success. - Update docs (generator_args protocol, n_max semantics, problem directory layout) and bump version to 0.6.0.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Updates locked editable package version entry. |
| src/autocode_mcp/tools/validator.py | Adds source_path input and include-dir support for validator build. |
| src/autocode_mcp/tools/stress_test.py | Improves generator error classification/details; returns effective_n_max. |
| src/autocode_mcp/tools/solution.py | Adds source_path input and include-dir support for solution builds. |
| src/autocode_mcp/tools/mixins.py | Extends build mixin to forward include_dirs into compilation. |
| src/autocode_mcp/tools/interactor.py | Adds source_path input and include-dir support for interactor build. |
| src/autocode_mcp/tools/generator.py | Adds source_path input and include-dir support for generator build. |
| src/autocode_mcp/tools/checker.py | Adds source_path input and include-dir support for checker build. |
| pyproject.toml | Bumps project version to 0.6.0. |
| CLAUDE.md | Documents problem directory structure and adds problem_validate in tool list. |
| CHANGELOG.md | Adds 0.6.0 release notes describing new features/improvements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里举例写"如 GBK",但实现仅做 UTF-8 读取失败后回退 latin-1;latin-1 并不能正确解码 GBK(只是不会抛解码异常),可能导致源码内容乱码。建议要么实现真正的 GBK/自动检测(如优先尝试 gbk/cp936,或引入 charset 检测),要么把文档表述改为"回退到 latin-1(宽松解码)"而不暗示支持 GBK。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当前 input_schema 只要求 problem_dir,但 execute() 实际要求必须提供 code 或 source_path(二选一)。这会让 MCP client 依据 schema 生成/校验参数时遗漏必填字段。建议在 schema 增加 anyOf/oneOf 来约束至少提供一个(例如 anyOf: [{required:["code"]},{required:["source_path"]}]),同时保留 source_path 优先级逻辑。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当前 input_schema 只要求 problem_dir,但 execute() 实际要求必须提供 code 或 source_path(二选一)。这会导致 client 依据 schema 生成/校验参数时可能遗漏必填字段。建议在 schema 增加 anyOf/oneOf 来约束至少提供一个(例如 anyOf: [{required:["code"]},{required:["source_path"]}])。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里读取 input.txt 时未指定 encoding,依赖系统默认编码;但 _generate_input 写入时固定使用 UTF-8。非 UTF-8 默认环境下可能出现解码异常或读到错误内容。建议读取时也显式指定 encoding="utf-8"(与写入保持一致)。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新增的 source_path 参数(含相对路径解析 + include_dirs 注入 + 编码回退)目前在 tests/test_tools 下没有覆盖:现有工具测试都只通过 code 字符串调用 build。建议补充至少一个用例:将源码写到临时文件后通过 source_path 调用,并验证包含相对 #include 的场景能成功编译。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里增强了 generator 失败时返回的诊断字段(seed/cmd_args/stdout/stderr/last_input)以及成功时的 effective_n_max,但 tests/test_tools/test_stress_test.py 目前只覆盖"通过/缺少生成器"等路径,没有断言这些新增字段是否按预期返回。建议补充一个让 generator 超时/空输出/崩溃的用例,验证错误类型提示与 data 字段完整性。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当前 input_schema 只要求 problem_dir,但 execute() 实际要求必须提供 code 或 source_path(二选一)。建议在 schema 增加 anyOf/oneOf 来约束至少提供一个,避免 client 按 schema 调用时得到运行期报错。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当前 input_schema 只要求 problem_dir,但 execute() 实际要求必须提供 code 或 source_path(二选一)。建议在 schema 增加 anyOf/oneOf 来约束至少提供一个,避免 client 按 schema 调用时参数不完整。
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当前 input_schema 只要求 problem_dir,但 execute() 实际要求必须提供 code 或 source_path(二选一)。建议在 schema 增加 anyOf/oneOf 来约束至少提供一个,避免 client 依据 schema 调用时遗漏参数。
- Add anyOf to 5 build tool schemas enforcing code/source_path requirement - Fix CHANGELOG: remove misleading GBK example for latin-1 fallback - Add encoding="utf-8" to stress_test.py file reads - Add tests for source_path (success, not found, neither provided) - Add test for stress_test generator failure diagnostics
Summary
source_path参数,可直接指定源文件路径,无需传入完整源码字符串。支持编码回退(UTF-8 → latin-1)和相对 include 路径。Changes
Test plan
uv run pytest tests/ -q— 176 passeduvx ruff check .— All checks passed