chore(memory): 规范化注释,移除无信息量注释与开发过程标注 - #2
Merged
Merged
Conversation
只保留对代码的补充说明,即解释原因、约束或外部事实的注释。删除两类: - 标签式注释:分节标记,以及对下方代码或分支的同义复述 - 开发过程相关注释:模板残留(your_plugin_name)、Alembic 自动生成标记、 状态与版本标注 顺带调整: - keys.py 的格式说明去掉「旧版(≤1.9.x)」「新版(开发中)」标注,直接列出 两种格式 - config.py 去掉「实验性功能」「MVP」等措辞 - runner.py 去掉「Phase 3」阶段编号 注释行由 101 条降至 50 条,无任何逻辑改动。
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis comment-only cleanup reduces the amrita_plugin_memory comment set from 101 to 50 by removing redundant structure and development-process annotations, while preserving comments that explain non-obvious rationale, constraints, and external behavior; formatting, linting, and compilation were verified. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
「仅支持单用户」不是开发阶段的临时限制。多用户场景与用户体量难以预测, 故默认只实现单用户,需要多用户支持时自行实现。 - SubconsciousConfig docstring 补充该设计说明 - target_user_id 描述改为「默认仅实现单用户,多用户需自行实现」
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.
做了什么
按「注释只保留对代码的补充说明」这一条,把
amrita_plugin_memory下的注释全部过了一遍。判据是:这条注释是否提供了代码本身读不出来的信息(原因、约束、外部事实)。只做同义复述或状态标注的一律删除。删除的两类
标签式注释 —— 分节标记,以及对下方代码或分支的同义复述:
# status/# reindex/# backup/# click 命令组(cli.py)# 生命周期/# 核心运行/# 后处理/# Prompt 加载/# 用户画像(runner.py)# 辅助/# Handler/# 消息生成/# 压缩辅助工具(rethinking/tools.py)# 精确匹配/# 前缀匹配/# 追加模式/# 替换模式/# 过滤/# 排序# 公共参数:scope/# Function Schema 定义/# Handler 实现开发过程相关注释:
# Configuration for your_plugin_name plugin(config.py 顶部的模板残留,插件名还是占位符)# ### commands auto generated by Alembic - please adjust! ###与# ### end Alembic commands ###(两个 migration 文件,共 8 行)# Phase 3:阶段编号(实验性功能)、(MVP仅支持单用户)、新版(开发中)、旧版(≤1.9.x)等状态与版本标注保留的
解释原因、约束或外部事实的注释,例如:
# lazy to avoid circular import# 先备份:这是删除集合后唯一的回滚依据# 空集合:只需重建并写指纹,无需调用嵌入模型# 兜底确保 FK 存在(会话中 chat 插件通常已创建 metadata 行)# 群聊事件 → 群 uni_id;私聊事件 → 个人 uni_id# Guard: 确保任何 \---` 行都能正确分割(不匹配文档内部的减号)`# 所有工具已通过 @on_tools(bound_to=...) 注册到隔离的 MultiToolsManager…顺带调整
keys.py模块 docstring 去掉「旧版」「新版(开发中)」标注,直接列出两种格式config.py去掉「— 实验性功能」runner.py去掉「Phase 3:」阶段编号补充(9102f6b)
target_user_id的「单用户」限制不是开发阶段的临时状态,而是设计取舍:多用户场景与用户体量难以预测,因此默认只实现单用户,需要多用户支持时自行实现。原先(MVP仅支持单用户)的措辞把设计取舍写成了未完成状态,已改为:SubconsciousConfigdocstring 补充该设计说明统计
注释 101 条 → 50 条。12 个文件,+11 / −103。纯注释改动,无逻辑变化。
验证
ruff check .通过ruff format --check .通过python -m compileall amrita_plugin_memory通过一处未动
README.md第 222 行的表格里还有一处「开发中」:它是文档不是注释,且那一列是「Amrita 版本」,我不确定该填哪个版本号,所以没有改动。需要一并处理的话说一声。