chore: checkpoint turso and ai runtime work
This commit is contained in:
@@ -6,11 +6,7 @@
|
||||
## 后端选择
|
||||
|
||||
```bash
|
||||
# 默认回滚 / 离线模式
|
||||
export MNOTE_CONTROL_PLANE_BACKEND=sqlite
|
||||
export MNOTE_CONTROL_PLANE_DB_PATH=/mnt/Data1T/Mnote_data/control-plane/control-plane.db
|
||||
|
||||
# 无云本地 libSQL 验证
|
||||
# 默认本地 libSQL 运行时(无云依赖)
|
||||
export MNOTE_CONTROL_PLANE_BACKEND=libsql-local
|
||||
export MNOTE_TURSO_LOCAL_PATH=/mnt/Data1T/Mnote_data/control-plane/control-plane-libsql.db
|
||||
|
||||
@@ -41,7 +37,7 @@ export MNOTE_TURSO_SYNC_INTERVAL_MS=5000
|
||||
|
||||
- 本地 `.md`、附件、mindmap、OnlyOffice 文件仍是 local-first 文件真相,不迁入 Turso。
|
||||
- Turso 只承接 Rust control-plane 元数据:auth、session、workspace、grant、AI policy/runtime、audit/outbox 等。
|
||||
- `dev-hot` 默认可继续使用 `libsql-local`;`desktop-hot` 仍保守保留 `sqlite` fallback 默认。
|
||||
- `dev-hot`、`desktop-hot`、prod runtime 默认使用 `libsql-local`;`sqlite` 不再是 mnote-web 运行时后端。
|
||||
- `turso-remote` / `turso-local-replica` / `turso-synced` 只作为 dev DB dry-run、迁移演练、回滚演练和后续受保护 smoke。
|
||||
- remote 成为长期候选默认前,必须先完成 Argon2id password hash migration、remote smoke、rollback export 和 token 轮换策略。
|
||||
|
||||
@@ -115,21 +111,19 @@ cargo run --manifest-path rust/Cargo.toml -p control-plane --bin control-plane-a
|
||||
--reset-target
|
||||
```
|
||||
|
||||
## 回滚到 SQLite
|
||||
## 导出到 SQLite 备份
|
||||
|
||||
SQLite 仅作为 control-plane-admin 迁移 / 导出格式和测试隔离实现,不再作为 mnote-web runtime fallback。需要离线备份时执行:
|
||||
|
||||
```bash
|
||||
cargo run --manifest-path rust/Cargo.toml -p control-plane --bin control-plane-admin -- \
|
||||
export-target-to-sqlite \
|
||||
--backend "$MNOTE_CONTROL_PLANE_BACKEND" \
|
||||
--output /mnt/Data1T/Mnote_data/control-plane/control-plane.db \
|
||||
--output /mnt/Data1T/Mnote_data/control-plane/control-plane.backup.sqlite \
|
||||
--backup-existing
|
||||
|
||||
export MNOTE_CONTROL_PLANE_BACKEND=sqlite
|
||||
export MNOTE_CONTROL_PLANE_DB_PATH=/mnt/Data1T/Mnote_data/control-plane/control-plane.db
|
||||
npm run desktop:hot
|
||||
```
|
||||
|
||||
回滚前必须保留 Turso DB 至少 30 天,便于审计和补导出。
|
||||
备份文件仅用于审计、对照和后续手工恢复,不作为 `npm run desktop:hot` / `npm run dev:hot` 启动后端。
|
||||
|
||||
## 验证命令
|
||||
|
||||
@@ -137,7 +131,7 @@ npm run desktop:hot
|
||||
cargo check --manifest-path rust/Cargo.toml -p mnote-web
|
||||
cargo test --manifest-path rust/Cargo.toml -p control-plane
|
||||
cargo test --manifest-path rust/Cargo.toml -p control-plane --features turso-unit-tests -- --test-threads=1
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web app_state_initializes_sqlite_control_plane_store
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web app_state_initializes_control_plane_store_for_tests
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web dev_seed -- --test-threads=1
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web local_folder_watcher -- --test-threads=1
|
||||
node --test scripts/desktop-hot.test.js
|
||||
@@ -156,9 +150,9 @@ rg -n "sqlite3|better-sqlite3|node:sqlite|MNOTE_CONTROL_PLANE_DB_PATH|control-pl
|
||||
允许命中范围:
|
||||
|
||||
- `control-plane-admin` CLI
|
||||
- `sqlite` fallback 环境变量
|
||||
- `scripts/lib/control-plane-test-env.js`
|
||||
- `desktop-hot` / `dev-hot` / `prod-build-start` 的后端选择逻辑
|
||||
- `control-plane-admin` 的 SQLite 迁移 / 导出参数
|
||||
- `scripts/lib/control-plane-test-env.js` 的显式测试后端参数
|
||||
- `desktop-hot` / `dev-hot` / `prod-build-start` 对 `sqlite` runtime 的拒绝逻辑
|
||||
- legacy `evidence.sqlite` / local search 测试边界
|
||||
|
||||
不允许命中范围:
|
||||
@@ -171,7 +165,7 @@ rg -n "sqlite3|better-sqlite3|node:sqlite|MNOTE_CONTROL_PLANE_DB_PATH|control-pl
|
||||
- 缺 URL/token:应返回 `InvalidInput` 或启动时报清晰错误,不允许 panic。
|
||||
- 本地 libSQL path 不可写:应返回 storage error,不允许 panic。
|
||||
- remote 网络不可达、5xx、限流、replica 同步失败:属于后续云端同步/备份链路验收,必须在真实 Turso dev DB 配好后补注入测试。
|
||||
- 真实 remote / replica / synced 未验证前,默认保留 `sqlite` fallback;本地功能测试优先使用 `libsql-local`。
|
||||
- 真实 remote / replica / synced 未验证前,本地功能测试优先使用 `libsql-local`;不再回落到 SQLite runtime。
|
||||
|
||||
## Turso dev DB 后续云端验证项
|
||||
|
||||
|
||||
Reference in New Issue
Block a user