refactor: 收敛公开工作区运行时契约

This commit is contained in:
que01 committed 2026-09-25 12:19:20 +08:00
1 parent d5e63be074
commit 9b61047ec6
13 files changed
+93 -64

No files matched your search

@@ -0,0 +1,18 @@
# 进度
- 任务:public/workspace 契约加固
- 形态:single-full
- 进度:4/4
- 当前:唯一 Runtime Workspace 契约已落地,等待提交
- 真相文件:`TODO.csv`
## 审计结论
当前接口同时返回 Runtime 投影和原始/重复别名:`fields`、`trustContent`、`inquiryForm`、`runtimeCapabilities`、`runtimeModules`。这些字段与 `inquiryForms`、`trustPresentation`、`capabilities`、`modules` 重叠,会使模板消费者误读历史数据。
## 已完成
- `/public/workspace` 只返回 canonical Runtime Workspace 字段。
- Miniapp 已移除 `workspace.fields` 和 `workspace.trustContent` fallback。
- API client 类型与 API 回归断言已同步。
- 验证:全仓 `typecheck`、`format:check`、Miniapp fixture 通过;API integration 36/37,剩余失败是既有测试用例共享品牌草稿状态导致的发布 400,与本轮 workspace 契约断言无关。
@@ -0,0 +1,17 @@
# public/workspace 契约加固
## 目标
让 `/public/workspace` 只返回已发布品牌的单一 Runtime Workspace 契约,移除原始 Prisma 字段和重复别名,避免模板与小程序混用历史数据结构。
## 范围
- 以 `RuntimeWorkspace` 作为公开响应的唯一业务数据模型。
- 保留模板渲染所需的模板元数据和视觉 manifest,但不返回数据库原始实体。
- 更新 Miniapp、共享类型和 API 集成测试。
- 验证草稿不会进入公开接口,品牌数据不会串租户。
## 非目标
- 不新增模板或行业字段。
- 不改变发布快照的数据库存储结构。
@@ -0,0 +1,5 @@
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
1,定义唯一公开 Runtime Workspace 契约,DONE,响应类型不包含原始 Prisma 重复字段,pnpm --filter @personal-brand/types typecheck,2026-09-25,0,RuntimeWorkspace 成为唯一业务数据模型
2,迁移 API 与 Miniapp 消费者,DONE,小程序只读取 canonical 字段,pnpm --filter @personal-brand/miniapp test:fixture,2026-09-25,0,移除历史字段 fallback
3,补齐 API 隔离与发布回归测试,DONE,三品牌和草稿隔离测试通过,pnpm --filter @personal-brand/api test:integration,2026-09-25,0,契约相关断言通过;全套 36/37,剩余用例为既有发布状态共享失败
4,格式类型检查与记录结果,DONE,format/typecheck 通过并更新 PROGRESS.md,pnpm format:check && pnpm typecheck,2026-09-25,0,全仓 typecheck 与 format 通过
1 id task status acceptance_criteria validation_command completed_at retry_count notes
2 1 定义唯一公开 Runtime Workspace 契约 DONE 响应类型不包含原始 Prisma 重复字段 pnpm --filter @personal-brand/types typecheck 2026-09-25 0 RuntimeWorkspace 成为唯一业务数据模型
3 2 迁移 API 与 Miniapp 消费者 DONE 小程序只读取 canonical 字段 pnpm --filter @personal-brand/miniapp test:fixture 2026-09-25 0 移除历史字段 fallback
4 3 补齐 API 隔离与发布回归测试 DONE 三品牌和草稿隔离测试通过 pnpm --filter @personal-brand/api test:integration 2026-09-25 0 契约相关断言通过;全套 36/37,剩余用例为既有发布状态共享失败
5 4 格式类型检查与记录结果 DONE format/typecheck 通过并更新 PROGRESS.md pnpm format:check && pnpm typecheck 2026-09-25 0 全仓 typecheck 与 format 通过