Conversation
切号后目标账号看不到原来的定时任务(归属还挂在旧账号下),之前的做法是 切完号再手动补一次对齐。这个 PR 把「带走定时任务」做成切号流程里的一项: - 新增 `automations` 模块:把 `automations` / `automation_delivery_outbox` 的归属 从旧账号改到目标账号(改归属而非复制,天然没有双跑);对齐前自动备份 `workbuddy.db`,表不存在 / 目标缺 uid 一律跳过并在报告里说明,不阻断切换 - `switch_account` 的入参由「restart / shareSessions / copySessionIds 三个位置参数」 改为 `SwitchOptions` 结构(serde camelCase,承载后续对齐开关的增长) - 新增 `oplog` 模块:每次切号结果追加到 `~/.wb-switch/switch_logs.json` (留痕失败不影响切换本身) - 桌面端:切号对话框新增「带走定时任务」开关(默认开);结果提示「已带走 N 个定时任务」 - 本地新增代码集中在 `api_local.rs` / `commands_local.rs`, `api.rs` / `main.rs` / `lib.rs` 各只加接线行
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
切号后目标账号看不到原来的定时任务(归属还挂在旧账号下),之前的做法是切完号再手动补一次对齐。这个 PR 把「带走定时任务」做成切号流程里的一项。
做了什么
带走定时任务
切号时把
automations/automation_delivery_outbox的归属从旧账号改到目标账号 —— 改归属而不是复制,天然没有双跑。对齐前自动备份workbuddy.db;目标账号缺 uid / 库表不存在一律跳过并在报告里说明,不阻断切换。切号选项结构化
switch_account的入参从「restart/shareSessions/copySessionIds三个位置参数」改为SwitchOptions结构(serde camelCase)。切号链路后面还要挂几项对齐开关,位置参数每加一项都得同步改两处调用点;结构化后前端契约稳定、不必逐个加参数。切号留痕
新增
oplog模块:每次切号结果追加到~/.wb-switch/switch_logs.json(保留最近 200 条,含 from→to、勾选项、分段结果)。留痕失败不影响切换本身。入口
切号对话框新增「带走定时任务」开关(默认开);结果提示「已带走 N 个定时任务」。
实现说明
crates/wb-switch-core/src/modules/automations.rs(归属对齐 + 备份)与oplog.rsapi_local.rs/commands_local.rs(新文件,合并零冲突);api.rs/main.rs/lib.rs各只加接线行session.rs的backup_workbuddy_db提为pub(crate)供复用(无行为变化)验证
cargo test -p wb-switch-core:339 passed / 9 failed —— 9 个失败与上游 main 完全相同(对照见下),非本 PR 引入cargo check -p wb-switch-core -p wb-switch-server -p wb-switch-rust:通过node node_modules/typescript/bin/tsc --noEmit:通过9 个失败的对照说明(Windows 环境)
本机 Windows 下,纯净上游 main 跑出与本分支完全相同的 9 个失败项(main 334 passed、本分支 339 passed,失败项逐一相同),涉及
variant/export_import/codebuddy_cli/session/token_stats/rate_limit_hook的平台相关断言,属上游既有问题(Linux / macOS 不受影响)。本分支未触碰这些文件。同一批失败已在 #62 中修复。