feat(ECR-017): AskOperations 问答会话只读并 Closed

新增 admin.ask.read、GET /admin/ask/threads*(AskSessionView)与 admin-h5「问答」页;禁改消息/UGC/真支付。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-07 18:39:37 +08:00
co-authored by Cursor
parent 1c157a0e46
commit 00a798bd85
33 changed files with 722 additions and 5 deletions
@@ -0,0 +1,24 @@
# Backend Design: ECR-017 AskOperations
| ID | BD-2026-017 |
| Status | Approved |
| Coding | Loop authorized |
| Level | L2 |
| Migration | YES 000019(权限 only |
## Backend Change Boundary
```text
Domain: AskSessionView (read)
App: AdminHandler → admin.Service → AdminRepo
API: GET /api/v1/admin/ask/threads[+/:id]
Permission: admin.ask.read
Migration: 000019 grant to super_admin
UI: admin-h5 /ask
```
## Out of boundary
Message write/delete · SystemPrompt · Knowledge* · QualityFeedback write · UGC · Payment
Rollback: down migration revoke permission + remove routes/UI
+1
View File
@@ -2,6 +2,7 @@
## 2026-08-07
- **ECR-017 Closed**AskOperationsAskSessionView 只读 · `admin.ask.read` · admin-h5 `/ask` · migration 000019
- **ECR-016 Closed**UserIntelligence`GET /admin/users/:id/insight` 只读聚合 · admin-h5 洞察 Tab · Migration NO
- **ECR-015 Closed**RedemptionCode(批次生成 · C端兑码 · 作废 · 审计)
- **ECR-014 Closed**MembershipPlan(套餐表 · admin 配置 · Grant/CreateOrder 读表)
+9
View File
@@ -0,0 +1,9 @@
# CODE_REVIEW — ECR-017
**Verdict:** Approve → Closed
Date: 2026-08-07 · Loop continuous
- Additive AskSessionView 只读;migration 000019 仅权限
- Handler → Service → Repository;无消息写 / UGC / 真支付
- Integration AC mapped · OpenAPI updated
+23
View File
@@ -0,0 +1,23 @@
ecr: ECR-017
capability: AskOperations
bounded_context: Ask_Ops
parent: WAVE0-FROZEN
predecessor: ECR-016
change:
type: additive
breaking_change: false
migration_required: true
compatibility_notes: >
Additive admin read APIs for AskSessionView.
Migration 000019 only grants admin.ask.read to super_admin.
apis:
- method: GET
path: /api/v1/admin/ask/threads
change: added
- method: GET
path: /api/v1/admin/ask/threads/{id}
change: added
perms:
- code: admin.ask.read
change: added
+19
View File
@@ -0,0 +1,19 @@
# ECR-017
**Title:** AskOperations(问答会话只读薄切片)
**Status:** **Closed**
**Closed:** 2026-08-07Loop continuous
**Parent:** WAVE0-FROZEN · **Predecessor:** ECR-016 Closed
**Change Level:** L2
## Change
`GET /admin/ask/threads` · `GET /admin/ask/threads/:id`AskSessionView);权限 `admin.ask.read`admin-h5「问答」页。
## Forbidden
改消息 · Prompt/Knowledge 配置 · QualityFeedback 写 · 真支付 · UGC
## Linked
Spec `ops-ask-operations.md` · BD-2026-017 · CONTRACT_DIFF/ECR-017.yaml · TEST_REPORT/ECR-017.md
@@ -0,0 +1,7 @@
# ENGINEERING_SPEC — ECR-017
1. migration 000019 授予 admin.ask.read
2. AdminRepo list/get AskSessionView
3. GET /admin/ask/threads* + OpenAPI
4. admin-h5 /ask
5. Integration · Closed
@@ -0,0 +1,3 @@
# HANDOFF — ECR-017 Architect → Engineer
Loop continuous · Approved + Coding. Migration 000019 permission only. Forbidden: 改消息/UGC/真支付/Prompt 配置.
@@ -0,0 +1,3 @@
# HANDOFF — ECR-017 Engineer → Reviewer
TestAskOperations PASS · admin-h5 /ask · Ready for Closed.
@@ -0,0 +1,3 @@
# PRODUCT_SPEC — ECR-017
对齐 ops-ask-operations.md · Approved · Loop · L2 · AskSessionView 只读
+6
View File
@@ -0,0 +1,6 @@
# STATE — ECR-017
| Status | **Closed** |
| Phase | closed |
| Spec | ops-ask-operations.md |
| Updated | 2026-08-07 |
+12
View File
@@ -0,0 +1,12 @@
id: TASK-017-ECR017
ecr: ECR-017
title: AskOperations implement
role: engineer
status: closed
change_level: L2
parent: WAVE0-FROZEN
predecessor: ECR-016
acceptance:
- Spec AC mapped
- Read-only AskSessionView
- No message write / UGC / payment
+31
View File
@@ -0,0 +1,31 @@
# TEST_REPORT — ECR-017 AskOperations
Date: 2026-08-07 · Loop continuous · commit: (pending)
## Commands
```bash
cd apps/api && go test ./internal/integration/ -run TestAskOperations -count=1
npm run build:admin
python3 scripts/ess-validate.py --phase review --ecr ECR-017
python3 scripts/ess-gate-check.py --ecr ECR-017
```
## Results
| Check | Result |
|-------|--------|
| TestAskOperations | PASS |
| build:admin | PASS |
| ess-validate review | PASS |
## AC
| ID | Evidence |
|----|----------|
| AC-F-01 | list 含 thread · message_count≥1 |
| AC-F-02 | detail ≥2 messages |
| AC-S-01 | 无 token → 401 |
| AC-S-02 | 仅 users.read → 403 |
| AC-P-01 | list &lt; 500ms |
| AC-O-01 | N/A 只读 |
+1
View File
@@ -21,3 +21,4 @@
| ECR-013B | AccountLifecycle | **Closed** | Spec ops-account-lifecycle · BD-2026-013B · TEST_REPORT · Parent WAVE0-FROZEN |
| ECR-014 | MembershipPlan | **Closed** | Spec ops-membership-plan · BD-2026-014 · TEST_REPORT · Loop continuous |
| ECR-016 | UserIntelligence | **Closed** | Spec ops-user-intelligence · BD-2026-016 · TEST_REPORT · CODE_REVIEW · Loop continuous |
| ECR-017 | AskOperations | **Closed** | Spec ops-ask-operations · BD-2026-017 · migration 000019 · TEST_REPORT · CODE_REVIEW · Loop continuous |
+1 -1
View File
@@ -30,4 +30,4 @@ Human 明文:**直接用 Loop,不用人工确认。**
| Done | Next |
|------|------|
| ECR-013A/B/014/015/016 Closed | **ECR-017** AskOperations 薄切片(只读会话视图优先);禁真支付/UGC |
| ECR-013A/B/014/015/016/017 Closed | **ECR-018** Entitlement 细权薄切片(或 ContentSafety);禁真支付/UGC |