63 lines
2.0 KiB
Markdown
63 lines
2.0 KiB
Markdown
# Reasonix Worker D:迁移工具与 Convex 下线 guard
|
||||
|
|
|
|||
|
|
Project root: `/mnt/Data1T/mnote`
|
|||
|
|
|
|||
|
|
你不是独自在代码库中工作。其他 worker 可能并行修改 Rust control-plane、auth/session 或 access policy。不要还原、覆盖或清理不属于你任务范围的改动。不要提交 git。
|
|||
|
|
|
|||
|
|
## 背景
|
|||
|
|
|
|||
|
|
上位设计稿:
|
|||
|
|
`design/02-convex-rust-long-term-architecture/process/2-8-convex-replace-with-rust-sqlite-control-plane-v1.md`
|
|||
|
|
|
|||
|
|
目标是给完全替换 Convex 准备迁移 dry-run 工具和 guard,不执行真实破坏性迁移。
|
|||
|
|
|
|||
|
|
## Ownership
|
|||
|
|
|
|||
|
|
允许修改:
|
|||
|
|
- 新增 `scripts/migrate-control-plane-to-sqlite.js`
|
|||
|
|
- 修改 `scripts/check-local-first-convex-guard.js` 仅限增加 SQLite 迁移期 guard 规则或建议输出
|
|||
|
|
- 可新增 `scripts/task*-sqlite-control-plane-*.js` focused smoke
|
|||
|
|
- 可向设计稿 `2-8` 追加“执行记录”,不得改设计结论
|
|||
|
|
|
|||
|
|
禁止修改:
|
|||
|
|
- `rust/crates/**`
|
|||
|
|
- `infra/convex/docker-compose.yml`
|
|||
|
|
- `.env*`
|
|||
|
|
- 不删除任何 Convex 数据、Docker volume 或本地数据文件
|
|||
|
|
|
|||
|
|
## 任务
|
|||
|
|
|
|||
|
|
1. 实现 dry-run 迁移工具:
|
|||
|
|
- 读取 `/mnt/Data1T/Mnote_data/control-plane/access-policy.json`,路径可用参数覆盖。
|
|||
|
|
- 扫描 `/mnt/Data1T/Mnote_data/users/*/workspaces/*/.mnote/workspace.json`,路径可用参数覆盖。
|
|||
|
|
- 生成 `migration-report.json`,包含 users/workspaces/grants/legacy_id_map 建议,不写 DB。
|
|||
|
|
2. 支持命令:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
node scripts/migrate-control-plane-to-sqlite.js --dry-run --out /tmp/mnote-control-plane-migration-report.json
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
3. 更新 guard 或输出建议:新增 Convex 控制面代码应被标记为禁止或迁移例外。
|
|||
|
|
4. 补最小 node smoke,断言 dry-run report 可生成。
|
|||
|
|
|
|||
|
|
## 验收命令
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
node scripts/migrate-control-plane-to-sqlite.js --dry-run --out /tmp/mnote-control-plane-migration-report.json
|
|||
|
|
npm run check:local-first-convex-guard
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
如新增 smoke:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
node scripts/<new-smoke>.js
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 最终回复格式
|
|||
|
|
|
|||
|
|
请列出:
|
|||
|
|
- 修改文件
|
|||
|
|
- dry-run report 字段
|
|||
|
|
- 实际运行过的命令及结果
|
|||
|
|
- 未完成项/风险
|