Billing implements reserve -> commit -> refund against bl_quota and bl_ledger with row-level locking and idempotency keys; the refund commits on its own transaction so a failed request cannot silently keep a user's quota. Task implements the unified task centre over the state machine. Identity issues and resolves users. Remaining domains are placeholders whose READMEs state what belongs there and what must not.
packages/identity/ — 账号与会话
职责(架构 §4.1):账号、登录、会话、设备、游客迁移、同意授权记录。
不负责:权益判定(归 billing)。
铁律
identity 不得依赖任何其他业务域(架构 §4.2)—— 登录链路不能被业务拖累。
import-linter 契约 identity must not depend on any other business domain 会
在 CI 拦下违规 import。
已实现
id_user/id_user_identity/id_consent表- 外部身份 → 内部
user_id映射(内部主键与外部身份解耦,便于加登录通道) - 同意记录写入
- JWT access token(
packages/shared/security.py)
待实现
| 需求 | 内容 |
|---|---|
| FR-ACC-01 | 华为账号登录(UnionID/OpenID) |
| FR-ACC-04 | 手机号验证码登录(5 分钟有效、单号限频) |
| FR-ACC-05 | 双令牌:id_session + 服务端可撤销的 refresh token |
| FR-ACC-02/03 | 游客模式与数据合并(合并必须幂等) |
| FR-ACC-08 | 人脸单独同意页(CR-01:必须独立,不得混入总协议) |
| FR-ACC-09 | 账号注销:7 日内彻底删除,含 COS 对象(CR-03) |
| FR-ACC-11 | 未成年人判定与功能限制(CR-04) |
| FR-SYS-01 | 越权防护:所有资源访问校验归属,不能只靠 ID 不可猜 |
POST /auth/dev-token 只是脚手架,DEV_AUTH_ENABLED=false 时不可用,
生产环境必须关闭。