Repository navigation
Conversation
审阅者指南(小型 PR 中默认折叠)审阅者指南此 PR 修复了每日代理标签的分类逻辑:只有代理日期为当天且至少记录过一次代理,才会显示绿色“已代理N次”标签。这样可以避免失败或仍在进行中的运行因成功尝试次数为零而被标记为绿色“已代理0次”;此外还新增了一条更新日志。 每日代理状态分类流程图flowchart TD
A[读取 LastProxyDate 和 ProxyTimes] --> B{LastProxyDate 是今天吗?}
B -->|否| C[返回橙色的未代理状态]
B -->|是| D{ProxyTimes > 0 吗?}
D -->|否| C
D -->|是| E[返回绿色的已代理N次状态]
文件级变更
提示与命令与 Sourcery 互动
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR fixes daily proxy tag classification by requiring both a current-day proxy date and at least one recorded proxy, preventing failed or in-progress runs with zero successful attempts from receiving the green “已代理0次” label; it also adds a changelog entry. Flow diagram for daily proxy status classificationflowchart TD
A[Read LastProxyDate and ProxyTimes] --> B{LastProxyDate is today?}
B -->|No| C[Return 未代理 with orange color]
B -->|Yes| D{ProxyTimes > 0?}
D -->|No| C
D -->|Yes| E[Return 已代理N次 with green color]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
总体结论:修改后合并
必须处理的问题[规范 · P3] 已验证的回归测试未随修复提交
审查范围与摘要已核对日期/次数的写入、八个直接调用方及继承复用、虚拟标签到用户列表的展示链。该改动复用现有状态源,不新增跨层依赖、持久化契约或 I/O;标签派生无需新增遥测事件。未发现新增逻辑、性能或架构缺陷。本次为静态审查,作者所述本地测试未由本任务执行。 来自 dot |
There was a problem hiding this comment.
嗨——我发现了 1 个问题
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="app/models/config/shared.py" line_range="221" />
<code_context>
- if config.Data.LastProxyDate.astimezone(tz).date() == datetime.now(tz=tz).date():
+ if (
+ config.Data.LastProxyDate.astimezone(tz).date() == datetime.now(tz=tz).date()
+ and config.Data.ProxyTimes > 0
+ ):
return {"text": f"{label}:已代理{config.Data.ProxyTimes}次", "color": "green"}
</code_context>
<issue_to_address>
**Yesterday’s count appears as today’s success**
When the process stops after saving today’s `LastProxyDate` but before the `ProxyTimes` reset is committed, and yesterday’s count is positive, `_tag_proxy` sees today’s `LastProxyDate` and yesterday’s positive `ProxyTimes`, so it returns the green “已代理” tag even though no run succeeded today.
Commit the date update and counter reset atomically, or reset the counter before saving the new date.
</issue_to_address>Sourcery 评估
等待批准。 请先处理 1 项发现。
阻塞性发现:app/models/config/shared.py:221
Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="app/models/config/shared.py" line_range="221" />
<code_context>
- if config.Data.LastProxyDate.astimezone(tz).date() == datetime.now(tz=tz).date():
+ if (
+ config.Data.LastProxyDate.astimezone(tz).date() == datetime.now(tz=tz).date()
+ and config.Data.ProxyTimes > 0
+ ):
return {"text": f"{label}:已代理{config.Data.ProxyTimes}次", "color": "green"}
</code_context>
<issue_to_address>
**Yesterday’s count appears as today’s success**
When the process stops after saving today’s `LastProxyDate` but before the `ProxyTimes` reset is committed, and yesterday’s count is positive, `_tag_proxy` sees today’s `LastProxyDate` and yesterday’s positive `ProxyTimes`, so it returns the green “已代理” tag even though no run succeeded today.
Commit the date update and counter reset atomically, or reset the counter before saving the new date.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: app/models/config/shared.py:221
| if config.Data.LastProxyDate.astimezone(tz).date() == datetime.now(tz=tz).date(): | ||
| if ( | ||
| config.Data.LastProxyDate.astimezone(tz).date() == datetime.now(tz=tz).date() | ||
| and config.Data.ProxyTimes > 0 |
There was a problem hiding this comment.
🟡 中等 · 昨日的计数被显示为今日成功
如果进程在保存今天的 LastProxyDate 后、提交 ProxyTimes 重置之前停止,并且昨日的计数大于零,_tag_proxy 会看到今天的 LastProxyDate 和昨日的正数 ProxyTimes,因此返回绿色的“已代理”标签,尽管今天并没有成功运行。
请以原子方式提交日期更新和计数器重置,或者在保存新日期之前重置计数器。
给 AI 智能体的提示
In `app/models/config/shared.py` at line 221:
**Yesterday’s count appears as today’s success**
When the process stops after saving today’s `LastProxyDate` but before the `ProxyTimes` reset is committed, and yesterday’s count is positive, `_tag_proxy` sees today’s `LastProxyDate` and yesterday’s positive `ProxyTimes`, so it returns the green “已代理” tag even though no run succeeded today.
Commit the date update and counter reset atomically, or reset the counter before saving the new date.Original comment in English
🟡 Medium · Yesterday’s count appears as today’s success
When the process stops after saving today’s LastProxyDate but before the ProxyTimes reset is committed, and yesterday’s count is positive, _tag_proxy sees today’s LastProxyDate and yesterday’s positive ProxyTimes, so it returns the green “已代理” tag even though no run succeeded today.
Commit the date update and counter reset atomically, or reset the counter before saving the new date.
Prompt for AI agents
In `app/models/config/shared.py` at line 221:
**Yesterday’s count appears as today’s success**
When the process stops after saving today’s `LastProxyDate` but before the `ProxyTimes` reset is committed, and yesterday’s count is positive, `_tag_proxy` sees today’s `LastProxyDate` and yesterday’s positive `ProxyTimes`, so it returns the green “已代理” tag even though no run succeeded today.
Commit the date update and counter reset atomically, or reset the counter before saving the new date.|
所以现在到底交不交测试?我觉得还是只交核心吧。 |
|
按当前仓库规则,这类稳定、可隔离的回归测试需要随 PR 提交,不限于核心引擎测试。tests/AGENTS.md 的「核心最小回归」是 MaaFW 引擎测试的专门约束;后面的「Agent 规则」明确要求稳定 Bug 的回归测试同 PR 保留。 本次只需保留已经写好的、能守住零次误报的最小用例,不需要提交真实设备探针或扩大成整套专项测试。如果项目决定改回「只交核心测试」,应由维护者明确统一仓库与文档站规则;目前这条建议还不是已确认的规则变更,所以本次审查结论暂不变。 来自 dot |
摘要
测试与验证
D:\MAS\code\trees\proxytag\.venv\Scripts\python.exe -m pytest tests/models/test_shared_proxy_tag.py -q,修复前 1 failed / 1 passed,修复后 2 passed;ruff format、ruff check和scripts/changelog.py check均通过。tests/models/test_shared_proxy_tag.py按本地工作区规则写入公共 Git exclude,仅用于验证修复前红、修复后绿。6c3e8e11fb3b4b950d34fdbf0c335f325b8e6b84。Sourcery 摘要
修正没有成功代理运行记录的用户的每日代理状态标签。
错误修复:
Original summary in English
Summary by Sourcery
Correct daily proxy status tagging for users with no successful proxy runs.
Bug Fixes: