- wire SQLite control-plane access/session paths into Rust web local-folder routes - preserve local Markdown attachment semantics across upload, reload, and secondary-pane resource tabs - refresh design governance docs, Reasonix task templates, and bug records - retire root .mcp.json local MCP config
57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
# Reasonix Worker C:Access policy SQLite adapter
|
||
|
||
Project root: `/mnt/Data1T/mnote`
|
||
|
||
你不是独自在代码库中工作。其他 worker 可能并行修改 SQLite store、auth/session 或迁移脚本。不要还原、覆盖或清理不属于你任务范围的改动。不要提交 git。
|
||
|
||
## 背景
|
||
|
||
上位设计稿:
|
||
`design/02-convex-rust-long-term-architecture/process/2-8-convex-replace-with-rust-sqlite-control-plane-v1.md`
|
||
|
||
当前 `access-policy.json` 是本地目录授权事实源,但完全替换 Convex 后,应迁到 SQLite。你的任务是抽象 access policy adapter,保留 JSON fallback,为 SQLite grant 接入打接口。
|
||
|
||
## Ownership
|
||
|
||
允许修改:
|
||
- `rust/crates/mnote-web/src/routes/local_folder_source.rs`
|
||
- 可新增 `rust/crates/mnote-web/src/local_access_sqlite.rs`
|
||
- 可新增 focused tests
|
||
|
||
禁止修改:
|
||
- `rust/crates/mnote-web/src/routes/session.rs`
|
||
- `rust/crates/mnote-web/src/routes/gateway.rs`
|
||
- `rust/crates/mnote-web/src/ssr/pages/admin.rs`
|
||
- `rust/crates/mnote-web/src/ssr/styles.rs`
|
||
- `infra/convex/**`
|
||
- `.env*`
|
||
|
||
## 任务
|
||
|
||
1. 找出 `ensure_local_workspace_read_access` / write access / admin access 的现有调用和策略读取点。
|
||
2. 抽象一个 access policy provider/adapter:
|
||
- JSON provider 维持现有行为。
|
||
- SQLite provider 可先是 trait/mock/stub,不要求真实 DB。
|
||
3. 增加测试覆盖:
|
||
- 默认 workspace owner 有 write。
|
||
- read grant 禁写。
|
||
- write grant 可写。
|
||
- 未授权拒绝。
|
||
4. 为后续 SQLite store 接入预留最小接口,不要重写 tree command 或 UI。
|
||
|
||
## 验收命令
|
||
|
||
```bash
|
||
cargo test --manifest-path rust/Cargo.toml -p mnote-web local_access_policy -- --nocapture
|
||
cargo test --manifest-path rust/Cargo.toml -p mnote-web local_workspace_access -- --nocapture
|
||
cargo fmt --check --all
|
||
```
|
||
|
||
## 最终回复格式
|
||
|
||
请列出:
|
||
- 修改文件
|
||
- 新增 adapter/trait 设计
|
||
- 实际运行过的命令及结果
|
||
- 未完成项/风险
|