feat: ship loose-offline dbsync (validate, agent push, LWW audit)

Add UUID/FK channel checks, agent whitelist/push APIs, bindings, super-admin LWW audit with rollback, reconcile rate limits, and sync docs. Default customers stay opt-in; company conflict UI is removed.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-07-31 17:54:14 +08:00
parent 632057c857
commit 76cdcd760e
39 changed files with 3302 additions and 199 deletions

View File

@@ -0,0 +1,35 @@
# 发版说明 · 数据同步(智建平台)
## 对默认客户
- **无感**:未显式开通时,不改变现有保存 / 自增表行为。
- `local_dbsync` 为**增值开通**(客户端显式配置);平台**不会**全员切默认。
## 本版本智建已交付
| 能力 | 说明 |
|------|------|
| 通道校验 | UUID TEXT PK + FK 闭包;拒绝自增整数作同步键 |
| Agent API | 拉白名单、push / push batch → 线上 A |
| Binding | `local_database_id ↔ online_db_id` 登记查询 |
| LWW | 默认源端覆盖;超管审计 + 单行回滚;公司 conflicts → 403 |
| 同步修复 | 对账限流(默认 300s |
## 管理员文档
- [数据同步-开通说明.md](./数据同步-开通说明.md)
- [数据同步-迁移手册.md](./数据同步-迁移手册.md)(旧客迁入,禁止静默)
- [同步表约定.md](./同步表约定.md)
- [数据同步-中间件.md](./数据同步-中间件.md)
## 配置platform
```yaml
DBSync:
Enabled: true
DataDir: ./data/dbsync
LwwAuditTTLDays: 90
ReconcileMinSec: 300
```
客户端 agent / 写网关由对接方自行落地;接口以本文档与 OpenAPI `/api/v1/meta/openapi.yaml` 为准。