feat(maa): 计划表模式下不再强制关闭库存保持 - #585
Conversation
审查者指南该 PR 为 MAA 计划表的每个星期槽位增加库存保持按天开关,贯通配置模型、执行逻辑和前端编辑界面;计划模式按当天槽位先执行库存保持,固定关卡模式与库存计划配置行为保持不变,并补充了兼容性与持久化测试。 每日计划库存保持执行时序图sequenceDiagram
participant Scheduler as MAA计划调度
participant AutoProxy
participant PlanConfig
participant DepotMaintain as 库存保持
participant Sanity as 理智作战
Scheduler->>AutoProxy: main_task()
AutoProxy->>PlanConfig: get_current_info(IfDepotMaintain)
PlanConfig-->>AutoProxy: IfDepotMaintain
alt IfDepotMaintain is true
AutoProxy->>DepotMaintain: execute inventory maintenance
AutoProxy->>Sanity: execute sanity battle
else IfDepotMaintain is false
AutoProxy->>Sanity: execute sanity battle
end
配置每日计划库存保持流程图flowchart LR
ConfigView[计划表配置视图]
Checkbox[库存保持按天复选框]
Coordinator[usePlanDataCoordinator]
Model[MaaPlanConfig_Item.IfDepotMaintain]
Runtime[当天计划执行]
ConfigView --> Checkbox
Checkbox --> Coordinator
Coordinator --> Model
Model --> Runtime
文件级变更
可能关联的 issue
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's Guide该 PR 为 MAA 计划表的每个星期槽位增加库存保持按天开关,贯通配置模型、执行逻辑和前端编辑界面;计划模式按当天槽位先执行库存保持,固定关卡模式与库存计划配置行为保持不变,并补充了兼容性与持久化测试。 Sequence diagram for daily plan inventory maintenance executionsequenceDiagram
participant Scheduler as MAA计划调度
participant AutoProxy
participant PlanConfig
participant DepotMaintain as 库存保持
participant Sanity as 理智作战
Scheduler->>AutoProxy: main_task()
AutoProxy->>PlanConfig: get_current_info(IfDepotMaintain)
PlanConfig-->>AutoProxy: IfDepotMaintain
alt IfDepotMaintain is true
AutoProxy->>DepotMaintain: execute inventory maintenance
AutoProxy->>Sanity: execute sanity battle
else IfDepotMaintain is false
AutoProxy->>Sanity: execute sanity battle
end
Flow diagram for configuring daily plan inventory maintenanceflowchart LR
ConfigView[计划表配置视图]
Checkbox[库存保持按天复选框]
Coordinator[usePlanDataCoordinator]
Model[MaaPlanConfig_Item.IfDepotMaintain]
Runtime[当天计划执行]
ConfigView --> Checkbox
Checkbox --> Coordinator
Coordinator --> Model
Model --> Runtime
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
您好——我发现了 1 个问题
面向 AI Agent 的提示
请处理此次代码审查中的评论:
## 单独评论
### 评论 1
<location path="tests/task/test_maa_plan_depot_maintain.py" line_range="17-18" />
<code_context>
+ return plan
+
+
+def test_all_mode_slot_defaults_to_false_and_round_trips() -> None:
+ plan = _load_plan({"Info": {"Name": "计划", "Mode": "ALL"}})
+
+ assert plan.get_current_info("IfDepotMaintain").getValue() is False
+
+ plan.get_current_info("IfDepotMaintain").setValue(True)
+ assert plan.get_current_info("IfDepotMaintain").getValue() is True
+
+
</code_context>
<issue_to_address>
**问题(测试):** 名为 `round_trips` 的测试从未调用 `toDict()`,因此无法验证 `IfDepotMaintain` 是否被序列化并恢复。即使某个实现会在导出过程中静默丢弃这一新字段,该测试仍然会通过。
**建议修复:** 使用 `toDict()` 导出计划,并断言 `exported["ALL"]["IfDepotMaintain"] is True`。
```suggestion
plan.get_current_info("IfDepotMaintain").setValue(True)
assert plan.get_current_info("IfDepotMaintain").getValue() is True
exported = asyncio.run(plan.toDict())
assert exported["ALL"]["IfDepotMaintain"] is True
```
</issue_to_address>Sourcery 评估
等待批准。 请先处理 1 个发现的问题。
阻塞性发现:tests/task/test_maa_plan_depot_maintain.py:18
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="tests/task/test_maa_plan_depot_maintain.py" line_range="17-18" />
<code_context>
+ return plan
+
+
+def test_all_mode_slot_defaults_to_false_and_round_trips() -> None:
+ plan = _load_plan({"Info": {"Name": "计划", "Mode": "ALL"}})
+
+ assert plan.get_current_info("IfDepotMaintain").getValue() is False
+
+ plan.get_current_info("IfDepotMaintain").setValue(True)
+ assert plan.get_current_info("IfDepotMaintain").getValue() is True
+
+
</code_context>
<issue_to_address>
**issue (testing):** The test named `round_trips` never calls `toDict()` and therefore does not verify that `IfDepotMaintain` is serialized and restored. An implementation that silently drops the new field during export still passes this test.
**Suggested fix:** Export the plan with `toDict()` and assert that `exported["ALL"]["IfDepotMaintain"] is True`.
```suggestion
plan.get_current_info("IfDepotMaintain").setValue(True)
assert plan.get_current_info("IfDepotMaintain").getValue() is True
exported = asyncio.run(plan.toDict())
assert exported["ALL"]["IfDepotMaintain"] is True
```
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/task/test_maa_plan_depot_maintain.py:18
|
您好,十分感谢您对 MAS 开发的支持!目前 MAS 的开发人力确实比较紧张,对于新feat需要对应专项维护者的支持~ 想请您进一步解释一下,为什么需要将「库存保持」纳入计划表?从我们目前的理解来看,这类功能与计划表这种周期性的任务场景不太一致,有点像“三天打鱼,两天晒网”。 当前的设计应该是活动关-库存保持-固定关/计划表,理论上这覆盖了您的情况? 另外,您在 Issue 中提到的理由也有一些我们不太理解的地方:
据我们了解,「库存保持」本身应该并不会直接产出赤金,因此这里将赤金作为该功能的使用场景似乎不太合适。 如果您有更具体的实际使用场景,或者能够说明它与现有计划表机制之间的关系,也欢迎进一步补充,这样我们可以更准确地评估这个需求。 |
|
感谢详细反馈,几点分别回应:
粒度 A(最小改动):解除计划表模式下的强制关闭,用户编辑页的库存保持开关直接生效——常驻目标,每天开启就先补库存,再按计划刷图,不新增任何界面; |
|
明白了,我觉得粒度A是比较合理的方案,以及什么是免费的体力?你挂MAA要碎石头吗? |
|
oh 我丢给ai润色了一波(直接翻了相关代码来润色的)。那我改改 |
66c188c to
e2d4743
Compare
|
静态审。代码本身(后端去掉强制关闭 + 前端解禁)没发现会出错的地方,问题集中在「PR 过期」这一层。 必修
建议修
以上为静态审 + 单独跑了 |
e2d4743 to
8e769fd
Compare
|
三点都处理了(
5 个代码文件零改动;本地跑了 |
|
第二轮( 建议修
提醒(流程层面,不是本 PR 的问题)
静态审 + 本地跑了 |
8e769fd to
e0f484d
Compare
|
第三轮( 这轮核过的:
另有一条给维护者的提醒,与本 PR 无关,作者不用动: 实际跑的 以上为静态审查,外加实跑 |
HarcoChen
left a comment
There was a problem hiding this comment.
签名那个最好还是别加,Workflow可能会意料之外的重复签名,不过也问题不大,后续修一下就OK
Closes #584
Sourcery 摘要
让 MAA 计划表模式支持库存保持,同时保留固定关卡模式的既有行为。
新功能:
改进:
文档:
测试:
杂项:
Original summary in English
Sourcery 摘要
允许 MAA 调度模式使用库存维护,同时不改变固定关卡模式的行为。
新功能:
增强:
文档:
测试:
杂项:
Original summary in English
Sourcery 摘要
允许 MAA 排程模式保留库存维护功能,同时保持固定阶段模式的行为不变。
新功能:
改进:
文档:
测试:
杂项:
Original summary in English
Summary by Sourcery
Allow MAA schedule mode to retain inventory maintenance while preserving fixed-stage mode behavior.
New Features:
Enhancements:
Documentation:
Tests:
Chores: