修复内置流程编队滑动被当成拖拽卡片: 补 Windows 队伍滑动手势并暴露任务日志报错

Browse Source
- aalc_input_patch: 上游只有 MuMu 适配器覆盖 mouse_swipe_for_team_scroll,
  Windows 前台/后台适配器用普通列表手势(30px/0.01s escape), 在编队列表里
  会被当成拖动罪人卡: 队伍被拖乱, 缺人时后续 battle.py 报'未能进入战斗'。
  按 MuMu 参数(缩放 60px escape/保持 0.1s/分段/停稳 0.5s)补等价实现, 不改 AALC 源码。
- tasks: 退出码 0 但日志里有 [ERROR]/异常时, task_status 增加 errors 字段
  (AALC 单次战斗失败后仍会正常退出, 只看 succeeded 会被误导)。
- 新增 7 项回归测试, 全套 101 项通过。
This commit is contained in:
DSH
2026-10-03 11:24:15 +08:00
parent 2131f89e62
commit 66418dce22
5 changed files with 296 additions and 0 deletions
+19
View File
@@ -35,6 +35,22 @@ def tail(path, n):
return [] return []
ERROR_MARKERS = ('[ERROR]', 'Traceback (most recent call last)')
ERROR_SCAN_LINES = 400
def log_errors(path, limit=3):
"""挑出日志尾部的报错行。
AALC 的每日流程在单次战斗失败后会继续跑完并正常退出(exit 0), 只看退出码
会把"超出最大尝试次数,未能进入战斗"这类失败当成成功, 所以状态里额外附上
日志里的报错行。
"""
hits = [line for line in tail(path, ERROR_SCAN_LINES)
if any(marker in line for marker in ERROR_MARKERS)]
return hits[-limit:]
class TaskRunner: class TaskRunner:
def __init__(self, run_dir, argv_factory=default_argv, keep_logs=20, restore_argv=default_restore_argv): def __init__(self, run_dir, argv_factory=default_argv, keep_logs=20, restore_argv=default_restore_argv):
@@ -112,6 +128,9 @@ class TaskRunner:
'log': self.info['log'], 'log_tail': tail(self.info['log'], max(1, min(int(lines), 200)))} 'log': self.info['log'], 'log_tail': tail(self.info['log'], max(1, min(int(lines), 200)))}
if code is not None: if code is not None:
r['exit_code'] = code r['exit_code'] = code
errors = log_errors(self.info['log'])
if errors:
r['errors'] = errors
pending = self._pending_restores() pending = self._pending_restores()
if pending: if pending:
r['pending_restore'] = [os.path.basename(p) for p in pending] r['pending_restore'] = [os.path.basename(p) for p in pending]