feat(ECR-046): ScaleDefinition 元数据写面闭环并 Closed

explore.write POST/PUT · create→draft · status 仍 ECR-008 · migration 000055 · Loop STOP

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-13 21:56:11 +08:00
co-authored by Cursor
parent fa8b0ba963
commit b3fe4363fd
28 changed files with 868 additions and 10 deletions
@@ -0,0 +1,22 @@
# Backend Design: ECR-046 ScaleDefinition Write
| Field | Value |
|-------|-------|
| ID | BD-2026-046 |
| Status | **Closed** |
| Coding | **Closed** |
| Migration | `000055_ops_scale_definition_write` |
## Boundary
```text
POST/PUT /api/v1/admin/explore/scales*
Permission: admin.explore.write
Fields: slug, title, description (create → draft)
Status: ECR-008 PATCH only
Audit: explore.scale_definition.create|update
```
## Out
questions · status on explore path · soft-delete · Prompt · auto ECR-047
+3
View File
@@ -2,6 +2,9 @@
## 2026-08-13
- **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 拍板
- **ECR-045 Closed** ExploreConfig ImageCardDeck 薄写面(复用 `admin.explore.write` · POST/PUT · `GET /cards/decks` · `/cards` 空态/失败回退 · migration `000054` · **无牌面编辑**)· **Loop STOP** · 禁自动 ECR-046
- **ECR-045 Candidate Review Approved** 首刀 = **ImageCardDeck**(不预设 SystemPrompt;禁牌面内容编辑)· Spec/Loop/Coding **未开** · Auth 草案 PENDING
- **ECR-044 Closed** ExploreConfig RhythmConfig 薄写面(复用 `admin.explore.write` · POST/PUT · `GET /rhythm/configs` · `/rhythm` 空态/失败回退 · migration `000053`)· **Continuous Loop STOP** · 禁自动 ECR-045
+3
View File
@@ -0,0 +1,3 @@
# CODE_REVIEW — ECR-046
**Verdict:** Approve · ScaleDefinition 元数据 only · status 通道未侵入 · 无题干/soft-delete/Prompt · Closed 后 STOP · ECR-008 Live Promote 仍 BLOCKED
+20
View File
@@ -0,0 +1,20 @@
ecr: ECR-046
capability: ExploreConfig
change:
type: additive
breaking_change: false
migration_required: true
apis:
- method: POST
path: /api/v1/admin/explore/scales
change: added
- method: PUT
path: /api/v1/admin/explore/scales/{id}
change: added
perms:
- code: admin.explore.write
change: reused
- code: admin.content.write
change: unchanged_status_channel
migration: 000055_ops_scale_definition_write
notes: status publish remains PATCH /admin/scales/{id} (ECR-008)
@@ -0,0 +1,20 @@
# ECR-046
**Title:** ExploreConfig · ScaleDefinition 元数据薄写
**Status:** **Closed**2026-08-13
**Auth:** `ECR-046_WRITE_AUTHORIZATION.md` · Closed 后 STOP
## Change
1. Spec `ops-scale-definition-write`
2. POST/PUT `/admin/explore/scales*` + explore.write + 审计
3. status 仍 ECR-008;无新 C 端路由
4. Migration `000055` · OpenAPI · admin-h5
## Forbidden
题干 · explore 改 status · soft-delete · Prompt 族 · 支付/UGC · 自动 ECR-047
## Acceptance
TEST_REPORT/ECR-046 · CODE_REVIEW Approve · Done · Closed.
@@ -0,0 +1,5 @@
# HANDOFF — Architect → Engineer · ECR-046
**Coding AUTHORIZED.** ScaleDefinition metadata only.
Reuse explore.write. Migration 000055. Status via ECR-008 only.
After Closed: STOP — no ECR-047.
@@ -0,0 +1,4 @@
# HANDOFF — Engineer → Reviewer · ECR-046
TestExploreScaleDefinitionWrite PASS · governance max 000055 · Ready Closed.
status 仍 ECR-008 · 无题干写 · STOP · 禁自动 ECR-047.
@@ -0,0 +1,3 @@
# PRODUCT_SPEC — ECR-046
对齐 `ops-scale-definition-write.md` · **Closed**.
+5 -5
View File
@@ -53,20 +53,20 @@
- **本仓:** `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-046`(禁自动开)** · **Max=`000054`**
- **Next ECR / Max Migration** **Next=`ECR-047`(禁自动开)** · **Max=`000055`**
- **Write-Wave CMS** 041042 Closed · STOP
- **ExploreConfig** ECR-043/044/045 Closed · **Loop STOP** · Prompt/Knowledge/Chunk STOP
- **ExploreConfig** ECR-043046 Closed · **Loop STOP** · Prompt/Knowledge/Chunk STOP
- **Release** ECR-008 Live Promote **BLOCKED**(独立门禁 · 勿与 Write-Wave 混谈)
- EXP: (无)
- STATE: `docs/STATE/`(含 ECR-041…045
- STATE: `docs/STATE/`(含 ECR-041…046
- 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`
- 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`
## WIP(尚未单独 ECR
- (无 · ECR-045 Closed · Loop STOP
- (无 · ECR-046 Closed · Loop STOP
- BD-2026-044 状态补丁:工作区可暂留 · **不**自动提交
## Pointers
+7
View File
@@ -0,0 +1,7 @@
# STATE — ECR-046
| Status | **Closed** |
| Spec | ops-scale-definition-write |
| Migration | 000055_ops_scale_definition_write |
| Closed | 2026-08-13 |
| Next | STOP · ECR-047 禁自动开 |
+11
View File
@@ -0,0 +1,11 @@
# TEST_REPORT — ECR-046 ScaleDefinition Write
**Commit:** (pending Close)
```bash
go test ./internal/integration/ -count=1 -run TestExploreScaleDefinitionWrite
python3 scripts/repo-governance-check.py
```
PASS · create draft · 409 · PUT 保 status · C 端 draft 不可见 / publish 后可见 · audit · 403
REPO GOVERNANCE: PASS · max 000055 · Next ECR-047(禁自动开)
+3 -2
View File
@@ -4,8 +4,8 @@
| Anchor | Value | Rule |
|--------|-------|------|
| **Next ECR** | `ECR-046` | **冻结:** 须重新 Candidate Review + Human 单独拍板;**禁止自动开刀** |
| **Max Migration** | `000054` | 禁止凭记忆 |
| **Next ECR** | `ECR-047` | **冻结:** 须重新 Candidate Review + Human 单独拍板;**禁止自动开刀** |
| **Max Migration** | `000055` | 禁止凭记忆 |
- ECR identity **全局唯一**(含已 Closed);禁止同号双义。分叉只用 `ECR-NNN-suffix` / `ECR-NNNA`
- Migration **6 位版本号唯一**。撞号修复见 `docs/MIGRATION_RENUMBER.md`
@@ -71,5 +71,6 @@
| ECR-043 | ExploreConfig · StarConfig 薄写面 | **Closed** | Spec ops-star-config-write · BD-2026-043 · migration **000052** · Closed 后 STOP · 禁自动 ECR-044 |
| 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 |
> **Migration** 合并后 `000015``000023` 曾撞号,已重编号至 `000050`。以 `apps/api/migrations/` 与 `docs/MIGRATION_RENUMBER.md` 为准(文档中旧号引用可能滞后)。
+58
View File
@@ -0,0 +1,58 @@
# ECR-046 Candidate Review — ExploreConfig · ScaleDefinition
> **RESOLVED 2026-08-13Human: Candidate Review → Auth/Spec/开码 → Closed):**
> 首刀 = **ScaleDefinition 增量写** · **Closed** · Loop **STOP** · 禁自动 ECR-047
**Date:** 2026-08-13
**Mode:** Candidate Review **Approved** · Spec **Closed** · Coding **Closed**
**Anchors:** Next=`ECR-047`(禁自动开)· Max Migration=`000055`
## 锁定现状
| 项 | 状态 |
|----|------|
| ECR-041045 | **CLOSED** · origin/main 齐平(至 045 |
| ECR-008 | `PATCH /admin/scales/:id` · `admin.content.write` · **仅 status** · Live Promote **BLOCKED** |
| ECR-040 | Explore scales **只读**`explore.read` / `content.write` |
| Continuous Loop | **STOP**045 Auth 耗尽) |
| 硬 STOP | 支付 / UGC / soft-delete / Crisis·Handoff / Prompt / Knowledge / Chunk |
## 相对 ECR-008 的增量边界(强制 · Spec 不得偏离)
| 归属 | API | 权限 | 字段 |
|------|-----|------|------|
| **ECR-008(保持)** | `PATCH /admin/scales/{id}` | `admin.content.write` | **仅** `status` ∈ {published, draft} |
| **ECR-046(新增)** | `POST/PUT /admin/explore/scales*` | `admin.explore.write` | **仅** `slug` · `title` · `description`(创建默认 `status=draft` |
**禁止:**
- 在 explore 写路径改 `status`(避免双通道)
- 题干 / `scale_questions` CRUD
- `deleted_at` soft-delete
- 新建权限子系统
## 决议
**ECR-046 = ExploreConfig · ScaleDefinition 元数据薄写面**
拟议(Spec 细化):
- 复用表 `scales`
- 复用 `admin.explore.write`
- 审计 `explore.scale_definition.create|update`
- C 端:继续依赖 `status=published` 供给(由 ECR-008 PATCH 控制);本刀可观察点 = admin 可创建/改元数据且 **不**绕过 content 上下架
- Migration:编码时占 **000055**(幂等确认 explore.write
- Continuous Loop**仅**单独 Auth 且 **仅限 ECR-046**Closed → STOP · 禁自动 ECR-047
## 硬 STOP
Prompt / Knowledge / Chunk · 支付 · UGC · soft-delete · Crisis/Handoff · 题干编辑 · 重复 status PATCH · ECR-008 Live Promote 解禁 · 自动下一刀
## 下一步(仍不写码)
1. ~~Candidate Review approve · ScaleDefinition~~ **Done**
2. Human:批准 **ECR-046 专用** Write Authorization
3. Spec `ops-scale-definition-write` · ECR · BD(必须含上表增量矩阵)
4. 开码口令后才改 `apps/`
**本回合交付 = Candidate Review RESOLVED;无 Spec · 无 Auth Loop · 无 `apps/`。**
+21
View File
@@ -0,0 +1,21 @@
# ExploreConfig Write Authorization — ECR-046 only
| Field | Value |
|-------|-------|
| Date | 2026-08-13 |
| Authorizer | Human |
| Status | **Approved · ECR-046 Closed · Loop STOP** |
| Scope | **ScaleDefinition 元数据薄写 ONLY** |
| Continuous Loop | **Finished · STOP** |
| After Closed | **STOP** · 禁止自动 ECR-047 |
## Human 拍板
1. Candidate Review = ScaleDefinition
2. Write Auth → Spec → 开码
3. 增量:`explore.write` → slug/title/description`content.write` → statusECR-008 独占)
4. 禁题干 / soft-delete / Prompt 族
## Hard STOP
题干 CRUD · explore 路径改 status · Prompt/Knowledge/Chunk · 支付 · UGC · soft-delete · Crisis/Handoff · 自动 ECR-047 · ECR-008 Live Promote 解禁