refactor(spec): generalize Feishu to Connections

- Connections/Prelude.lean: ConnectionProvider 枚举 (当前仅飞书)
- Connections/Feishu.lean: FeishuAppBinding + FeishuProfile
- Connections.lean: ConnectionBinding/ConnectionProfile inductive
- Organization.feishu → connections: List ConnectionBinding
- User.feishu → connections: List ConnectionProfile
- 删除 FeishuConnection.lean
This commit is contained in:
2026-07-12 15:54:16 +08:00
parent 63416e06ea
commit 38c3231190
6 changed files with 53 additions and 15 deletions
+7 -8
View File
@@ -1,6 +1,5 @@
import Spec.Prelude
import Spec.System.User
import Spec.System.FeishuConnection
import Spec.System.Connections
/-!
# Hierarchy —— 主体层级
@@ -24,14 +23,14 @@ structure Platform where
/-- 平台自有飞书应用(`PINNED`, ADR-0023)。 -/
application : I.PlatformFeishuApplicationId
/-- 组织(`PINNED`, ADR-0020)。project/team 必须归属且仅归属一个 org。
飞书应用绑定 1:1(`Option` 自带),见 `FeishuConnection`。角色/tenancy/凭据见 `Spec.System.Organization`。 -/
外部连接见 `Connections`。角色/tenancy/凭据见 `Spec.System.Organization`。 -/
structure Organization where
/-- 组织标识(`OPEN` 表示)。 -/
id : I.OrganizationId
/-- 飞书应用绑定(`PINNED`, 可选;1:1,每 org 至多一个)。 -/
feishu : Option (FeishuAppBinding I)
/-- 外部连接(`PINNED`)。 -/
connections : List (ConnectionBinding I)
/-- 用户(`PINNED`, 租户层独立实体)。必属一个组织。飞书绑定见 `FeishuConnection`。 -/
/-- 用户(`PINNED`, 租户层独立实体)。必属一个组织。外部连接见 `Connections`。 -/
structure User where
/-- 用户标识(`OPEN` 表示;组织内唯一,不可改;登录用)。 -/
id : I.UserId
@@ -41,7 +40,7 @@ structure User where
displayName : String
/-- 密码哈希(`OPEN` 表示;id + 密码登录)。 -/
passwordHash : String
/-- 飞书绑定(`PINNED`, 可选)。 -/
feishu : Option (FeishuProfile I)
/-- 外部连接(`PINNED`)。 -/
connections : List (ConnectionProfile I)
end Spec.System