Skip to content

refactor(config): 统一各专项账号配置字段 - #2089

Merged
1w1w11w1 merged 4 commits into
AUTO-MAS-Project:devfrom
1w1w11w1:account-config-unify
Nov 21, 2026
Merged

1w1w11w1 merged 4 commits into
AUTO-MAS-Project:devfrom
1w1w11w1:account-config-unify

Conversation

@1w1w11w1

Copy link
Copy Markdown
Contributor

摘要

  • 抽出 AccountNameFields / AccountCredentialFields / AccountScriptHookFields / AccountRunFields / AccountRunStatusFields 五个字段切片,13 个账号配置按需继承,共有字段只在 shared.py 声明一次。
  • 删除没有消费方的字段:Info.IfUseMasConfig、Info.Base(MaaFW/BAAH)、MaaFW 账号级 Info.Controller/Info.Resource、Data.IfPassCheck。
  • Info.Id 全部改为加密存储;Info.Account(MaaFW)、Game.Account/Game.Password(ZzzOd)并入 Info.Id/Info.Password,旧键按 legacy 迁移。
  • LastProxyStatus 收成单一 Literal,覆盖运行时真实写入的「维护中」「运行中」;服务器语义字段统一叫 Resource(HSR/SRC 的 Info.Server 改名并迁移)。

证据

  • pytest:542 passed(改动前后均全绿;tests/platform/test_task_process_job.py 在单项复跑 3 次与全量中各通过,未复现一次性失败)。
  • yarn typecheck / yarn test(210 passed)/ oxfmt --check / oxlint / yarn audit:i18n --check 均通过。
  • 迁移探针:{"Info":{"Server":"CN-Bilibili"}} → Resource;{"Game":{"Account":"…","Password":"…"}} → Info.Id/Info.Password;{"Info":{"Account":"…"}} → Info.Id,四类均按新字段落位。
  • 全部账号类型对 未知/成功/失败/维护中/运行中 五个状态均通过校验。

合并风险

  • 字段改名走 legacy 迁移,存量 JSON 由框架在输入准备阶段转换;未手工改动任何存量文件。
  • 加密字段读取路径不变(API 导出明文),但 Info.Id 下次写入会以密文落盘。
  • 前端 src/api 按生成器输出更新,未手改。

🤖 Generated with Claude Code

- 抽出 AccountNameFields / AccountCredentialFields / AccountScriptHookFields /
  AccountRunFields / AccountRunStatusFields 五个切片,13 个账号配置按需继承,
  共有字段只在 shared.py 声明一次
- 删除没有消费方的字段:Info.IfUseMasConfig(General/BetterGI)、Info.Base 与
  账号级 Controller/Resource(MaaFW)、Data.IfPassCheck
- Info.Id 全部改加密存储;MaaFW 的 Info.Account、ZzzOd 的 Game.Account/Password
  并入 Info.Id/Password,旧键按 legacy 迁移
- LastProxyStatus 收成 shared.ProxyStatus 单一 Literal,覆盖运行时真实写入的
  维护中/运行中,修复 ZzzOd/Whimbox 写这两个值会校验失败
- 服务器语义字段统一叫 Resource:HSR/SRC 的 Info.Server 改名并 legacy 迁移
- 前端同步改名、删除死字段默认值与写入,API 模型按生成器重新生成

Co-Authored-By: Claude Code <[email protected]>
@github-actions github-actions Bot added 模块: 主页 按更新日志碎片自动设置 类型: 变更 按更新日志碎片自动设置 labels Nov 20, 2026
Comment thread app/task/M9A/migration.py Resolved
1w1w11w1 and others added 3 commits November 20, 2026 18:01
M9A 迁移直接读原始字典,早于 pydantic 的 legacy 转换,所以改读 Id 之后
仍带 Info.Account 的存量配置会读到空账号,进而在整理队列时丢掉账号。
统一走 _account_of():先 Id 后 Account,密文先解出明文。

另把两处断言依赖真实账号串的 Okww 测试标记为仅在 Windows 运行——
账号字段加密后依赖 DPAPI,Linux CI 上构造即会抛 UnsupportedPlatformError。

Co-Authored-By: Claude Code <[email protected]>
子进程用 write_text 写心跳,会先截断再写;读者正好撞上就拿到空串,
int("") 直接失败。本机基线就有约 1/5 的偶发失败,CI 上也复现。

改为 read_heartbeat():读到空返回 None,调用方跳过这一拍继续等。
不改成原子写是因为 Windows 上 os.replace 会与正在读取的目标文件冲突,
反而让子进程抛错退出。

Co-Authored-By: Claude Code <[email protected]>
@1w1w11w1
1w1w11w1 merged commit dde5626 into AUTO-MAS-Project:dev Nov 21, 2026
8 checks passed
github-actions Bot added a commit that referenced this pull request Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

模块: 主页 按更新日志碎片自动设置 类型: 变更 按更新日志碎片自动设置

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant