feat(ECR-048): ReportTemplate 写面闭环并 Closed

growth.write POST/PUT · migration 000057 · 无新 C 端 · Loop STOP

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-13 22:51:42 +08:00
co-authored by Cursor
parent aa197b719b
commit e0f605558b
28 changed files with 915 additions and 11 deletions
@@ -0,0 +1,73 @@
# Feature Spec: GrowthInsights · ReportTemplate 写面(Ops · ECR-048
> Status: `Active`**Implemented · ECR-048 Closed**
> Map: `§7` · Capability: `GrowthInsights` · BC: `Explore_Reports`
> Auth: `docs/WAVE0/ECR-048_WRITE_AUTHORIZATION.md`**仅 ECR-048**
> Predecessor: ECR-038 Closed(只读)· ECR-047 ClosedFunnel 写)
> 关联:[ops-report-template.md](ops-report-template.md)
---
## 1. 目标
运营可 **创建 / 更新 / 上下架** `ReportTemplate`(报告模板目录);写鉴权 + 审计;**无**新 C 端路由。
**Closed 后立即 STOP**,不自动 ECR-049。
## 2. In / Out
| In | Out |
|----|-----|
| Admin POST/PUT `/admin/growth/report-templates*` | Funnel 再写 |
| 复用 `admin.growth.write` | SystemPrompt · Knowledge · Chunk |
| 复用表 `report_templates` | soft-delete · 真支付 · UGC |
| 审计 | 题干 · Crisis/Handoff |
| | 自动 ECR-049 · 新 C 端路由 |
## 3. Domain
| 字段 | 规则 |
|------|------|
| `code` | 唯一;`^[a-z][a-z0-9_]{1,62}$``system=true` **不可改 code** |
| `title` | 必填 · ≤128 |
| `scene` | 必填;`^[a-z][a-z0-9_]{0,30}$` · ≤32 |
| `active` | `false` = 下架 |
| `system` | 种子行;禁止物理删除 |
## 4. API
| Method | Path | 权限 |
|--------|------|------|
| GET | `/admin/growth/report-templates` · `/{id}` | `admin.growth.read` |
| POST | `/admin/growth/report-templates` | `admin.growth.write` |
| PUT | `/admin/growth/report-templates/{id}` | `admin.growth.write` |
无 DELETE · 无新 C 端路径。
## 5. Permission / Migration
- Migration `000057_ops_report_template_write`:幂等确认 `super_admin``admin.growth.write`
- 编码时占号(Max=`000056``000057`
## 6. UI
admin-h5 报告模板页:列表 + 新建/编辑/上下架。
## 7. AC
| ID | Then |
|----|------|
| AC-F-01 | POST → list/get 可见 |
| AC-F-02 | PUT active=false → list 仍可见且 active=false |
| AC-F-03 | 重复 code → 409 |
| AC-S-01/02 | 401;仅 growth.read → POST 403 |
| AC-A-01 | 写产生审计 |
| AC-O-01 | 无 soft-delete · 无 Funnel/Prompt 写路径 |
## 8. Closed 后
**立即 STOP**。ECR-049 须新 Candidate Review + Human 拍板。
## 9. Trace
ECR-048 · BD-2026-048 · CONTRACT_DIFF · ECR-048_WRITE_AUTHORIZATION