feat(ECR-047): FunnelDefinition 写面闭环并 Closed

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

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-13 22:14:21 +08:00
co-authored by Cursor
parent 258deb0184
commit 1db5fcc018
29 changed files with 877 additions and 12 deletions
@@ -0,0 +1,23 @@
# Backend Design: ECR-047 FunnelDefinition Write
| Field | Value |
|-------|-------|
| ID | BD-2026-047 |
| Status | **Closed** |
| Coding | **Closed** |
| Migration | `000056_ops_funnel_definition_write` |
## Boundary
```text
POST/PUT /api/v1/admin/analytics/funnel-definitions*
Permission: admin.growth.write
Fields: code, title, active
system=true: code immutable
Audit: growth.funnel_definition.create|update
No C-end route · no DELETE
```
## Out
ReportTemplate · Prompt · soft-delete · auto ECR-048
+3
View File
@@ -2,6 +2,9 @@
## 2026-08-13
- **ECR-047 Closed** FunnelDefinition 薄写(`admin.growth.write` POST/PUT · migration `000056` · 无新 C 端)· **Loop STOP** · 禁自动 ECR-048 · 无 ReportTemplate
- **ECR-047 Candidate Review Approved** 首刀 = **FunnelDefinition** 薄写(code/title/active`admin.growth.write`)· **不**做 ReportTemplate · Spec/Loop/Coding **未开** · Auth 草案 PENDING
- **ECR-047 Candidate Review DRAFT** ExploreConfig 写面耗尽后开刀;**推荐 ReportTemplate** · 备选 FunnelDefinition · 禁 Prompt/Knowledge/Chunk · Spec/Loop/Coding **未开**
- **ECR-046 Closed** ScaleDefinition 元数据薄写(`explore.write` POST/PUT · create→draft · status 仍 ECR-008 · migration `000055`)· **Loop STOP** · 禁自动 ECR-047 · 无题干编辑
- **ECR-046 Candidate Review Approved** 首刀 = **ScaleDefinition 元数据薄写**slug/title/descriptioncreate→draft)· **status 仍独占 ECR-008** · Spec/Loop/Coding **未开** · Auth 草案 PENDING
- **ECR-046 Candidate Review DRAFT** 推荐 ExploreConfig 写面波次 **STOP**;慎选 ScaleDefinition(须相对 ECR-008 增量);禁 Prompt/Knowledge/Chunk · 待 Human 拍板
+3
View File
@@ -0,0 +1,3 @@
# CODE_REVIEW — ECR-047
**Verdict:** Approve · FunnelDefinition 薄写 only · 无 ReportTemplate/Prompt/soft-delete · Closed 后 STOP · ECR-008 Live Promote 仍 BLOCKED
+18
View File
@@ -0,0 +1,18 @@
ecr: ECR-047
capability: GrowthInsights
change:
type: additive
breaking_change: false
migration_required: true
apis:
- method: POST
path: /api/v1/admin/analytics/funnel-definitions
change: added
- method: PUT
path: /api/v1/admin/analytics/funnel-definitions/{id}
change: added
perms:
- code: admin.growth.write
change: added
migration: 000056_ops_funnel_definition_write
notes: no C-end route; ReportTemplate out of scope
@@ -0,0 +1,20 @@
# ECR-047
**Title:** GrowthInsights · FunnelDefinition 薄写面
**Status:** **Closed**2026-08-13
**Auth:** `ECR-047_WRITE_AUTHORIZATION.md` · Closed 后 STOP
## Change
1. Spec `ops-funnel-definition-write`
2. POST/PUT `/admin/analytics/funnel-definitions*` + `admin.growth.write` + 审计
3. 无新 C 端路由
4. Migration `000056` · OpenAPI · admin-h5
## Forbidden
ReportTemplate · Prompt 族 · soft-delete · 支付/UGC · 自动 ECR-048
## Acceptance
TEST_REPORT/ECR-047 · CODE_REVIEW Approve · Done · Closed.
@@ -0,0 +1,3 @@
# HANDOFF — Architect → Engineer · ECR-047
Auth Approved · Spec Ready · BD Approved · FunnelDefinition ONLY · migration 000056 · Closed → STOP.
@@ -0,0 +1,4 @@
# HANDOFF — Engineer → Reviewer · ECR-047
TestGrowthFunnelDefinitionWrite PASS · governance max 000056 · Ready Closed.
无 ReportTemplate/Prompt · STOP · 禁自动 ECR-048.
@@ -0,0 +1,3 @@
# PRODUCT_SPEC — ECR-047
对齐 `ops-funnel-definition-write.md` · **Closed**.
+6 -5
View File
@@ -53,20 +53,21 @@
- **本仓:** `ess_intake: strict` · Retro FAIL · 单 ECR Context
- **Ops foundation** `docs/WAVE0/` · `.ai/domain/boundary-rules.md` · `glossary.yaml` · Loop: `docs/WAVE0/LOOP_AUTHORIZATION.md`
- ECR: main 线 ECR-006016 ClosedOps 扩展 ECR-013A/B · 017040;分叉已固定为 `ECR-012-star` / `014-plan` / `015-code` / `016-insight`(见 TRACEABILITY
- **Next ECR / Max Migration** **Next=`ECR-047`(禁自动开)** · **Max=`000055`**
- **Next ECR / Max Migration** **Next=`ECR-048`(禁自动开)** · **Max=`000056`**
- **Write-Wave CMS** 041042 Closed · STOP
- **ExploreConfig** ECR-043…046 Closed · **Loop STOP** · Prompt/Knowledge/Chunk STOP
- **ExploreConfig** ECR-043…046 Closed · 同构写面 **耗尽 · STOP** · Prompt/Knowledge/Chunk STOP
- **GrowthInsights** ECR-047 FunnelDefinition Closed · **Loop STOP** · ReportTemplate 写面未开
- **Release** ECR-008 Live Promote **BLOCKED**(独立门禁 · 勿与 Write-Wave 混谈)
- EXP: (无)
- STATE: `docs/STATE/`(含 ECR-041…046
- STATE: `docs/STATE/`(含 ECR-041…047
- TRACEABILITY: `docs/TRACEABILITY.md` · 门禁 `scripts/repo-governance-check.py`
- ADR: `.ai/adr/0007-ess-ai-dual-track.md`
- Product status: `.ai/product/p1-status.md`**P1 Complete**)· `.ai/product/p2-status.md`**P2 Complete**
- Active Spec: `account-auth` · `explore-test` · `home` · `star-profile` · `life-rhythm` · `input-compliance` · `ops-system` · `profile` · `ops-banner-write` · `ops-star-config-write` · `ops-rhythm-config-write` · `ops-image-card-deck-write` · `ops-scale-definition-write`
- Active Spec: `account-auth` · `explore-test` · `home` · `star-profile` · `life-rhythm` · `input-compliance` · `ops-system` · `profile` · `ops-banner-write` · `ops-star-config-write` · `ops-rhythm-config-write` · `ops-image-card-deck-write` · `ops-scale-definition-write` · `ops-funnel-definition-write`
## WIP(尚未单独 ECR
- (无 · ECR-046 Closed · Loop STOP
- (无 · ECR-047 Closed · Loop STOP
- BD-2026-044 状态补丁:工作区可暂留 · **不**自动提交
## Pointers
+7
View File
@@ -0,0 +1,7 @@
# STATE — ECR-047
| Status | **Closed** |
| Spec | ops-funnel-definition-write |
| Migration | 000056_ops_funnel_definition_write |
| Closed | 2026-08-13 |
| Next | STOP · ECR-048 禁自动开 |
+11
View File
@@ -0,0 +1,11 @@
# TEST_REPORT — ECR-047 FunnelDefinition Write
**Commit:** (pending Close)
```bash
go test ./internal/integration/ -count=1 -run TestGrowthFunnelDefinitionWrite
python3 scripts/repo-governance-check.py
```
PASS · create · 409 · PUT 下架 · audit · 403
REPO GOVERNANCE: PASS · max 000056 · Next ECR-048(禁自动开)
+3 -2
View File
@@ -4,8 +4,8 @@
| Anchor | Value | Rule |
|--------|-------|------|
| **Next ECR** | `ECR-047` | **冻结:** 须重新 Candidate Review + Human 单独拍板;**禁止自动开刀** |
| **Max Migration** | `000055` | 禁止凭记忆 |
| **Next ECR** | `ECR-048` | **冻结:** 须重新 Candidate Review + Human 单独拍板;**禁止自动开刀** |
| **Max Migration** | `000056` | 禁止凭记忆 |
- ECR identity **全局唯一**(含已 Closed);禁止同号双义。分叉只用 `ECR-NNN-suffix` / `ECR-NNNA`
- Migration **6 位版本号唯一**。撞号修复见 `docs/MIGRATION_RENUMBER.md`
@@ -72,5 +72,6 @@
| ECR-044 | ExploreConfig · RhythmConfig 薄写面 | **Closed** | Spec ops-rhythm-config-write · BD-2026-044 · migration **000053** · Closed 后 STOP · 禁自动 ECR-045 |
| ECR-045 | ExploreConfig · ImageCardDeck 薄写面 | **Closed** | Spec ops-image-card-deck-write · BD-2026-045 · migration **000054** · Closed 后 STOP · 禁自动 ECR-046 · 无牌面编辑 |
| ECR-046 | ExploreConfig · ScaleDefinition 元数据薄写 | **Closed** | Spec ops-scale-definition-write · BD-2026-046 · migration **000055** · status 仍 ECR-008 · Closed 后 STOP · 禁自动 ECR-047 |
| ECR-047 | GrowthInsights · FunnelDefinition 薄写面 | **Closed** | Spec ops-funnel-definition-write · BD-2026-047 · migration **000056** · Closed 后 STOP · 禁自动 ECR-048 |
> **Migration** 合并后 `000015``000023` 曾撞号,已重编号至 `000050`。以 `apps/api/migrations/` 与 `docs/MIGRATION_RENUMBER.md` 为准(文档中旧号引用可能滞后)。
+49
View File
@@ -0,0 +1,49 @@
# ECR-047 Candidate Review — GrowthInsights · FunnelDefinition
> **RESOLVED 2026-08-13Human: Candidate Review → Auth/Spec/开码 → Closed):**
> 首刀 = **FunnelDefinition 薄写** · **Closed** · Loop **STOP** · 禁自动 ECR-048
**Date:** 2026-08-13
**Mode:** Candidate Review **Approved** · Spec **Closed** · Coding **Closed**
**Anchors:** Next=`ECR-048`(禁自动开)· Max Migration=`000056`
## 锁定现状
| 项 | 状态 |
|----|------|
| ECR-041042 | CMS 写面 **Closed** · STOP |
| ECR-043046 | ExploreConfig 同构写面 **Closed** · STOP |
| ECR-038 | ReportTemplate **只读** · **本刀不做** |
| ECR-039 | FunnelDefinition **只读** · 本刀写面增量 |
| ECR-008 Live Promote | **BLOCKED** |
| Continuous Loop | **STOP**046 耗尽 · 不得继承) |
| 硬 STOP | 支付 / UGC / soft-delete / Crisis·Handoff / Prompt / Knowledge / Chunk |
## 决议
**ECR-047 = GrowthInsights · FunnelDefinition 薄写面**
拟议(Spec 细化):
- 复用表 `funnel_definitions`
- 加法权限 `admin.growth.write`(授予 super_admin
- Admin `POST/PUT /admin/analytics/funnel-definitions*`
- 字段仅 `code` · `title` · `active`(与只读表对齐)
- `system=true` 种子行:允许改 title/active**禁止**改 `code` / 物理删(Spec 锁死)
- 审计 `growth.funnel_definition.create|update`
- **无**新 C 端路由
- Migration:编码时占 **000056**
- Continuous Loop**仅**单独 Auth 且 **仅限 ECR-047**Closed → STOP · **禁自动 ECR-048**
## 硬 STOP
ReportTemplate 同 ECR · Prompt / Knowledge / Chunk · 支付 · UGC · soft-delete · Crisis/Handoff · 题干 · ECR-008 Live Promote 解禁 · 自动下一刀
## 下一步(仍不写码)
1. ~~Candidate Review approve · FunnelDefinition~~ **Done**
2. Human:批准 **ECR-047 专用** Write Authorization
3. Spec `ops-funnel-definition-write` · ECR · BD
4. 开码口令后才改 `apps/`
**本回合交付 = Candidate Review RESOLVED;无 Spec · 无 Auth Loop · 无 `apps/`。**
+27
View File
@@ -0,0 +1,27 @@
# GrowthInsights Write Authorization — ECR-047 only
| Field | Value |
|-------|-------|
| Date | 2026-08-13 |
| Authorizer | Human |
| Status | **Approved · ECR-047 Closed · Loop STOP** |
| Scope | **FunnelDefinition 薄写面 ONLY** |
| Continuous Loop | **Finished · STOP** |
| After Closed | **STOP** · 禁止自动 ECR-048 |
## Human 拍板(2026-08-13
1. Candidate Review = FunnelDefinition
2. Write Auth → Spec → 开码
3. 加法 `admin.growth.write` · 字段 code/title/active · 无新 C 端路由
4. Continuous Loop **仅限 ECR-047**
## Hard STOP
ReportTemplate 同刀 · Prompt / Knowledge / Chunk · 支付 · UGC · soft-delete · Crisis/Handoff · 题干 · Closed 后自动下一刀 · ECR-008 Live Promote 解禁
## Refs
Candidate Review: `ECR-047-CANDIDATE_REVIEW.md`
Spec: `.ai/product/feature-spec/ops-funnel-definition-write.md`
ECR: `docs/ECR/ECR-047-funnel-definition-write.md`