fix: resolve 3 Copilot review comments — CLI entry, path heuristic, source path#7
Merged
Merged
Conversation
…ource path - server.py: add sync_main() wrapper for console_scripts entry point, align version to 2.0.0 - source_connector.py: require path separator in _looks_like_path to avoid Chinese text misdetection - sources.yaml: correct relative path to ../../targets/ for repo-root targets directory Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to address previously reported review findings in the exam-memory MCP package (CLI entry point correctness, safer path heuristics, and correct relative source paths), within the project’s exam-prep harness.
Changes:
- Fixed the
exam-memoryconsole script by routing it through a sync wrapper (sync_main) instead of anasync def main. - Made
_looks_like_pathmore conservative to avoid misclassifying plain text titles as filesystem paths. - Corrected
sources.yamllocal source paths to resolve properly fromshared/exam_memory/.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/exam_memory/server.py | Adds sync_main and bumps server version; also introduces new review-scheduling MCP tools. |
| shared/exam_memory/pyproject.toml | Updates exam-memory entry point and adds a new review-schedule script. |
| shared/exam_memory/source_connector.py | Tightens _looks_like_path heuristic (separator + known extension, or existence). |
| shared/exam_memory/sources.yaml | Fixes relative source path to point to ../../targets/.... |
| README.md | Expands project positioning and adds agent retrieval hints + review scheduling roadmap notes. |
| README_CN.md | Chinese counterpart of README updates (positioning, retrieval hints, roadmap notes). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
35
to
+37
| [project.scripts] | ||
| exam-memory = "exam_memory.server:main" | ||
| exam-memory = "exam_memory.server:sync_main" | ||
| review-schedule = "exam_memory.review_cli:main" |
Comment on lines
+606
to
+613
| if name == "list_due_reviews": | ||
| try: | ||
| from exam_memory.review_cli import due as _due | ||
| target = arguments.get("target", "") | ||
| d = arguments.get("date", "") | ||
| from datetime import date as _date | ||
| today = _date.fromisoformat(d) if d else _date.today() | ||
| limit = arguments.get("limit", 10) |
Comment on lines
+198
to
+222
| Tool( | ||
| name="list_due_reviews", | ||
| description="列出项目中到期的复习项。使用 review_schedule 的 review-queue 文件。", | ||
| inputSchema={ | ||
| "type": "object", | ||
| "properties": { | ||
| "target": { | ||
| "type": "string", | ||
| "description": "目标名称(如 pdd-algo),默认扫描 project_root/targets/ 下首个目标", | ||
| }, | ||
| "date": { | ||
| "type": "string", | ||
| "description": "检查日期 YYYY-MM-DD(可选,默认今天)", | ||
| }, | ||
| "limit": { | ||
| "type": "integer", | ||
| "description": "最大返回条数(默认 10)", | ||
| }, | ||
| }, | ||
| }, | ||
| ), | ||
| Tool( | ||
| name="mark_review_result", | ||
| description="标记一条复习项的结果并自动更新下一次复习计划(SM-2 简化调度)。", | ||
| inputSchema={ |
Comment on lines
+47
to
+50
| | Target-specific exam material | `targets/{target}/` | | ||
| | Shared MCP server and retrieval helpers | `shared/exam_memory/` | | ||
| | Development roadmap | `docs/dev-roadmap.md` | | ||
| | Review mechanism plan | `docs/plans/2026-06-17-review-mechanism-implementation-plan.md` | |
Comment on lines
+210
to
+213
| - File-based review queue under `targets/{target}/progress/reviews/` | ||
| - SM-2 inspired scheduling for mistakes, weak topics, and choice-question errors | ||
| - Optional MCP tools for `list_due_reviews` and `mark_review_result` | ||
| - Planned in [Review Mechanism Implementation Plan](docs/plans/2026-06-17-review-mechanism-implementation-plan.md) |
Comment on lines
+47
to
+50
| | 目标考试专属材料 | `targets/{target}/` | | ||
| | 共享 MCP server 与检索辅助 | `shared/exam_memory/` | | ||
| | 开发路线图 | `docs/dev-roadmap.md` | | ||
| | 复习机制实现规划 | `docs/plans/2026-06-17-review-mechanism-implementation-plan.md` | |
Comment on lines
+210
to
+213
| - 在 `targets/{target}/progress/reviews/` 下维护文件式 review queue | ||
| - 基于 SM-2 简化规则调度错题、薄弱知识点、选择题错误 | ||
| - 可选 MCP 工具:`list_due_reviews` 与 `mark_review_result` | ||
| - 详见 [复习机制实现规划](docs/plans/2026-06-17-review-mechanism-implementation-plan.md) |
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
Fix 3 genuine issues identified by Copilot code review on PR #6 that remained unresolved post-merge:
console_scriptspointed toasync def main, which doesn't work as a CLI command. Addedsync_main()wrapper and updatedpyproject.toml._looks_like_pathtreated any string with a known extension (e.g."哈希表.md") as a file path, contradicting its "保守策略" docstring. Now requires path separator OR actual file existence.sources.yamlusedtargets/...but resolution starts fromshared/exam_memory/, resulting in a non-existent directory. Corrected to../../targets/....Files changed
shared/exam_memory/server.py— version bump + sync_main wrappershared/exam_memory/pyproject.toml— entry point updateshared/exam_memory/source_connector.py— _looks_like_path fixshared/exam_memory/sources.yaml— relative path fix🤖 Generated with Claude Code