Skip to content

ref(MAAUserEdit): 任务配置重构为流水线布局 - #414

Open
1w1w11w1 wants to merge 3 commits into
devfrom
feat/maa-task-pipeline-ui
Open

ref(MAAUserEdit): 任务配置重构为流水线布局#414
1w1w11w1 wants to merge 3 commits into
devfrom
feat/maa-task-pipeline-ui

Conversation

@1w1w11w1

@1w1w11w1 1w1w11w1 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

背景

原「任务配置」是 8 个开关的九宫格,存在三个问题:

  1. 排列顺序与实际执行顺序无关。真实下发顺序由 app/utils/constants.pyMAA_TASKS 决定,AutoProxy 按该数组构建 TaskQueue。九宫格的阅读顺序(唤醒/作战/基建/公招 → 信用/奖励/肉鸽/生息)和它对不上。
  2. 库存保持位置错误。它是 MAA_TASKS 第 3 位、紧跟活动关之后,却被放在一个独立的二级板块里,离任务开关很远。
  3. 占位大而信息少。8 个开关占约 390px,标签在上开关在下,扫视需走 Z 字。

改动

改为单列布局,顺序严格对齐 AutoProxy 构建 TaskQueue 的顺序:

任务配置                        按执行顺序,从上到下
----------------------------------------------------------
 (=O)  剿灭代理   当期剿灭 · 周一起 · 本周未完成       v
 (=O)  活动关作战 2. 墟 · AT-7 · 理智药 0              v
 (O=)  库存保持                                        v
 (=O)  理智作战   1-7 · 连战 AUTO · 理智药 0           v
 (=O)  基建换班   常规模式                             v
       日常任务   [x] 自动公招 [x] 信用收支 [x] 领取奖励
 (O=)  自动肉鸽
  • 折叠态每行 52px,右侧摘要显示当前生效值,不展开即可核对配置
  • 开关在任务名左侧,靠邻近性表达「这个开关管的是这个任务」
  • 关闭的任务名降一级对比度,一眼看出哪几步会跳过
  • 常改项(活动关、库存保持、理智作战、基建换班)行内展开配置,无需跳转

两级控件语言

一级任务用 switch(44×22),二级子项用勾选框(16px),尺寸差 2.75 倍建立层级。这也符合 HIG 的控件语义:立即生效的设置用 switch,组内选项用 checkbox。

中途试过「按钮显示启用/关闭文字」和「两级都用勾选框」两版,都已放弃:前者 button 的形状承诺「点我执行动作」而内容是状态,形状与语义矛盾;后者两级尺寸零差异,字号建立的层级(15px/600 vs 14px/400)被控件抹平。

删除两个无效开关

  • 开始唤醒AutoProxy.py 在导出配置前无条件执行 self.task_dict["StartUp"] = True,覆盖用户配置。用户关掉它 MAA 侧照样 enabled,即该开关从未生效。IfStartUp 字段保留以兼容旧配置文件。
  • 生息演算:此前模板中硬编码 :disabled="true",永远无法点亮。等适配完成后再加回。

其他

  • 基建换班提升为独立行,位置对齐 MAA_TASKS 中 Infrast 紧跟 Fight 的顺序;基建模式/自定义配置/自定义排班从「基本信息」区移入它的详情区,关掉基建后这些配置跟着一起收起
  • 自动公招/信用收支/领取奖励压为「日常任务」单行勾选框 —— 这三项确有关闭场景,但均为无配置的一键任务,改动频率远低于理智作战和库存保持,不应与其平级各占一行
  • 库存保持在计划模式下改为置灰保留 + 摘要说明「计划模式下不可用」。此前是 v-if="!isPlanMode" 整块隐藏,用户会误以为功能消失(后端 AutoProxy.py 在计划模式下会强制 task_dict["DepotMaintain"] = False
  • 剿灭代理从「关卡配置」提升为前置步骤,反映 AutoProxy 中它是先于日常的独立一轮完整流程
  • 关闭态摘要留空:关着的开关已经表达了关闭,摘要再写「已关闭」是重复

无障碍

  • 行头的 hover-only tooltip 图标改为详情区常驻正文,LabelWithHint 补 focus 触发,键盘与触屏用户不再拿不到提示(WCAG 1.4.13)
  • 修两处对比度不达标:关闭态任务名 text-tertiary 3.36:1 → text-secondary 7.00:1(15px/600 不算 WCAG 大字,需按 4.5:1 判定);计划模式下「计划模式下不可用」原为 text-quaternary 1.84:1,近乎不可见,改为继承 7.00:1

已知遗留:switch 滑块与勾选框是白色图形置于 colorPrimary 填充,在青/绿/橙/黄/亮绿/金 6 个主题色下不足 WCAG 1.4.11 要求的 3:1。这是 antd 原生控件在全站的既有状况,修需动主题层,不在本 PR 范围。

结构

  • 新增 PipelineRow.vue(折叠行)、TaskPipelineSection.vue(列表容器)
  • 摘要逻辑抽到 taskSummaries.ts,附单元测试
  • TaskConfigSection.vueDepotMaintainConfigSection.vue 删除;后者的表格移入 DepotMaintainPlanEditor.vue 作为行内详情
  • StageConfigSection.vue 精简为理智作战的详情内容

组件文件名沿用 PipelineRow / TaskPipelineSection,改名会牵动 import,未做。

无后端改动,无配置字段增删。

测试

  • yarn test — 56 passed(新增 20 个摘要测试,覆盖关闭分支、计划模式前缀、- 哨兵值、坏 JSON 兜底)
  • yarn typecheck — 本 PR 涉及文件无报错
  • yarn lint — 本 PR 涉及文件无报错
  • vite build — 通过

未做人工 UI 验证:需要 Electron + Python 后端联跑。对比度数值经 antd 调色算法逐主题计算,但间距与实际观感仅经静态检查,建议 review 时实机确认。

Sourcery 摘要

将 MAA 任务配置重构为按执行顺序排列的流水线,并提供简洁摘要和内联设置,同时保留现有配置的兼容性。

新功能:

  • 将任务配置网格替换为按执行顺序排列、可折叠的流水线,并在行摘要中显示生效的设置。
  • 将活动、库存维护和理智战斗配置直接嵌入相关的流水线步骤中。
  • 提供内联的库存维护计划管理功能,支持预设、物品编辑和批量删除。
  • 将常规任务归组为紧凑的复选框行,并将肉鸽自动化移至可展开的“更多任务”部分。

错误修复:

  • 从面向用户的任务配置中移除无效的 StartUp 和永久禁用的 SSS 计算控件,同时保留与现有配置字段的兼容性。
  • 在计划模式下保留库存维护的可见性,但明确将其禁用,而不是隐藏。

增强功能:

  • 为任务配置添加可复用的流水线行、带上下文提示的标签,以及集中式摘要格式化功能。
  • 保留并显示剿灭作战每周状态,并提供重置或标记完成的控件。

测试:

  • 为任务摘要添加单元测试覆盖,包括禁用、加载中、计划模式、哨兵值和格式错误的 JSON 等情况。

杂项:

  • 重构用户编辑器,通过新的流水线部分承载任务配置,并简化阶段配置组件。
Original summary in English

Sourcery 摘要

按后端执行顺序重构 MAA 任务配置界面,使用流水线布局整合任务开关、摘要和内联配置。

新功能:

  • 将 MAA 任务配置改为按执行顺序排列的可折叠流水线,并在行摘要中展示当前生效配置。
  • 将活动关、库存保持、理智作战和基建配置整合为任务行内详情,并提供库存保持计划的预设、编辑和批量管理。

错误修复:

  • 移除无效的开始唤醒和永久禁用的生息演算用户开关,同时保留现有配置兼容性。
  • 在计划模式下保留库存保持配置的可见性,并明确提示其不可用。

改进:

  • 压缩低频日常任务的配置展示,并为任务及其详情提供统一的提示和摘要格式。
  • 保留剿灭任务的每周完成状态及手动重置、标记完成操作。

测试:

  • 为任务摘要格式化逻辑新增单元测试,覆盖禁用、加载中、计划模式、哨兵值和异常 JSON 等场景。

日常维护:

  • 重构 MAA 用户编辑器的任务与关卡配置组件结构。
Original summary in English

Summary by Sourcery

按后端执行顺序重构 MAA 任务配置界面,使用流水线布局整合任务开关、摘要和内联配置。

New Features:

  • 将 MAA 任务配置改为按执行顺序排列的可折叠流水线,并在行摘要中展示当前生效配置。
  • 将活动关、库存保持、理智作战和基建配置整合为任务行内详情,并提供库存保持计划的预设、编辑和批量管理。

Bug Fixes:

  • 移除无效的开始唤醒和永久禁用的生息演算用户开关,同时保留现有配置兼容性。
  • 在计划模式下保留库存保持配置的可见性并明确提示其不可用。

Enhancements:

  • 压缩低频日常任务的配置展示,并为任务及其详情提供统一的提示和摘要格式。
  • 保留剿灭任务的每周完成状态及手动重置、标记完成操作。

Tests:

  • 为任务摘要格式化逻辑新增单元测试,覆盖禁用、加载中、计划模式、哨兵值和异常 JSON 等场景。

Chores:

  • 重构 MAA 用户编辑器的任务与关卡配置组件结构。
Original summary in English

Sourcery 摘要

按后端执行顺序重构 MAA 任务配置界面,使用流水线布局整合任务开关、摘要和内联配置。

新功能:

  • 将 MAA 任务配置改为按执行顺序排列的可折叠流水线,并在行摘要中展示当前生效配置。
  • 将活动关、库存保持、理智作战和基建配置整合为任务行内详情,并提供库存保持计划的预设、编辑和批量管理。

错误修复:

  • 移除无效的开始唤醒和永久禁用的生息演算用户开关,同时保留现有配置兼容性。
  • 在计划模式下保留库存保持配置的可见性,并明确提示其不可用。

改进:

  • 压缩低频日常任务的配置展示,并为任务及其详情提供统一的提示和摘要格式。
  • 保留剿灭任务的每周完成状态及手动重置、标记完成操作。

测试:

  • 为任务摘要格式化逻辑新增单元测试,覆盖禁用、加载中、计划模式、哨兵值和异常 JSON 等场景。

日常维护:

  • 重构 MAA 用户编辑器的任务与关卡配置组件结构。
Original summary in English

Summary by Sourcery

按后端执行顺序重构 MAA 任务配置界面,使用流水线布局整合任务开关、摘要和内联配置。

New Features:

  • 将 MAA 任务配置改为按执行顺序排列的可折叠流水线,并在行摘要中展示当前生效配置。
  • 将活动关、库存保持、理智作战和基建配置整合为任务行内详情,并提供库存保持计划的预设、编辑和批量管理。

Bug Fixes:

  • 移除无效的开始唤醒和永久禁用的生息演算用户开关,同时保留现有配置兼容性。
  • 在计划模式下保留库存保持配置的可见性并明确提示其不可用。

Enhancements:

  • 压缩低频日常任务的配置展示,并为任务及其详情提供统一的提示和摘要格式。
  • 保留剿灭任务的每周完成状态及手动重置、标记完成操作。

Tests:

  • 为任务摘要格式化逻辑新增单元测试,覆盖禁用、加载中、计划模式、哨兵值和异常 JSON 等场景。

Chores:

  • 重构 MAA 用户编辑器的任务与关卡配置组件结构。

原九宫格开关的排列顺序与后端 MAA_TASKS 的实际下发顺序无关,库存保持虽是
流水线第 3 位却被放在独立的二级板块,用户无法从界面看出任务执行的先后关系。

改为单列流水线,顺序严格对齐 AutoProxy 构建 TaskQueue 的顺序,折叠态每行
显示当前生效值的摘要,不展开即可核对配置。

- 删除「开始唤醒」开关:AutoProxy 导出配置前无条件置 task_dict["StartUp"]=True,
  该开关从未生效,保留 IfStartUp 字段以兼容旧配置文件
- 删除「生息演算」开关:此前硬编码 disabled,永远无法启用
- 「自动肉鸽」移入折叠的「更多任务」,仍保留在 MAA_TASKS 中
- 基建换班/自动公招/信用收支/领取奖励压为单行勾选框,这四项改动频率低
- 库存保持并入流水线;计划模式下改为置灰保留并说明原因,不再整块隐藏
- 剿灭代理提升为流水线前置步骤,反映其为独立一轮完整流程
@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown

审查者指南

本 PR 将 MAA 用户任务配置从九宫格重构为严格匹配后端执行顺序的单列流水线,以可折叠行、实时摘要和内联详情提升配置核对效率;同时移除两个无效入口、迁移库存保持编辑器,并通过摘要单测覆盖关键配置边界,未修改后端或配置字段。

内联任务配置和摘要更新时序图

sequenceDiagram
    actor User
    participant Pipeline as TaskPipelineSection
    participant Row as PipelineRow
    participant Editor as DepotMaintainPlanEditor
    participant Summary as taskSummaries
    participant Parent as MAAUserEdit

    User->>Row: click row
    Row-->>Pipeline: toggle expanded
    Pipeline->>Editor: render inline detail
    User->>Editor: addPlan()
    Editor->>Editor: savePlans()
    Editor-->>Pipeline: save Task.DepotMaintainPlans
    Pipeline-->>Parent: handleFieldSave()
    Parent->>Summary: summarizeDepot()
    Summary-->>Parent: updated summary
Loading

有序 MAA 任务流水线流程图

flowchart TD
    Annihilation[剿灭代理]
    Activity[活动关作战]
    Depot[库存保持]
    Fight[理智作战]
    Daily[日常任务]
    More[更多任务]

    Annihilation --> Activity
    Activity --> Depot
    Depot --> Fight
    Fight --> Daily
    Daily --> More

    Annihilation -.关闭则跳过.-> Activity
    Activity -.关闭则跳过.-> Depot
    Depot -.计划模式下不可用.-> Fight
Loading

文件级变更

变更 详情 文件
将任务配置界面重构为与后端执行队列一致的单列流水线,并通过折叠行承载摘要、状态和内联详情。
  • 按剿灭、活动关、库存保持、理智作战、日常任务、更多任务排列配置项
  • 新增可折叠流水线行、轨道视觉、关闭态样式和响应式布局
  • 将活动关、库存保持和理智作战详情嵌入对应行,日常任务改为单行复选框
  • 将自动肉鸽移入“更多任务”,删除生息演算和开始唤醒的界面入口
frontend/src/views/MAAUserEdit/MAAUserEdit.vue
frontend/src/views/MAAUserEdit/TaskPipelineSection.vue
frontend/src/views/MAAUserEdit/PipelineRow.vue
frontend/src/views/MAAUserEdit/LabelWithHint.vue
frontend/src/views/MAAUserEdit/StageConfigSection.vue
frontend/src/views/MAAUserEdit/StageSelector.vue
frontend/src/views/MAAUserEdit/TaskConfigSection.vue
frontend/src/views/MAAUserEdit/DepotMaintainConfigSection.vue
抽离任务摘要和周状态计算,使折叠态能够展示当前生效配置,并覆盖边界值。
  • 新增剿灭、活动关、库存保持和理智作战摘要格式化逻辑
  • 处理计划模式、加载/无活动关、坏 JSON、哨兵值和连战模式等情况
  • 独立封装与后端 UTC+4 周标记一致的当前周计算
  • 为摘要逻辑增加 13 项单元测试
frontend/src/views/MAAUserEdit/taskSummaries.ts
frontend/src/views/MAAUserEdit/taskSummaries.test.ts
frontend/src/views/MAAUserEdit/weekMarker.ts
frontend/src/views/MAAUserEdit/MAAUserEdit.vue
将库存保持编辑器改为流水线内联详情,同时保留原有计划数据兼容和编辑能力。
  • 把库存保持表格、预设导入、增删计划和即时保存逻辑迁移到行内编辑器
  • 计划模式下保留库存保持行并置灰,显示不可用摘要而非隐藏整块功能
  • 解析旧 JSON 时过滤无效计划并对异常输入安全回退
frontend/src/views/MAAUserEdit/DepotMaintainPlanEditor.vue
frontend/src/views/MAAUserEdit/TaskPipelineSection.vue

提示和命令

与 Sourcery 交互

  • 触发新的审查: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 根据审查评论生成 GitHub issue: 回复审查评论,请 Sourcery 根据该评论创建 issue。也可以在审查评论中回复 @sourcery-ai issue 来创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写入 @sourcery-ai,即可随时生成标题。也可以在 pull request 中评论 @sourcery-ai title,以随时(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中任意位置写入 @sourcery-ai summary,即可在指定位置随时生成 PR 摘要。也可以在 pull request 中评论 @sourcery-ai summary,以随时(重新)生成摘要。
  • 生成审查者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论并且不想再看到它们,这项功能会很有用。
  • 忽略所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想从新的审查开始,这项功能尤其有用——别忘了评论 @sourcery-ai review 来触发新的审查!

自定义使用体验

访问你的控制面板以:

  • 启用或停用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

本 PR 将 MAA 用户任务配置从九宫格重构为严格匹配后端执行顺序的单列流水线,以可折叠行、实时摘要和内联详情提升配置核对效率;同时移除两个无效入口、迁移库存保持编辑器,并通过摘要单测覆盖关键配置边界,未修改后端或配置字段。

Sequence diagram for inline task configuration and summary updates

sequenceDiagram
    actor User
    participant Pipeline as TaskPipelineSection
    participant Row as PipelineRow
    participant Editor as DepotMaintainPlanEditor
    participant Summary as taskSummaries
    participant Parent as MAAUserEdit

    User->>Row: click row
    Row-->>Pipeline: toggle expanded
    Pipeline->>Editor: render inline detail
    User->>Editor: addPlan()
    Editor->>Editor: savePlans()
    Editor-->>Pipeline: save Task.DepotMaintainPlans
    Pipeline-->>Parent: handleFieldSave()
    Parent->>Summary: summarizeDepot()
    Summary-->>Parent: updated summary
Loading

Flow diagram for the ordered MAA task pipeline

flowchart TD
    Annihilation[剿灭代理]
    Activity[活动关作战]
    Depot[库存保持]
    Fight[理智作战]
    Daily[日常任务]
    More[更多任务]

    Annihilation --> Activity
    Activity --> Depot
    Depot --> Fight
    Fight --> Daily
    Daily --> More

    Annihilation -.关闭则跳过.-> Activity
    Activity -.关闭则跳过.-> Depot
    Depot -.计划模式下不可用.-> Fight
Loading

File-Level Changes

Change Details Files
将任务配置界面重构为与后端执行队列一致的单列流水线,并通过折叠行承载摘要、状态和内联详情。
  • 按剿灭、活动关、库存保持、理智作战、日常任务、更多任务排列配置项
  • 新增可折叠流水线行、轨道视觉、关闭态样式和响应式布局
  • 将活动关、库存保持和理智作战详情嵌入对应行,日常任务改为单行复选框
  • 将自动肉鸽移入“更多任务”,删除生息演算和开始唤醒的界面入口
frontend/src/views/MAAUserEdit/MAAUserEdit.vue
frontend/src/views/MAAUserEdit/TaskPipelineSection.vue
frontend/src/views/MAAUserEdit/PipelineRow.vue
frontend/src/views/MAAUserEdit/LabelWithHint.vue
frontend/src/views/MAAUserEdit/StageConfigSection.vue
frontend/src/views/MAAUserEdit/StageSelector.vue
frontend/src/views/MAAUserEdit/TaskConfigSection.vue
frontend/src/views/MAAUserEdit/DepotMaintainConfigSection.vue
抽离任务摘要和周状态计算,使折叠态能够展示当前生效配置,并覆盖边界值。
  • 新增剿灭、活动关、库存保持和理智作战摘要格式化逻辑
  • 处理计划模式、加载/无活动关、坏 JSON、哨兵值和连战模式等情况
  • 独立封装与后端 UTC+4 周标记一致的当前周计算
  • 为摘要逻辑增加 13 项单元测试
frontend/src/views/MAAUserEdit/taskSummaries.ts
frontend/src/views/MAAUserEdit/taskSummaries.test.ts
frontend/src/views/MAAUserEdit/weekMarker.ts
frontend/src/views/MAAUserEdit/MAAUserEdit.vue
将库存保持编辑器改为流水线内联详情,同时保留原有计划数据兼容和编辑能力。
  • 把库存保持表格、预设导入、增删计划和即时保存逻辑迁移到行内编辑器
  • 计划模式下保留库存保持行并置灰,显示不可用摘要而非隐藏整块功能
  • 解析旧 JSON 时过滤无效计划并对异常输入安全回退
frontend/src/views/MAAUserEdit/DepotMaintainPlanEditor.vue
frontend/src/views/MAAUserEdit/TaskPipelineSection.vue

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好——我发现了 2 个问题

面向 AI Agent 的提示
请处理本次代码审查中的评论:

## 单独评论

### 评论 1
<location path="frontend/src/views/MAAUserEdit/weekMarker.ts" line_range="11" />
<code_context>
-  const shifted = new Date(Date.now() + 4 * 60 * 60 * 1000)
-  const date = new Date(Date.UTC(shifted.getUTCFullYear(), shifted.getUTCMonth(), shifted.getUTCDate()))
-  const day = date.getUTCDay() || 7
-  date.setUTCDate(date.getUTCDate() + 4 - day)
-  const yearStart = new Date(Date.UTC(date.getUTCFullYear(), 0, 1))
-  const week = Math.ceil((((date.getTime() - yearStart.getTime()) / 86400000) + 1) / 7)
-  return `${date.getUTCFullYear()}-W${String(week).padStart(2, '0')}`
-})()
-
</code_context>
<issue_to_address>
**issue (bug_risk):** 对于星期四落在一年中的第 7、14、21 或 28 天的日期,ISO 周计算会偏大一周。例如,2024-01-01(星期一)会被调整到 2024-01-04(星期四),并返回 W02 而不是 W01,因此手动标记歼灭完成时会写入一个后端无法识别为当前周的标记。

**触发条件:** 当前 UTC+4 周从星期一开始,且该周的星期四恰好是一年中第 7、14、21 或 28 天时。

**建议修复:** 使用 ISO 周算法或等效于 `date.isocalendar()` 的逻辑计算 ISO 周,而不是使用 `Math.ceil((dayOfYear + 1) / 7)````suggestion
  const week = Math.floor((date.getTime() - yearStart.getTime()) / 86400000 / 7) + 1
```
</issue_to_address>

### 评论 2
<location path="frontend/src/views/MAAUserEdit/taskSummaries.ts" line_range="61-70" />
<code_context>
+}
+
+export const summarizeDepot = (isPlanMode: boolean, enabled: boolean, plansJson: string) => {
+  if (isPlanMode) return '计划模式下不可用'
+  if (!enabled) return '已关闭'
+  let count = 0
+  try {
+    const parsed = JSON.parse(plansJson || '[]')
+    count = Array.isArray(parsed) ? parsed.length : 0
+  } catch {
+    count = 0
+  }
+  return count ? `${count} 项计划` : '尚未添加计划'
+}
+
</code_context>
<issue_to_address>
**nitpick:** 库存摘要会统计 `DepotMaintainPlans` 中数组的每个元素,包括 `DepotMaintainPlanEditor` 因缺少有效的 `Stage``DropId` 或数值型 `DropCount` 字段而丢弃的格式错误条目。因此,折叠行会报告编辑器无法显示或执行的已配置计划。

**触发条件:** 现有配置包含一个或多个格式错误的库存计划条目时。

**建议修复:** 在统计计划数量之前,应用与 `DepotMaintainPlanEditor` 相同的有效性过滤条件。
</issue_to_address>

Sourcery 评估

需要人工审查。 首先需要处理 1 个发现;错误的流水线控制、阶段选择或库存计划可能会持久化错误配置,导致后续自动化运行错误的任务或消耗资源。还原操作可以恢复之前的编辑器,但无法撤销已经触发的自动化;保存的配置本身影响范围有限,可以进行修正或重新运行。

阻塞性发现:frontend/src/views/MAAUserEdit/weekMarker.ts:11


Sourcery 对开源项目免费——如果您喜欢我们的审查结果,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我会利用您的反馈改进审查结果。
Original comment in English

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="frontend/src/views/MAAUserEdit/weekMarker.ts" line_range="11" />
<code_context>
-  const shifted = new Date(Date.now() + 4 * 60 * 60 * 1000)
-  const date = new Date(Date.UTC(shifted.getUTCFullYear(), shifted.getUTCMonth(), shifted.getUTCDate()))
-  const day = date.getUTCDay() || 7
-  date.setUTCDate(date.getUTCDate() + 4 - day)
-  const yearStart = new Date(Date.UTC(date.getUTCFullYear(), 0, 1))
-  const week = Math.ceil((((date.getTime() - yearStart.getTime()) / 86400000) + 1) / 7)
-  return `${date.getUTCFullYear()}-W${String(week).padStart(2, '0')}`
-})()
-
</code_context>
<issue_to_address>
**issue (bug_risk):** The ISO week calculation is off by one for dates whose Thursday falls on day 7, 14, 21, or 28 of the year. For example, Monday 2024-01-01 is shifted to Thursday 2024-01-04 and returns W02 instead of W01, so manually marking annihilation complete writes a marker that the backend does not recognize as the current week.

**Triggers:** When the current UTC+4 week begins on a Monday in a week whose Thursday is exactly a multiple of seven days into the year.

**Suggested fix:** Calculate the ISO week using an ISO-week algorithm or `date.isocalendar()`-equivalent logic instead of `Math.ceil((dayOfYear + 1) / 7)`.

```suggestion
  const week = Math.floor((date.getTime() - yearStart.getTime()) / 86400000 / 7) + 1
```
</issue_to_address>

### Comment 2
<location path="frontend/src/views/MAAUserEdit/taskSummaries.ts" line_range="61-70" />
<code_context>
+}
+
+export const summarizeDepot = (isPlanMode: boolean, enabled: boolean, plansJson: string) => {
+  if (isPlanMode) return '计划模式下不可用'
+  if (!enabled) return '已关闭'
+  let count = 0
+  try {
+    const parsed = JSON.parse(plansJson || '[]')
+    count = Array.isArray(parsed) ? parsed.length : 0
+  } catch {
+    count = 0
+  }
+  return count ? `${count} 项计划` : '尚未添加计划'
+}
+
</code_context>
<issue_to_address>
**nitpick:** The inventory summary counts every array element in `DepotMaintainPlans`, including malformed entries that `DepotMaintainPlanEditor` discards because they lack valid `Stage`, `DropId`, or numeric `DropCount` fields. The collapsed row therefore reports configured plans that the editor cannot display or execute.

**Triggers:** When an existing configuration contains one or more malformed inventory-plan entries.

**Suggested fix:** Apply the same validity filter as `DepotMaintainPlanEditor` before counting plans.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and a faulty pipeline control, stage selection, or inventory plan could persist an incorrect configuration and cause subsequent automation to run the wrong task or consume resources. Reverting restores the previous editor, but it cannot undo any automation already triggered; the saved configuration itself is bounded and can be corrected or rerun.

Blocking findings: frontend/src/views/MAAUserEdit/weekMarker.ts:11


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

const day = date.getUTCDay() || 7
date.setUTCDate(date.getUTCDate() + 4 - day)
const yearStart = new Date(Date.UTC(date.getUTCFullYear(), 0, 1))
const week = Math.ceil(((date.getTime() - yearStart.getTime()) / 86400000 + 1) / 7)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): 对于星期四落在一年中的第 7、14、21 或 28 天的日期,ISO 周计算会偏大一周。例如,2024-01-01(星期一)会被调整到 2024-01-04(星期四),并返回 W02 而不是 W01,因此手动标记歼灭完成时会写入一个后端无法识别为当前周的标记。

触发条件: 当前 UTC+4 周从星期一开始,且该周的星期四恰好是一年中第 7、14、21 或 28 天时。

建议修复: 使用 ISO 周算法或等效于 date.isocalendar() 的逻辑计算 ISO 周,而不是使用 Math.ceil((dayOfYear + 1) / 7)

Suggested change
const week = Math.ceil(((date.getTime() - yearStart.getTime()) / 86400000 + 1) / 7)
const week = Math.floor((date.getTime() - yearStart.getTime()) / 86400000 / 7) + 1
Original comment in English

issue (bug_risk): The ISO week calculation is off by one for dates whose Thursday falls on day 7, 14, 21, or 28 of the year. For example, Monday 2024-01-01 is shifted to Thursday 2024-01-04 and returns W02 instead of W01, so manually marking annihilation complete writes a marker that the backend does not recognize as the current week.

Triggers: When the current UTC+4 week begins on a Monday in a week whose Thursday is exactly a multiple of seven days into the year.

Suggested fix: Calculate the ISO week using an ISO-week algorithm or date.isocalendar()-equivalent logic instead of Math.ceil((dayOfYear + 1) / 7).

Suggested change
const week = Math.ceil(((date.getTime() - yearStart.getTime()) / 86400000 + 1) / 7)
const week = Math.floor((date.getTime() - yearStart.getTime()) / 86400000 / 7) + 1

Comment on lines +61 to +70
if (isPlanMode) return '计划模式下不可用'
if (!enabled) return '已关闭'
let count = 0
try {
const parsed = JSON.parse(plansJson || '[]')
count = Array.isArray(parsed) ? parsed.length : 0
} catch {
count = 0
}
return count ? `${count} 项计划` : '尚未添加计划'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: 库存摘要会统计 DepotMaintainPlans 中数组的每个元素,包括 DepotMaintainPlanEditor 因缺少有效的 StageDropId 或数值型 DropCount 字段而丢弃的格式错误条目。因此,折叠行会报告编辑器无法显示或执行的已配置计划。

触发条件: 现有配置包含一个或多个格式错误的库存计划条目时。

建议修复: 在统计计划数量之前,应用与 DepotMaintainPlanEditor 相同的有效性过滤条件。

Original comment in English

nitpick: The inventory summary counts every array element in DepotMaintainPlans, including malformed entries that DepotMaintainPlanEditor discards because they lack valid Stage, DropId, or numeric DropCount fields. The collapsed row therefore reports configured plans that the editor cannot display or execute.

Triggers: When an existing configuration contains one or more malformed inventory-plan entries.

Suggested fix: Apply the same validity filter as DepotMaintainPlanEditor before counting plans.

流水线落地后暴露三处层级问题:任务名与二级标签同为 14px/600,仅差 1px,
从属关系看不出来;开关贴在行尾,与它控制的任务名隔着整行;「基建模式」留在
基本信息区,与「日常任务」里的 IfInfrast 开关分处两个板块,关掉基建换班后
该配置仍然亮着,看不出已失效。

基建换班提升为独立流水线行,位置对齐后端 MAA_TASKS 中 Infrast 紧跟 Fight 的
顺序;开关移到任务名左侧;二级标签降一级字重与色阶。

- 基建模式/自定义基建配置/自定义基建排班 从基本信息区移入基建换班行的详情区,
  自定义两项沿用 InfrastMode === 'Custom' 条件渲染
- IfInfrast 移出 dailyTasks,该组余下三项均为无配置的一键任务,改名「日常杂项」
- 开关移到圆点与任务名之间,独立 44px 槽位;无开关的行留占位保持任务名列对齐
- 任务名 14px→15px,二级标签 600/primary→500/secondary,详情区加左侧竖线续接轨道
- 「更多任务」原本只包一个开关,折叠为「自动肉鸽」单行,删除整层详情面板
- 行头 hover-only tooltip 图标改为详情区常驻正文,LabelWithHint 补 focus 触发,
  键盘与触屏用户不再拿不到提示(WCAG 1.4.13)
- StageConfigSection 的 8 处手写 tooltip 统一为 LabelWithHint,删除重复 CSS;
  其中「吃理智药数量」「关卡选择」的提示与标签同文,一并去掉
- 清理死代码:infrastructureConfigPath 只声明无读写,BasicInfoSection 的 4 个
  props 随基建配置迁出后失效
开发者反馈前两次重构的组名变更幅度过大。「任务流程」「日常杂项」都是新造的
说法,且左侧竖轨 + 圆点把一个普通配置列表画成了流程图,视觉噪声大于信息量。

组名回退到重构前的「任务配置」「日常任务」,删除竖轨、圆点与详情区续接线。
任务执行顺序仍由行的排列表达,标题右侧保留「按执行顺序,从上到下」说明。

- 删除 row-dot 及其连接线、row-detail::before 竖线,行内不再有 position 依赖
- 详情区改用左内边距对齐任务名列(4 + 44 开关槽 + 12 间隙 + 8)
- switchable 改名 toggleable;pipeline-row/pipeline-alert 类名改为 task-row/task-alert
- 关闭态摘要一律返回空串:关着的开关已表达关闭,摘要再写「已关闭」是重复。
  库存保持在计划模式下仍返回「计划模式下不可用」,那是用户需要的失效原因
- 补 activity/depot/fight 三个 summarize 的关闭分支测试,此前无覆盖

顺带修两处对比度不达标(均为 63b7fb5 引入,非本次改动产生):
- .is-off .row-name 从 text-tertiary 改 text-secondary。15px/600 不算 WCAG
  大字,需按 4.5:1 判定,tertiary 浅色模式下仅 3.36:1,secondary 为 7.00:1
- 删除 .is-off .row-summary 的 text-quaternary。该规则现仅作用于计划模式下的
  「计划模式下不可用」,1.84:1 近乎不可见,改为继承 .row-summary 的 7.00:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant