Skip to content

feat: 恢复 auto_daily 调度,新增配置迁移工具,修复中文选船与 delay 生效问题 - #513

Merged
YaoerWu merged 15 commits into
OpenWSGR:mainfrom
YaoerWu:refactor/config-compat-migration
Jul 28, 2026
Merged

feat: 恢复 auto_daily 调度,新增配置迁移工具,修复中文选船与 delay 生效问题#513
YaoerWu merged 15 commits into
OpenWSGR:mainfrom
YaoerWu:refactor/config-compat-migration

Conversation

@YaoerWu

@YaoerWu YaoerWu commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

概述

本 PR 恢复全天挂机调度(auto_daily),重构 classic 配置的兼容与迁移方式,并修复中文选船输入与 delay 配置不生效等问题。

关联 Issue

主要变更

🎮 emulator / scrcpy 控制器

  • 新增 SET_CLIPBOARD 支持多字节(中文)文本输入:ASCII 走 INJECT_TEXT,非 ASCII 走 SET_CLIPBOARD + 粘贴,解决选船搜索框无法输入中文的问题。
  • 精简 touch 事件注入格式。
  • 操作延迟改为调用 operation_delay() 函数,随 config 字段动态生效(不再绑定导入时的值)。

⚙️ 配置兼容层重构

  • config_compat 拆为 detect_*(运行期只读,检测到老版本配置即抛 LegacyConfigError 提示用户迁移)与 migrate_*(纯转换逻辑),移除运行期静默迁移与回写原文件
  • UserConfig 新增 operation_delay_min/max 字段,修复 classic delay 迁移后值丢失的 bug,scrcpy 通过 operation_delay() 读取。
  • 新增独立迁移工具 tools/migrate_config.py:指定 --usersettings/--planroot(默认 cwd 查找),输出到新目录(原文件不动),支持 --dry-run/--force
  • plan.from_yaml 检测到 classic 前导空 fleet 同样崩溃提示迁移。

📅 auto_daily 全天挂机调度

  • 恢复 scheduler(daily_plan / scheduler / triggers)全天挂机优先级队列调度。
  • 新增 / 恢复 ops:campaign / destroy / event_fight / exercise / normal_fight / repair / decisive.chapter。
  • 新增 bathroom context + bath_page UI 页面;types 同步调度所需枚举。

🧪 测试

  • 新增 / 补全 test_file_utilstest_destroy_unittest_scheduler_unittest_bathroomtest_migrate_configtest_repair_unit 单测。
  • 修复 test_operation_delay_field_sets_globals 在 Linux/WSL CI 的 emulator 构造问题(提供 serial+path 兼容两端)。

🐛 其他修复

  • 修复修船"一次一条"与 500 船仍触发战斗、手势控制间隔、修理列表可见卡片数限制、节点识别、bath_repair_blacklist 默认值、类型不匹配等问题。
  • 选船界面增加额外延迟。

破坏性变更

  • classic 老配置不再在运行期静默迁移:升级后需使用 tools/migrate_config.py 迁移,或在加载时报 LegacyConfigError 提示。

YaoerWu and others added 6 commits July 26, 2026 18:57
…pport

- Add SET_CLIPBOARD support for multi-byte (Chinese) text input
- Use INJECT_TEXT for ASCII, SET_CLIPBOARD+paste for non-ASCII
- Refine touch event injection format
- Update controller tests
- config_compat 拆为 detect_* (运行期只读, from_yaml 检测到老版本即抛
  LegacyConfigError 提示迁移) 与 migrate_* (纯转换, 供工具调用), 移除
  运行期静默迁移与回写原文件逻辑
- UserConfig 新增 operation_delay_min/max 字段 + 校验器写回模块全局,
  修复 classic delay 迁移后值丢失 bug (scrcpy 通过 operation_delay() 读取)
- 新增 tools/migrate_config.py 独立迁移工具: 指定 --usersettings/--planroot,
  默认 cwd 查找, 输出到新目录 (原文件不动), 支持 --dry-run/--force
- plan.from_yaml 检测到 classic 前导空 fleet 同样崩溃提示迁移

Co-Authored-By: Claude <noreply@anthropic.com>
操作延迟从直接 import 全局变量改为调用 operation_delay() 函数, 随 config
字段动态生效 (不再绑定导入时的值)。精简 test_controller 测试。

Co-Authored-By: Claude <noreply@anthropic.com>
- 恢复 scheduler (daily_plan / scheduler / triggers) 全天挂机优先级队列调度
- 新增 / 恢复 ops: campaign / destroy / event_fight / exercise /
  normal_fight / repair / decisive.chapter
- 新增 bathroom context + bath_page UI 页面; types 同步调度所需枚举

Co-Authored-By: Claude <noreply@anthropic.com>
usersettings.full.yaml / usersettings.yaml 同步 operation_delay_min/max
等新字段, 移除 classic 已迁移项。

Co-Authored-By: Claude <noreply@anthropic.com>
新增 / 补全 testing/{infra/test_file_utils, ops/test_destroy_unit,
ops/test_scheduler_unit, context/test_bathroom} 单元测试。

Co-Authored-By: Claude <noreply@anthropic.com>
@YaoerWu YaoerWu mentioned this pull request Jul 27, 2026
test_operation_delay_field_sets_globals 之前裸构造 UserConfig(...) 无 emulator:
- Linux/WSL CI: OSType.auto() 走 linux 分支强制要求 emulator.serial → ValidationError
- 改 os_type=windows 又在非 Windows 上触发 auto_emulator_path → import winreg 失败
给定 serial+path 的 emulator 既满足 linux 分支, 又让 windows 分支跳过
auto_emulator_path (不 import winreg), 两端皆过。本用例只验证 operation_delay
字段 → 模块全局。

Co-Authored-By: Claude <noreply@anthropic.com>
@YaoerWu
YaoerWu force-pushed the refactor/config-compat-migration branch from 2aef25b to 08fee16 Compare July 27, 2026 04:19
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

@YaoerWu YaoerWu changed the title feat: 恢复auto_daily+配置项兼容 feat: 恢复 auto_daily 调度,新增配置迁移工具,修复中文选船与 delay 生效问题 Jul 28, 2026
@YaoerWu
YaoerWu merged commit 6463aa7 into OpenWSGR:main Jul 28, 2026
3 checks passed
@YaoerWu
YaoerWu deleted the refactor/config-compat-migration branch July 28, 2026 11:18
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.

自动选船无法在搜索框中输入中文字符 [Bug] 配置文件中的delay未生效

2 participants