Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ CloudFile Server、Hub、Docker 共用以下规则:

## 当前数据库(未正式发布 V2)

- 唯一扩展表为 `cf_library_storage`、`cf_dir_acl`、`cf_sso_group_map`、`cf_edit_guard`、`cf_audit_event`、`cf_file_protection`;新装一次创建全部六表,已有卷只校验。
- 不迁移或追溯开发期旧数据。存储绑定从 Seafile 的 Repo/RepoStorageId 重新识别,ACL/共享和组织/角色从客户 Provider 重新同步,Guard/审计从空表开始;旧 `cf_tag`、Resource、Intent、Session、Outbox 不恢复。
- 唯一扩展表为 `cf_repo_feature`、`cf_dir_acl`、`cf_sso_group_map`、`cf_edit_guard`、`cf_audit_event`、`cf_file_protection`;新装创建全部六表。已有卷仅缺 `cf_repo_feature`、其余五表结构匹配且无保护记录或活动 Guard 时,Docker 启动检查可锁内补建空表。旧注册表必须停写并离线迁移。
- 存储路由的事实源为 Seafile 原生 `RepoStorageId`;旧 `cf_library_storage` 经显式离线迁移保存为 `retired_library_storage_v2`。升级默认不启用任何新库级特性,但保留已经显式启用的能力记录和保护/Guard 数据;旧 `cf_tag`、Resource、Intent、Session、Outbox 不恢复。
- 绝不清除 CE 原生 Repo、Branch、文件内容、版本或原生 Tag,也不因为缺表自动建立旧扩展 DDL、迁移服务或产品级升级框架。

## Agent2 本地文件编辑
Expand All @@ -67,7 +67,7 @@ CloudFile Server、Hub、Docker 共用以下规则:

## SQL 表边界

- 当前 Server V2 只允许 `cf_library_storage`、`cf_dir_acl`、`cf_sso_group_map`、`cf_edit_guard`、`cf_audit_event`、`cf_file_protection` 业务表。历史 `cf_library_storage_key` 的分配和冷 GC 账本不允许重新引入;存储依赖 `cf-v2-storage.c` 的预占与激活。
- 当前 Server V2 只允许 `cf_repo_feature`、`cf_dir_acl`、`cf_sso_group_map`、`cf_edit_guard`、`cf_audit_event`、`cf_file_protection` 六张业务表。历史 `cf_library_storage` 和 `cf_library_storage_key` 不再作为运行时依赖;原生 `RepoStorageId` 和既有存储路径必须保留。
- `scripts/sql/mysql/cloudfile.sql` 和 `scripts/sql/sqlite/cloudfile.sql` 属于未发行旧设计,已从产品源码删除。旧数据库迁移属于外置一次性工具,不属于构建/启动路径。

## 现行 V2 权限契约:禁止“托管库”复活(2026-10-21)
Expand Down
7 changes: 4 additions & 3 deletions doc/server-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
- **Go FileServer**:文件字节传输、Range、分块上传/提交、Scoped 下载/本地编辑与独占 Guard;CloudFile V2 要求启用 Go FileServer。上传提交必须验证 token 绑定的父目录及目标文件,不得因其他目录存在 ACL 而整库拒绝。
- **Hub Authority**:统一计算当前用户、组织/角色、原生库资格、目录继承与 `share_mode` 共享根的有效权限。Server 通过内部鉴权接口消费同一裁决,不另造托管库分类器。

## 五张扩展表(唯一现行契约)
## 六张扩展表(唯一现行契约)

| 表 | 职责 |
| --- | --- |
| `cf_library_storage` | 原生库与可选存储的绑定 |
| `cf_repo_feature` | 每库明确启用 Checkout/Protection 的能力记录;没有记录即关闭 |
| `cf_file_protection` | 已定版文件的不可变保护记录 |
| `cf_dir_acl` | 当前目录路径/主体的 ACL 和共享根,默认继承、允许局部缩权与扩权 |
| `cf_sso_group_map` | 外部组织/角色与 CE GroupUser 的映射 |
| `cf_edit_guard` | 独占编辑 Guard |
| `cf_audit_event` | 新产生的审计事件 |

不需要 `cf_dir_admin`、`cf_managed_library`、`cf_managed_library_share`、`cf_library_share_revision`、旧 Resource/Session/Intent 等扩展表。无任何第五张表以外的迁移依赖;开发期旧数据不要求历史迁移。
不需要 `cf_dir_admin`、`cf_managed_library`、`cf_managed_library_share`、`cf_library_share_revision`、旧 Resource/Session/Intent 等扩展表。不引入其他运行时扩展表。原生 `RepoStorageId` 决定存储路由,旧 `cf_library_storage` 经管理员停写后的离线迁移归档为 `retired_library_storage_v2`。升级默认不启用新能力,保留已经明确启用的记录;若已有保护文件或活动 Guard 且能力缺失,则拒绝静默关闭。

## 权限原则

Expand Down
Loading