feat(ECR-021): AICoreConfig SystemPrompt 只读并 Closed

新增 system_prompts 目录、admin.ai_config.read 与 admin-h5「AI」页;本切片不改运行时 Prompt、禁写发布/UGC/真支付。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-08 00:27:17 +08:00
co-authored by Cursor
parent 22f9e358ae
commit 140b08ca01
33 changed files with 649 additions and 5 deletions
@@ -0,0 +1,24 @@
# Backend Design: ECR-021 AICoreConfig
| ID | BD-2026-021 |
| Status | Approved |
| Coding | Loop authorized |
| Level | L2 |
| Migration | YES 000022 |
## Backend Change Boundary
```text
Domain: SystemPrompt (read catalog)
App: AdminHandler → admin.Service → AdminRepo
API: GET /admin/ai/system-prompts[+/:id]
Permission: admin.ai_config.read
Migration: 000022 table + seed ask_default + perm
UI: admin-h5 /ai
```
## Out of boundary
Prompt write/publish · Knowledge* · ToolDefinition · runtime engine swap · UGC · Payment
Rollback: down migration + remove routes/UI
+4
View File
@@ -1,5 +1,9 @@
# CHANGELOG — ESS process artifacts
## 2026-08-08
- **ECR-021 Closed**AICoreConfig SystemPrompt`system_prompts` · admin-h5 `/ai` · migration 000022 · 只读)
## 2026-08-07
- **ECR-020 Closed**QualityFeedback`ask_quality_feedback` · admin/user 评分 · migration 000021
+8
View File
@@ -0,0 +1,8 @@
# CODE_REVIEW — ECR-021
**Verdict:** Approve → Closed
Date: 2026-08-08 · Loop continuous
- SystemPrompt 目录只读;未改 Ask 运行时组装
- Integration AC mapped · OpenAPI updated
+23
View File
@@ -0,0 +1,23 @@
ecr: ECR-021
capability: AICoreConfig
bounded_context: Ask_Ops
parent: WAVE0-FROZEN
predecessor: ECR-020
change:
type: additive
breaking_change: false
migration_required: true
compatibility_notes: >
Adds system_prompts catalog with ask_default seed and read-only admin APIs.
Does not change Ask runtime prompt assembly in this slice.
apis:
- method: GET
path: /api/v1/admin/ai/system-prompts
change: added
- method: GET
path: /api/v1/admin/ai/system-prompts/{id}
change: added
perms:
- code: admin.ai_config.read
change: added
+19
View File
@@ -0,0 +1,19 @@
# ECR-021
**Title:** AICoreConfig · SystemPrompt(只读薄切片)
**Status:** **Closed**
**Closed:** 2026-08-08Loop continuous
**Parent:** WAVE0-FROZEN · **Predecessor:** ECR-020 Closed
**Change Level:** L2
## Change
`system_prompts` + `GET /admin/ai/system-prompts*`;权限 `admin.ai_config.read`admin-h5「AI」页。
## Forbidden
Prompt 写发布 · Knowledge/Tools · UGC · 真支付
## Linked
Spec `ops-ai-core-config.md` · BD-2026-021 · CONTRACT_DIFF/ECR-021.yaml · TEST_REPORT/ECR-021.md
@@ -0,0 +1,7 @@
# ENGINEERING_SPEC — ECR-021
1. migration 000022 system_prompts + perm
2. AdminRepo list/get
3. Admin API + OpenAPI
4. admin-h5 /ai
5. Integration · Closed
@@ -0,0 +1,3 @@
# HANDOFF — ECR-021 Architect → Engineer
Loop continuous · Approved + Coding. Migration 000022. Forbidden: Prompt写/UGC/真支付.
@@ -0,0 +1,3 @@
# HANDOFF — ECR-021 Engineer → Reviewer
TestAICoreSystemPrompts PASS · /ai · Ready for Closed.
@@ -0,0 +1,3 @@
# PRODUCT_SPEC — ECR-021
对齐 ops-ai-core-config.md · Approved · Loop · L2 · SystemPrompt 只读
+6
View File
@@ -0,0 +1,6 @@
# STATE — ECR-021
| Status | **Closed** |
| Phase | closed |
| Spec | ops-ai-core-config.md |
| Updated | 2026-08-08 |
+12
View File
@@ -0,0 +1,12 @@
id: TASK-021-ECR021
ecr: ECR-021
title: AICoreConfig SystemPrompt read
role: engineer
status: closed
change_level: L2
parent: WAVE0-FROZEN
predecessor: ECR-020
acceptance:
- Spec AC mapped
- SystemPrompt read-only
- No Knowledge/Tools write / UGC / payment
+32
View File
@@ -0,0 +1,32 @@
# TEST_REPORT — ECR-021 AICoreConfig
Date: 2026-08-08 · Loop continuous · commit: (pending)
## Commands
```bash
cd apps/api && go test ./internal/integration/ -run TestAICoreSystemPrompts -count=1
npm run build:admin
python3 scripts/ess-validate.py --phase review --ecr ECR-021
python3 scripts/ess-gate-check.py --ecr ECR-021
```
## Results
| Check | Result |
|-------|--------|
| TestAICoreSystemPrompts | PASS |
| build:admin | PASS |
| ess-validate review | PASS |
## AC
| ID | Evidence |
|----|----------|
| AC-F-01 | list 含 ask_default |
| AC-F-02 | get body 非空 |
| AC-F-03 | 未知 id → 404 |
| 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
@@ -25,3 +25,4 @@
| ECR-018 | Entitlement | **Closed** | Spec ops-entitlement · BD-2026-018 · TEST_REPORT · CODE_REVIEW · Loop continuous |
| ECR-019 | ContentSafety | **Closed** | Spec ops-content-safety · BD-2026-019 · migration 000020 · TEST_REPORT · CODE_REVIEW · Loop continuous |
| ECR-020 | QualityFeedback | **Closed** | Spec ops-quality-feedback · BD-2026-020 · migration 000021 · TEST_REPORT · CODE_REVIEW · Loop continuous |
| ECR-021 | AICoreConfig | **Closed** | Spec ops-ai-core-config · BD-2026-021 · migration 000022 · TEST_REPORT · CODE_REVIEW · Loop continuous |
+1 -1
View File
@@ -30,4 +30,4 @@ Human 明文:**直接用 Loop,不用人工确认。**
| Done | Next |
|------|------|
| ECR-013A…020 Closed | **ECR-021** AICoreConfig 薄切片(SystemPrompt 只读优先);禁真支付/UGC |
| ECR-013A…021 Closed | **ECR-022** CrisisCare 薄切片(CrisisPolicy 只读优先);禁真支付/UGC |