feat(ECR-019): ContentSafety FilterRule 只读并 Closed
新增 filter_rules、admin.content_safety.read、列表/详情/试匹配 API 与 admin-h5「安全」页;禁审核写/UGC/真支付。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Backend Design: ECR-019 ContentSafety
|
||||
|
||||
| ID | BD-2026-019 |
|
||||
| Status | Approved |
|
||||
| Coding | Loop authorized |
|
||||
| Level | L2 |
|
||||
| Migration | YES 000020 |
|
||||
|
||||
## Backend Change Boundary
|
||||
|
||||
```text
|
||||
Domain: FilterRule (read) + evaluate (no ModerationCase write)
|
||||
App: AdminHandler → admin.Service → AdminRepo
|
||||
API: GET /admin/content-safety/filter-rules[+/:id]
|
||||
POST /admin/content-safety/evaluate
|
||||
Permission: admin.content_safety.read
|
||||
Migration: 000020 table + seed + perm
|
||||
UI: admin-h5 /safety
|
||||
```
|
||||
|
||||
## Out of boundary
|
||||
|
||||
ModerationCase · CrisisPolicy write · UGC · Payment · external moderation vendor
|
||||
|
||||
Rollback: down migration + remove routes/UI
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
## 2026-08-07
|
||||
|
||||
- **ECR-019 Closed**:ContentSafety FilterRule(`filter_rules` · evaluate · admin-h5 `/safety` · migration 000020)
|
||||
- **ECR-018 Closed**:Entitlement(`GET /admin/users/:id/entitlements` · admin-h5 权益 Tab · Migration NO)
|
||||
- **ECR-017 Closed**:AskOperations(AskSessionView 只读 · `admin.ask.read` · admin-h5 `/ask` · migration 000019)
|
||||
- **ECR-016 Closed**:UserIntelligence(`GET /admin/users/:id/insight` 只读聚合 · admin-h5 洞察 Tab · Migration NO)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# CODE_REVIEW — ECR-019
|
||||
|
||||
**Verdict:** Approve → Closed
|
||||
|
||||
Date: 2026-08-07 · Loop continuous
|
||||
|
||||
- FilterRule 表 + 只读/试匹配;无 ModerationCase 写
|
||||
- Handler → Service → Repository;无 UGC / 真支付
|
||||
- Integration AC mapped · OpenAPI updated
|
||||
@@ -0,0 +1,26 @@
|
||||
ecr: ECR-019
|
||||
capability: ContentSafety
|
||||
bounded_context: Content_Safety
|
||||
parent: WAVE0-FROZEN
|
||||
predecessor: ECR-018
|
||||
change:
|
||||
type: additive
|
||||
breaking_change: false
|
||||
migration_required: true
|
||||
compatibility_notes: >
|
||||
Adds filter_rules table with system seeds and read/evaluate admin APIs.
|
||||
No ModerationCase / Crisis write paths.
|
||||
|
||||
apis:
|
||||
- method: GET
|
||||
path: /api/v1/admin/content-safety/filter-rules
|
||||
change: added
|
||||
- method: GET
|
||||
path: /api/v1/admin/content-safety/filter-rules/{id}
|
||||
change: added
|
||||
- method: POST
|
||||
path: /api/v1/admin/content-safety/evaluate
|
||||
change: added
|
||||
perms:
|
||||
- code: admin.content_safety.read
|
||||
change: added
|
||||
@@ -0,0 +1,19 @@
|
||||
# ECR-019
|
||||
|
||||
**Title:** ContentSafety · FilterRule(只读薄切片)
|
||||
**Status:** **Closed**
|
||||
**Closed:** 2026-08-07(Loop continuous)
|
||||
**Parent:** WAVE0-FROZEN · **Predecessor:** ECR-018 Closed
|
||||
**Change Level:** L2
|
||||
|
||||
## Change
|
||||
|
||||
`filter_rules` + `GET /admin/content-safety/filter-rules*` · `POST .../evaluate`;权限 `admin.content_safety.read`;admin-h5「安全」页。
|
||||
|
||||
## Forbidden
|
||||
|
||||
ModerationCase 写 · Crisis 配置写 · UGC · 真支付 · 厂商审核接入
|
||||
|
||||
## Linked
|
||||
|
||||
Spec `ops-content-safety.md` · BD-2026-019 · CONTRACT_DIFF/ECR-019.yaml · TEST_REPORT/ECR-019.md
|
||||
@@ -0,0 +1,7 @@
|
||||
# ENGINEERING_SPEC — ECR-019
|
||||
|
||||
1. migration 000020 filter_rules + perm
|
||||
2. AdminRepo list/get/evaluate
|
||||
3. Admin API + OpenAPI
|
||||
4. admin-h5 /safety
|
||||
5. Integration · Closed
|
||||
@@ -0,0 +1,3 @@
|
||||
# HANDOFF — ECR-019 Architect → Engineer
|
||||
|
||||
Loop continuous · Approved + Coding. Migration 000020. Forbidden: ModerationCase写/UGC/真支付.
|
||||
@@ -0,0 +1,3 @@
|
||||
# HANDOFF — ECR-019 Engineer → Reviewer
|
||||
|
||||
TestContentSafetyFilterRules PASS · /safety · Ready for Closed.
|
||||
@@ -0,0 +1,3 @@
|
||||
# PRODUCT_SPEC — ECR-019
|
||||
|
||||
对齐 ops-content-safety.md · Approved · Loop · L2 · FilterRule 只读
|
||||
@@ -0,0 +1,6 @@
|
||||
# STATE — ECR-019
|
||||
|
||||
| Status | **Closed** |
|
||||
| Phase | closed |
|
||||
| Spec | ops-content-safety.md |
|
||||
| Updated | 2026-08-07 |
|
||||
@@ -0,0 +1,12 @@
|
||||
id: TASK-019-ECR019
|
||||
ecr: ECR-019
|
||||
title: ContentSafety FilterRule implement
|
||||
role: engineer
|
||||
status: closed
|
||||
change_level: L2
|
||||
parent: WAVE0-FROZEN
|
||||
predecessor: ECR-018
|
||||
acceptance:
|
||||
- Spec AC mapped
|
||||
- FilterRule read + evaluate only
|
||||
- No UGC / payment / ModerationCase write
|
||||
@@ -0,0 +1,32 @@
|
||||
# TEST_REPORT — ECR-019 ContentSafety
|
||||
|
||||
Date: 2026-08-07 · Loop continuous · commit: (pending)
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
cd apps/api && go test ./internal/integration/ -run TestContentSafetyFilterRules -count=1
|
||||
npm run build:admin
|
||||
python3 scripts/ess-validate.py --phase review --ecr ECR-019
|
||||
python3 scripts/ess-gate-check.py --ecr ECR-019
|
||||
```
|
||||
|
||||
## Results
|
||||
|
||||
| Check | Result |
|
||||
|-------|--------|
|
||||
| TestContentSafetyFilterRules | PASS |
|
||||
| build:admin | PASS |
|
||||
| ess-validate review | PASS |
|
||||
|
||||
## AC
|
||||
|
||||
| ID | Evidence |
|
||||
|----|----------|
|
||||
| AC-F-01 | list 含 system 种子 |
|
||||
| AC-F-02 | evaluate「不想活了」命中 |
|
||||
| AC-F-03 | 未知 id → 404 |
|
||||
| AC-S-01 | 无 token → 401 |
|
||||
| AC-S-02 | 仅 users.read → 403 |
|
||||
| AC-P-01 | list < 500ms |
|
||||
| AC-O-01 | evaluate 不写工单 |
|
||||
@@ -23,3 +23,4 @@
|
||||
| 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 |
|
||||
| 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 |
|
||||
|
||||
@@ -30,4 +30,4 @@ Human 明文:**直接用 Loop,不用人工确认。**
|
||||
|
||||
| Done | Next |
|
||||
|------|------|
|
||||
| ECR-013A/B/014/015/016/017/018 Closed | **ECR-019** ContentSafety 薄切片(FilterRule 只读优先);禁真支付/UGC |
|
||||
| ECR-013A…019 Closed | **ECR-020** QualityFeedback 薄切片(或 AICoreConfig);禁真支付/UGC |
|
||||
|
||||
Reference in New Issue
Block a user