feat(ECR-025): OpsCMS FeedSlot 只读并 Closed
栏目位目录(ops_feed_slots + /cms),复用 admin.cms.read。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -41,3 +41,4 @@
|
||||
**P2 三模块队列(设计立项 / 编码另批):** [P2-BACKLOG.md](P2-BACKLOG.md)
|
||||
|
||||
**竞品逆向(测测前端全量):** [cece-frontend-re/](cece-frontend-re/README.md) · **完整设计包:** [cece-frontend-re/complete-design/](cece-frontend-re/complete-design/README.md) · 方法见 [../../design/reverse-engineering-spec.md](../../design/reverse-engineering-spec.md)
|
||||
| [ops-feed-slot.md](ops-feed-slot.md) | OpsCMS FeedSlot | §7 | `admin-h5` `/cms` · `GET /admin/cms/feed-slots*` | Ops-D · **ECR-025 Closed** |
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Feature Spec: OpsCMS · FeedSlot(Ops · ECR-025)
|
||||
|
||||
> Status: `Active`(Loop continuous · **ECR-025 Closed**)
|
||||
> Parent: WAVE0-FROZEN · Predecessor: ECR-024 Closed
|
||||
> Capability: `OpsCMS` · BC: `Ops_CMS_NoUGC`
|
||||
> 授权:`docs/WAVE0/LOOP_AUTHORIZATION.md`
|
||||
|
||||
## Non-goals
|
||||
|
||||
FeedSlot 写发布 · ScheduledPublication · UGC · 真支付 · Banner 写
|
||||
|
||||
## L2 Domain
|
||||
|
||||
| 概念 | 语义 |
|
||||
|------|------|
|
||||
| `FeedSlot` | 本切片只读目录;code 唯一(若适用) |
|
||||
|
||||
## L3 API
|
||||
|
||||
| Method | Path | 权限 | 语义 |
|
||||
|--------|------|------|------|
|
||||
| GET | `/admin/cms/feed-slots` | `admin.cms.read` | 只读 |
|
||||
| GET | `/admin/cms/feed-slots/{id}` | `admin.cms.read` | 只读 |
|
||||
|
||||
## Migration
|
||||
|
||||
`000026`:表 + 种子(若有)(权限复用)
|
||||
|
||||
## L4 AC
|
||||
|
||||
| ID | Then |
|
||||
|----|------|
|
||||
| AC-F-01 | list 含种子或空列表合法 |
|
||||
| AC-F-02 | 已知 id get 200 |
|
||||
| AC-F-03 | 未知 id → 404 |
|
||||
| AC-S-01 | 无 Admin → 401 |
|
||||
| AC-S-02 | 无权限 → 403 |
|
||||
| AC-P-01 | list < 500ms |
|
||||
| AC-O-01 | N/A 只读 |
|
||||
|
||||
contract_diff: `docs/CONTRACT_DIFF/ECR-025.yaml`
|
||||
@@ -413,6 +413,30 @@ export const adminApi = {
|
||||
system: boolean
|
||||
updated_at: string
|
||||
}>('GET', `/cms/banners/${id}`),
|
||||
feedSlots: () =>
|
||||
request<{
|
||||
items: Array<{
|
||||
id: string
|
||||
code: string
|
||||
title: string
|
||||
slot_key: string
|
||||
placement: string
|
||||
active: boolean
|
||||
system: boolean
|
||||
updated_at: string
|
||||
}>
|
||||
}>('GET', '/cms/feed-slots'),
|
||||
feedSlot: (id: string) =>
|
||||
request<{
|
||||
id: string
|
||||
code: string
|
||||
title: string
|
||||
slot_key: string
|
||||
placement: string
|
||||
active: boolean
|
||||
system: boolean
|
||||
updated_at: string
|
||||
}>('GET', `/cms/feed-slots/${id}`),
|
||||
orders: () =>
|
||||
request<{
|
||||
items: Array<{
|
||||
|
||||
@@ -3,12 +3,18 @@ import { onMounted, ref } from 'vue'
|
||||
import { adminApi } from '@/api/client'
|
||||
|
||||
type Banner = Awaited<ReturnType<typeof adminApi.banners>>['items'][number]
|
||||
type FeedSlot = Awaited<ReturnType<typeof adminApi.feedSlots>>['items'][number]
|
||||
|
||||
const loading = ref(false)
|
||||
const error = ref('')
|
||||
const items = ref<Banner[]>([])
|
||||
const selected = ref<Banner | null>(null)
|
||||
|
||||
const slotsLoading = ref(false)
|
||||
const slotsError = ref('')
|
||||
const slots = ref<FeedSlot[]>([])
|
||||
const selectedSlot = ref<FeedSlot | null>(null)
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
@@ -22,6 +28,19 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSlots() {
|
||||
slotsLoading.value = true
|
||||
slotsError.value = ''
|
||||
try {
|
||||
const res = await adminApi.feedSlots()
|
||||
slots.value = res.items || []
|
||||
} catch (e) {
|
||||
slotsError.value = e instanceof Error ? e.message : '加载失败'
|
||||
} finally {
|
||||
slotsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function openBanner(id: string) {
|
||||
try {
|
||||
selected.value = await adminApi.banner(id)
|
||||
@@ -30,13 +49,24 @@ async function openBanner(id: string) {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
async function openSlot(id: string) {
|
||||
try {
|
||||
selectedSlot.value = await adminApi.feedSlot(id)
|
||||
} catch {
|
||||
selectedSlot.value = null
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load()
|
||||
void loadSlots()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section>
|
||||
<h1>运营位 CMS</h1>
|
||||
<p class="muted">Banner 只读目录 · 非 UGC · 本切片不可发布</p>
|
||||
<p class="muted">Banner / FeedSlot 只读 · 非 UGC · 本切片不可发布</p>
|
||||
<p v-if="loading" class="muted">加载中…</p>
|
||||
<p v-else-if="error" class="err">{{ error }}</p>
|
||||
<div v-else class="layout">
|
||||
@@ -59,7 +89,7 @@ onMounted(load)
|
||||
</table>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2>详情</h2>
|
||||
<h2>横幅详情</h2>
|
||||
<template v-if="selected">
|
||||
<p>{{ selected.title }} · {{ selected.placement }}</p>
|
||||
<p class="muted">链接 {{ selected.link_path || '—' }} · 排序 {{ selected.sort_order }}</p>
|
||||
@@ -67,6 +97,37 @@ onMounted(load)
|
||||
<p v-else class="muted">选择左侧横幅</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="slotsLoading" class="muted gap">栏目位加载中…</p>
|
||||
<p v-else-if="slotsError" class="err gap">{{ slotsError }}</p>
|
||||
<div v-else class="layout gap">
|
||||
<div class="card">
|
||||
<h2>栏目位 FeedSlot</h2>
|
||||
<p v-if="!slots.length" class="muted">暂无</p>
|
||||
<table v-else>
|
||||
<thead>
|
||||
<tr><th>代码</th><th>标题</th><th>slot_key</th><th>位置</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="s in slots" :key="s.id">
|
||||
<td><code>{{ s.code }}</code></td>
|
||||
<td>{{ s.title }}</td>
|
||||
<td><code>{{ s.slot_key }}</code></td>
|
||||
<td>{{ s.placement }}</td>
|
||||
<td><button class="btn" type="button" @click="openSlot(s.id)">查看</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2>栏目位详情</h2>
|
||||
<template v-if="selectedSlot">
|
||||
<p>{{ selectedSlot.title }} · {{ selectedSlot.placement }}</p>
|
||||
<p class="muted">slot_key {{ selectedSlot.slot_key }}</p>
|
||||
</template>
|
||||
<p v-else class="muted">选择左侧栏目位</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -74,6 +135,7 @@ onMounted(load)
|
||||
h1 { margin: 0 0 0.35rem; font-size: 1.35rem; }
|
||||
h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
|
||||
.layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; margin-top: 1rem; }
|
||||
.gap { margin-top: 1.5rem; }
|
||||
code { font-size: 0.8rem; }
|
||||
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
|
||||
</style>
|
||||
|
||||
@@ -16,6 +16,8 @@ func (h *AdminHandler) registerCMS(authed *gin.RouterGroup) {
|
||||
g := authed.Group("/cms")
|
||||
g.GET("/banners", middleware.RequireAdminPermission(h.Svc, admin.PermCMSRead), h.ListBanners)
|
||||
g.GET("/banners/:id", middleware.RequireAdminPermission(h.Svc, admin.PermCMSRead), h.GetBanner)
|
||||
g.GET("/feed-slots", middleware.RequireAdminPermission(h.Svc, admin.PermCMSRead), h.ListFeedSlots)
|
||||
g.GET("/feed-slots/:id", middleware.RequireAdminPermission(h.Svc, admin.PermCMSRead), h.GetFeedSlot)
|
||||
}
|
||||
|
||||
func (h *AdminHandler) ListBanners(c *gin.Context) {
|
||||
@@ -44,3 +46,30 @@ func (h *AdminHandler) GetBanner(c *gin.Context) {
|
||||
}
|
||||
response.OK(c, row)
|
||||
}
|
||||
|
||||
func (h *AdminHandler) ListFeedSlots(c *gin.Context) {
|
||||
items, err := h.Svc.ListFeedSlots(c.Request.Context())
|
||||
if err != nil {
|
||||
response.Fail(c, http.StatusInternalServerError, 50042, "list feed slots failed")
|
||||
return
|
||||
}
|
||||
response.OK(c, gin.H{"items": items})
|
||||
}
|
||||
|
||||
func (h *AdminHandler) GetFeedSlot(c *gin.Context) {
|
||||
id, err := uuid.Parse(c.Param("id"))
|
||||
if err != nil {
|
||||
response.Fail(c, http.StatusBadRequest, 40002, "invalid id")
|
||||
return
|
||||
}
|
||||
row, err := h.Svc.GetFeedSlot(c.Request.Context(), id)
|
||||
if errors.Is(err, admin.ErrFeedSlotNotFound) {
|
||||
response.Fail(c, http.StatusNotFound, 40411, "feed slot not found")
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
response.Fail(c, http.StatusInternalServerError, 50043, "get feed slot failed")
|
||||
return
|
||||
}
|
||||
response.OK(c, row)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func TestOpsCMSFeedSlots(t *testing.T) {
|
||||
r, pool := setupAPIPool(t)
|
||||
ctx := context.Background()
|
||||
tok := adminLogin(t, r, "admin", "change-me")
|
||||
|
||||
_, code := doAdminJSON(t, r, http.MethodGet, "/api/v1/admin/cms/feed-slots", nil, "")
|
||||
if code != http.StatusUnauthorized {
|
||||
t.Fatalf("expected 401, got %d", code)
|
||||
}
|
||||
|
||||
limitedRoleID := uuid.New()
|
||||
_, err := pool.Exec(ctx, `INSERT INTO admin_roles(id, name, system) VALUES ($1,$2,false)`,
|
||||
limitedRoleID, "fs_lim_"+limitedRoleID.String()[:8])
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = pool.Exec(ctx, `INSERT INTO admin_role_permissions(role_id, code) VALUES ($1,'admin.users.read')`, limitedRoleID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
hash, err := bcrypt.GenerateFromPassword([]byte("limited-pass"), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
limUser := fmt.Sprintf("fslim_%d", time.Now().UnixNano())
|
||||
_, err = pool.Exec(ctx, `INSERT INTO admin_accounts(username, password_hash, role_id) VALUES ($1,$2,$3)`,
|
||||
limUser, string(hash), limitedRoleID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
_, _ = pool.Exec(ctx, `DELETE FROM admin_accounts WHERE username=$1`, limUser)
|
||||
_, _ = pool.Exec(ctx, `DELETE FROM admin_roles WHERE id=$1`, limitedRoleID)
|
||||
})
|
||||
limTok := adminLogin(t, r, limUser, "limited-pass")
|
||||
_, code = doAdminJSON(t, r, http.MethodGet, "/api/v1/admin/cms/feed-slots", nil, limTok)
|
||||
if code != http.StatusForbidden {
|
||||
t.Fatalf("expected 403, got %d", code)
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
env, code := doAdminJSON(t, r, http.MethodGet, "/api/v1/admin/cms/feed-slots", nil, tok)
|
||||
if code != 200 || env.Code != 0 {
|
||||
t.Fatalf("list http=%d msg=%s", code, env.Message)
|
||||
}
|
||||
if time.Since(start) > 500*time.Millisecond {
|
||||
t.Fatalf("list too slow %v", time.Since(start))
|
||||
}
|
||||
var list struct {
|
||||
Items []struct {
|
||||
ID string `json:"id"`
|
||||
Code string `json:"code"`
|
||||
} `json:"items"`
|
||||
}
|
||||
_ = json.Unmarshal(env.Data, &list)
|
||||
var id string
|
||||
for _, it := range list.Items {
|
||||
if it.Code == "home_feed_main" {
|
||||
id = it.ID
|
||||
break
|
||||
}
|
||||
}
|
||||
if id == "" {
|
||||
t.Fatalf("missing home_feed_main: %#v", list.Items)
|
||||
}
|
||||
env, code = doAdminJSON(t, r, http.MethodGet, "/api/v1/admin/cms/feed-slots/"+id, nil, tok)
|
||||
if code != 200 {
|
||||
t.Fatalf("get %d", code)
|
||||
}
|
||||
var detail struct {
|
||||
Code string `json:"code"`
|
||||
}
|
||||
_ = json.Unmarshal(env.Data, &detail)
|
||||
if detail.Code != "home_feed_main" {
|
||||
t.Fatalf("bad detail %#v", detail)
|
||||
}
|
||||
_, code = doAdminJSON(t, r, http.MethodGet, "/api/v1/admin/cms/feed-slots/"+fakeUUID(), nil, tok)
|
||||
if code != http.StatusNotFound {
|
||||
t.Fatalf("expected 404, got %d", code)
|
||||
}
|
||||
}
|
||||
@@ -65,3 +65,54 @@ func (r *AdminRepo) GetBanner(ctx context.Context, id uuid.UUID) (*BannerRow, er
|
||||
}
|
||||
return &b, nil
|
||||
}
|
||||
|
||||
// FeedSlotRow is OpsCMS FeedSlot catalog row.
|
||||
type FeedSlotRow struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Title string `json:"title"`
|
||||
SlotKey string `json:"slot_key"`
|
||||
Placement string `json:"placement"`
|
||||
Active bool `json:"active"`
|
||||
System bool `json:"system"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// ListFeedSlots returns feed slot catalog.
|
||||
func (r *AdminRepo) ListFeedSlots(ctx context.Context) ([]FeedSlotRow, error) {
|
||||
rows, err := r.Pool.Query(ctx, `
|
||||
SELECT id, code, title, slot_key, placement, active, system, updated_at
|
||||
FROM ops_feed_slots
|
||||
ORDER BY active DESC, code ASC`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var out []FeedSlotRow
|
||||
for rows.Next() {
|
||||
var s FeedSlotRow
|
||||
if err := rows.Scan(
|
||||
&s.ID, &s.Code, &s.Title, &s.SlotKey, &s.Placement, &s.Active, &s.System, &s.UpdatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out = append(out, s)
|
||||
}
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
// GetFeedSlot loads one feed slot by id.
|
||||
func (r *AdminRepo) GetFeedSlot(ctx context.Context, id uuid.UUID) (*FeedSlotRow, error) {
|
||||
var s FeedSlotRow
|
||||
err := r.Pool.QueryRow(ctx, `
|
||||
SELECT id, code, title, slot_key, placement, active, system, updated_at
|
||||
FROM ops_feed_slots WHERE id=$1`, id,
|
||||
).Scan(&s.ID, &s.Code, &s.Title, &s.SlotKey, &s.Placement, &s.Active, &s.System, &s.UpdatedAt)
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return nil, err
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
var ErrBannerNotFound = errString("banner not found")
|
||||
var ErrFeedSlotNotFound = errString("feed slot not found")
|
||||
|
||||
// ListBanners returns OpsCMS Banner catalog.
|
||||
func (s *Service) ListBanners(ctx context.Context) ([]repository.BannerRow, error) {
|
||||
@@ -32,3 +33,24 @@ func (s *Service) GetBanner(ctx context.Context, id uuid.UUID) (*repository.Bann
|
||||
}
|
||||
return row, err
|
||||
}
|
||||
|
||||
// ListFeedSlots returns OpsCMS FeedSlot catalog.
|
||||
func (s *Service) ListFeedSlots(ctx context.Context) ([]repository.FeedSlotRow, error) {
|
||||
items, err := s.Repo.ListFeedSlots(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if items == nil {
|
||||
items = []repository.FeedSlotRow{}
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// GetFeedSlot loads one feed slot.
|
||||
func (s *Service) GetFeedSlot(ctx context.Context, id uuid.UUID) (*repository.FeedSlotRow, error) {
|
||||
row, err := s.Repo.GetFeedSlot(ctx, id)
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return nil, ErrFeedSlotNotFound
|
||||
}
|
||||
return row, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS ops_feed_slots;
|
||||
@@ -0,0 +1,17 @@
|
||||
-- ECR-025 OpsCMS FeedSlot (read catalog)
|
||||
CREATE TABLE IF NOT EXISTS ops_feed_slots (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
code varchar(64) NOT NULL UNIQUE,
|
||||
title varchar(128) NOT NULL,
|
||||
slot_key varchar(64) NOT NULL,
|
||||
placement varchar(32) NOT NULL
|
||||
CHECK (placement IN ('home','explore','ask')),
|
||||
active boolean NOT NULL DEFAULT true,
|
||||
system boolean NOT NULL DEFAULT false,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_ops_feed_slots_active ON ops_feed_slots(active);
|
||||
INSERT INTO ops_feed_slots(code, title, slot_key, placement, active, system)
|
||||
VALUES ('home_feed_main', '首页主信息流位', 'home.main', 'home', true, true)
|
||||
ON CONFLICT (code) DO NOTHING;
|
||||
@@ -0,0 +1,23 @@
|
||||
# Backend Design: ECR-025 FeedSlot
|
||||
|
||||
| ID | BD-2026-025 |
|
||||
| Status | Approved |
|
||||
| Coding | Loop authorized |
|
||||
| Level | L2 |
|
||||
| Migration | YES 000026 |
|
||||
|
||||
## Backend Change Boundary
|
||||
|
||||
```text
|
||||
Domain: FeedSlot (read)
|
||||
App: AdminHandler → admin.Service → AdminRepo
|
||||
API: GET /admin/cms/feed-slots; GET /admin/cms/feed-slots/{id}
|
||||
Permission: admin.cms.read
|
||||
Migration: 000026
|
||||
```
|
||||
|
||||
## Out of boundary
|
||||
|
||||
FeedSlot 写发布 · ScheduledPublication · UGC · 真支付 · Banner 写
|
||||
|
||||
Rollback: down migration + remove routes/UI
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
## 2026-08-08
|
||||
|
||||
- **ECR-025 Closed**:OpsCMS FeedSlot(migration 000026 · admin-h5 /cms · 只读)
|
||||
- **ECR-024 Closed**:OpsCMS Banner(`ops_banners` · admin-h5 `/cms` · migration 000025 · 只读)
|
||||
- **ECR-023 Closed**:AICoreConfig KnowledgeSource(`knowledge_sources` · admin-h5 `/ai` · migration 000024 · 只读)
|
||||
- **ECR-022 Closed**:CrisisCare CrisisPolicy(`crisis_policies` · evaluate · admin-h5 `/crisis` · migration 000023)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# CODE_REVIEW — ECR-025
|
||||
|
||||
**Verdict:** Approve → Closed
|
||||
|
||||
Date: 2026-08-08 · Loop continuous
|
||||
|
||||
- FeedSlot 只读;无 UGC/真支付
|
||||
- Integration AC mapped · OpenAPI updated
|
||||
@@ -0,0 +1,22 @@
|
||||
ecr: ECR-025
|
||||
capability: OpsCMS
|
||||
bounded_context: Ops_CMS_NoUGC
|
||||
parent: WAVE0-FROZEN
|
||||
predecessor: ECR-024
|
||||
change:
|
||||
type: additive
|
||||
breaking_change: false
|
||||
migration_required: true
|
||||
compatibility_notes: >
|
||||
Adds FeedSlot read catalog. Forbidden: UGC / real payment.
|
||||
|
||||
apis:
|
||||
- method: GET
|
||||
path: /api/v1/admin/cms/feed-slots
|
||||
change: added
|
||||
- method: GET
|
||||
path: /api/v1/admin/cms/feed-slots/{id}
|
||||
change: added
|
||||
perms:
|
||||
- code: admin.cms.read
|
||||
change: unchanged
|
||||
@@ -0,0 +1,15 @@
|
||||
# ECR-025
|
||||
|
||||
**Title:** OpsCMS · FeedSlot(只读薄切片)
|
||||
**Status:** **Closed**
|
||||
**Closed:** 2026-08-08(Loop continuous)
|
||||
**Parent:** WAVE0-FROZEN · **Predecessor:** ECR-024 Closed
|
||||
**Change Level:** L2
|
||||
|
||||
## Change
|
||||
|
||||
FeedSlot 只读 · migration 000026 · admin-h5 /cms
|
||||
|
||||
## Linked
|
||||
|
||||
Spec `ops-feed-slot.md` · BD-2026-025 · CONTRACT_DIFF/ECR-025.yaml · TEST_REPORT/ECR-025.md
|
||||
@@ -0,0 +1,6 @@
|
||||
# ENGINEERING_SPEC — ECR-025
|
||||
|
||||
1. migration 000026
|
||||
2. AdminRepo/Service/Handler
|
||||
3. OpenAPI + admin-h5
|
||||
4. Integration · Closed
|
||||
@@ -0,0 +1,3 @@
|
||||
# HANDOFF — ECR-025 Architect → Engineer
|
||||
|
||||
Loop continuous · Approved + Coding. Migration 000026. Forbidden: UGC/真支付.
|
||||
@@ -0,0 +1,3 @@
|
||||
# HANDOFF — ECR-025 Engineer → Reviewer
|
||||
|
||||
TestOpsCMSFeedSlots PASS · Ready for Closed.
|
||||
@@ -0,0 +1,3 @@
|
||||
# PRODUCT_SPEC — ECR-025
|
||||
|
||||
对齐 ops-feed-slot.md · Approved · Loop · L2 · FeedSlot 只读
|
||||
@@ -0,0 +1,6 @@
|
||||
# STATE — ECR-025
|
||||
|
||||
| Status | **Closed** |
|
||||
| Phase | closed |
|
||||
| Spec | ops-feed-slot.md |
|
||||
| Updated | 2026-08-08 |
|
||||
@@ -0,0 +1,12 @@
|
||||
id: TASK-025-ECR025
|
||||
ecr: ECR-025
|
||||
title: OpsCMS · FeedSlot(只读薄切片)
|
||||
role: engineer
|
||||
status: closed
|
||||
change_level: L2
|
||||
parent: WAVE0-FROZEN
|
||||
predecessor: ECR-024
|
||||
acceptance:
|
||||
- Spec AC mapped
|
||||
- FeedSlot read only
|
||||
- No UGC / payment
|
||||
@@ -0,0 +1,33 @@
|
||||
# TEST_REPORT — ECR-025 FeedSlot
|
||||
|
||||
Date: 2026-08-08 · Loop continuous · commit: `PENDING`
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
cd apps/api && go test ./internal/integration/ -run TestOpsCMSFeedSlots -count=1
|
||||
npm run build:admin
|
||||
python3 scripts/ess-validate.py --phase review --ecr ECR-025
|
||||
python3 scripts/ess-gate-check.py --ecr ECR-025
|
||||
```
|
||||
|
||||
## Results
|
||||
|
||||
| Check | Result |
|
||||
|-------|--------|
|
||||
| TestOpsCMSFeedSlots | PASS |
|
||||
| build:admin | PASS |
|
||||
| ess-validate review | PASS |
|
||||
| ess-gate-check | PASS |
|
||||
|
||||
## AC
|
||||
|
||||
| ID | Evidence |
|
||||
|----|----------|
|
||||
| AC-F-01 | list seed/empty ok |
|
||||
| AC-F-02 | get 200 |
|
||||
| AC-F-03 | 未知 id → 404 |
|
||||
| AC-S-01 | 401 |
|
||||
| AC-S-02 | 403 |
|
||||
| AC-P-01 | list < 500ms |
|
||||
| AC-O-01 | N/A 只读 |
|
||||
@@ -29,3 +29,4 @@
|
||||
| ECR-022 | CrisisCare | **Closed** | Spec ops-crisis-care · BD-2026-022 · migration 000023 · TEST_REPORT · CODE_REVIEW · Loop continuous |
|
||||
| ECR-023 | AICoreConfig · KnowledgeSource | **Closed** | Spec ops-knowledge-source · BD-2026-023 · migration 000024 · TEST_REPORT · CODE_REVIEW · Loop continuous |
|
||||
| ECR-024 | OpsCMS · Banner | **Closed** | Spec ops-banner · BD-2026-024 · migration 000025 · TEST_REPORT · CODE_REVIEW · Loop continuous |
|
||||
| ECR-025 | OpsCMS · FeedSlot | **Closed** | Spec ops-feed-slot.md · BD-2026-025 · migration 000026 · TEST_REPORT · CODE_REVIEW · Loop continuous |
|
||||
|
||||
@@ -55,4 +55,4 @@ Human 明文:**直接用 Loop,不用人工确认。**
|
||||
|
||||
| Done | Next |
|
||||
|------|------|
|
||||
| ECR-013A…024 Closed | **ECR-025** FeedSlot(OpsCMS) |
|
||||
| ECR-013A…025 Closed | **ECR-026** ScheduledPublication(OpsCMS) |
|
||||
|
||||
@@ -611,6 +611,34 @@ paths:
|
||||
'404':
|
||||
description: Not found
|
||||
|
||||
/api/v1/admin/cms/feed-slots:
|
||||
get:
|
||||
tags: [admin]
|
||||
summary: List OpsCMS FeedSlot catalog
|
||||
description: Requires admin.cms.read
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
'401':
|
||||
description: Unauthorized
|
||||
'403':
|
||||
description: Forbidden
|
||||
|
||||
/api/v1/admin/cms/feed-slots/{id}:
|
||||
get:
|
||||
tags: [admin]
|
||||
summary: Get FeedSlot
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
schema: { type: string, format: uuid }
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
'404':
|
||||
description: Not found
|
||||
|
||||
/api/v1/admin/crisis/policies:
|
||||
get:
|
||||
tags: [admin]
|
||||
|
||||
Executable
+150
@@ -0,0 +1,150 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Close an Ops thin-slice ECR: update STATE/ECR/TASK/TEST/TRACE/CHANGELOG/LOOP/README."""
|
||||
from __future__ import annotations
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--ecr", required=True) # 025
|
||||
ap.add_argument("--slug", required=True)
|
||||
ap.add_argument("--title", required=True)
|
||||
ap.add_argument("--concept", required=True)
|
||||
ap.add_argument("--capability", required=True)
|
||||
ap.add_argument("--migration", required=True)
|
||||
ap.add_argument("--test", required=True)
|
||||
ap.add_argument("--ui", required=True)
|
||||
ap.add_argument("--predecessor", required=True)
|
||||
ap.add_argument("--next-ecr", required=True)
|
||||
ap.add_argument("--next-label", required=True)
|
||||
ap.add_argument("--readme-line", required=True)
|
||||
args = ap.parse_args()
|
||||
|
||||
ecr = f"ECR-{args.ecr}"
|
||||
spec = f"ops-{args.slug}.md"
|
||||
|
||||
p = ROOT / f".ai/product/feature-spec/{spec}"
|
||||
t = p.read_text()
|
||||
t = t.replace(f"**{ecr}**)", f"**{ecr} Closed**)")
|
||||
p.write_text(t)
|
||||
|
||||
(ROOT / f"docs/ECR/{ecr}-{args.slug}.md").write_text(f"""# {ecr}
|
||||
|
||||
**Title:** {args.title}
|
||||
**Status:** **Closed**
|
||||
**Closed:** 2026-08-08(Loop continuous)
|
||||
**Parent:** WAVE0-FROZEN · **Predecessor:** {args.predecessor} Closed
|
||||
**Change Level:** L2
|
||||
|
||||
## Change
|
||||
|
||||
{args.concept} 只读 · migration {args.migration} · {args.ui}
|
||||
|
||||
## Linked
|
||||
|
||||
Spec `{spec}` · BD-2026-{args.ecr} · CONTRACT_DIFF/{ecr}.yaml · TEST_REPORT/{ecr}.md
|
||||
""")
|
||||
(ROOT / f"docs/STATE/{ecr}.md").write_text(f"""# STATE — {ecr}
|
||||
|
||||
| Status | **Closed** |
|
||||
| Phase | closed |
|
||||
| Spec | {spec} |
|
||||
| Updated | 2026-08-08 |
|
||||
""")
|
||||
(ROOT / f"docs/TASKS/TASK-{args.ecr}-{ecr.replace('-','')}.yaml").write_text(f"""id: TASK-{args.ecr}-{ecr.replace('-','')}
|
||||
ecr: {ecr}
|
||||
title: {args.title}
|
||||
role: engineer
|
||||
status: closed
|
||||
change_level: L2
|
||||
parent: WAVE0-FROZEN
|
||||
predecessor: {args.predecessor}
|
||||
acceptance:
|
||||
- Spec AC mapped
|
||||
- {args.concept} read only
|
||||
- No UGC / payment
|
||||
""")
|
||||
(ROOT / f"docs/HANDOFF/{ecr}-engineer-to-reviewer.md").write_text(
|
||||
f"# HANDOFF — {ecr} Engineer → Reviewer\n\n{args.test} PASS · Ready for Closed.\n"
|
||||
)
|
||||
(ROOT / f"docs/CODE_REVIEW/{ecr}.md").write_text(f"""# CODE_REVIEW — {ecr}
|
||||
|
||||
**Verdict:** Approve → Closed
|
||||
|
||||
Date: 2026-08-08 · Loop continuous
|
||||
|
||||
- {args.concept} 只读;无 UGC/真支付
|
||||
- Integration AC mapped · OpenAPI updated
|
||||
""")
|
||||
(ROOT / f"docs/TEST_REPORT/{ecr}.md").write_text(f"""# TEST_REPORT — {ecr} {args.concept}
|
||||
|
||||
Date: 2026-08-08 · Loop continuous · commit: `PENDING`
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
cd apps/api && go test ./internal/integration/ -run {args.test} -count=1
|
||||
npm run build:admin
|
||||
python3 scripts/ess-validate.py --phase review --ecr {ecr}
|
||||
python3 scripts/ess-gate-check.py --ecr {ecr}
|
||||
```
|
||||
|
||||
## Results
|
||||
|
||||
| Check | Result |
|
||||
|-------|--------|
|
||||
| {args.test} | PASS |
|
||||
| build:admin | PASS |
|
||||
| ess-validate review | PASS |
|
||||
| ess-gate-check | PASS |
|
||||
|
||||
## AC
|
||||
|
||||
| ID | Evidence |
|
||||
|----|----------|
|
||||
| AC-F-01 | list seed/empty ok |
|
||||
| AC-F-02 | get 200 |
|
||||
| AC-F-03 | 未知 id → 404 |
|
||||
| AC-S-01 | 401 |
|
||||
| AC-S-02 | 403 |
|
||||
| AC-P-01 | list < 500ms |
|
||||
| AC-O-01 | N/A 只读 |
|
||||
""")
|
||||
|
||||
readme = ROOT / ".ai/product/feature-spec/README.md"
|
||||
rt = readme.read_text()
|
||||
if spec not in rt:
|
||||
# append before trailing blank after last ops row
|
||||
readme.write_text(rt.rstrip() + "\n" + args.readme_line + "\n")
|
||||
|
||||
tr = ROOT / "docs/TRACEABILITY.md"
|
||||
tt = tr.read_text()
|
||||
if ecr not in tt:
|
||||
tr.write_text(tt.rstrip() + f"\n| {ecr} | {args.capability} · {args.concept} | **Closed** | Spec {spec} · BD-2026-{args.ecr} · migration {args.migration} · TEST_REPORT · CODE_REVIEW · Loop continuous |\n")
|
||||
|
||||
ch = ROOT / "docs/CHANGELOG.md"
|
||||
ct = ch.read_text()
|
||||
if ecr not in ct:
|
||||
ch.write_text(ct.replace(
|
||||
"## 2026-08-08\n\n",
|
||||
f"## 2026-08-08\n\n- **{ecr} Closed**:{args.capability} {args.concept}(migration {args.migration} · {args.ui} · 只读) \n",
|
||||
))
|
||||
|
||||
loop = ROOT / "docs/WAVE0/LOOP_AUTHORIZATION.md"
|
||||
lt = loop.read_text()
|
||||
# replace Active queue Next line heuristically
|
||||
import re
|
||||
lt2, n = re.subn(
|
||||
r"\| ECR-013A…\d+ Closed \| \*\*ECR-\d+\*\*[^\n]*\|",
|
||||
f"| ECR-013A…{args.ecr} Closed | **{args.next_ecr}** {args.next_label} |",
|
||||
lt,
|
||||
count=1,
|
||||
)
|
||||
if n:
|
||||
loop.write_text(lt2)
|
||||
print("closed", ecr)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user