baseline: Clover 独立仓库首次基线提交
将 Clover 从上层产品包旧仓库中独立出来,建立专属版本控制。 当前状态=纵切片端到端已打通(登录→选品→出文出图→审核→下载包), M1文案质量去套路化已验收。此提交作为后续按核销清单逐条修复的基线。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
33
plans/核销-工程底座.md
Normal file
33
plans/核销-工程底座.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# 核销表 · 工程底座
|
||||
|
||||
> 90分级验收(孙总方法论·硬门禁)。已吸收独立交叉验证修正(⚠️)。auto=机器判定,human=目视。
|
||||
> ⚠️审计结论:S1-S6 全部"待执行"(代码现状未改)。行号经核对准确。
|
||||
|
||||
## 模块目标
|
||||
7项底座硬伤:①并发上限5 ②上传 magic number ③选标杆 ④无key置灰 ⑤lightbox ⑥前端不显token余额(红线) ⑦SSE一次性ticket(红线)。
|
||||
|
||||
## Ralph 修改步骤
|
||||
|
||||
| # | 改什么 | 落点 |
|
||||
|---|--------|------|
|
||||
| S1 | MAX_CONCURRENT_TASKS_PER_USER 默认 2→5 | config.py:45 |
|
||||
| S2 | create_generation_task 在 _check_user_has_key 后加并发校验:count(status in pending/running) >= MAX 则 raise_business;顶部 import get_settings | task_service.py:~44 |
|
||||
| S3 | await file.read() 后校验 magic number:JPEG `\xff\xd8\xff`/PNG `\x89PNG\r\n\x1a\n`/WebP `RIFF`+data[8:12]==`WEBP`,都不匹配 raise_business('文件内容与扩展名不符') | products.py:~177 |
|
||||
| S4 | page.tsx 加 loadKeys 调 GET /api/v1/api-keys 存 hasKey;NewTaskForm 按钮 disabled 加 `hasKey===false`,false 时 alert 区显示"未配置Key,去配置-API Key录入" | tasks/new/page.tsx:36 + NewTaskForm.tsx:112 |
|
||||
| S5 | 新建 BenchmarkSelector.tsx(≤80行) 调 GET /products/{id}/benchmarks 多选 checkbox;NewTaskForm 引入放"今天主题"后,传 form.benchmark_ids+onFormChange | 新建 + NewTaskForm.tsx |
|
||||
| S6 | 新建 ImageLightbox.tsx(≤80行) fixed inset-0 z-50 遮罩+居中img,点背景/Esc 关闭;ImageProgressCard 图片加 onClick 触发 | 新建 + ImageProgressCard.tsx |
|
||||
|
||||
## 验收清单(做完一个勾一个)
|
||||
|
||||
- [ ] **A1**〔auto〕并发默认5:`grep MAX_CONCURRENT_TASKS_PER_USER config.py` 含 '= 5'。
|
||||
- [ ] **A2**〔auto〕并发校验在:`grep task_service.py` 出现 status.in_ + MAX_CONCURRENT 引用。(建议补真跑:第6个任务被拒,底-1)
|
||||
- [ ] **A3**〔auto〕magic number 校验:`grep products.py` 出现 ≥2种 magic bytes 字面量。(建议补真跑:.exe改.jpg 上传被拒)
|
||||
- [ ] **A4**〔auto〕无key置灰:`grep tasks/new/page.tsx` 含 /api/v1/api-keys + hasKey;`grep NewTaskForm.tsx` hasKey 在 disabled 条件中。
|
||||
- [ ] **A5**〔auto〕选标杆:`ls BenchmarkSelector.tsx` 存在 + `grep NewTaskForm.tsx` 含 BenchmarkSelector/benchmark_ids。
|
||||
- [ ] **A6**〔human〕lightbox:`ls ImageLightbox.tsx` 存在 + ImageProgressCard 含 onClick;人工点图确认放大弹层、Esc 关闭。
|
||||
- [ ] **A7**〔auto〕前端无token余额(红线):⚠️审计修正——`grep -rn '余额\|用量\|balance\|token_usage' frontend/src` 排除 ApiKeysTab 的引导语"余额和用量请到中转站后台查看"(合规用法),其余必须为空。
|
||||
- [ ] **A8**〔auto〕SSE 用 ticket(红线):`grep sse.ts` 含 'ticket=' 不含 'token=';`grep stream.py` 含 ticket Query;`grep sse_ticket.py` 含 issue_ticket+consume_ticket。
|
||||
|
||||
## 待北哥定义(不阻断代码)
|
||||
- 并发上限 5 是否按客户实跑量调整(改 config.py 一行即可)。
|
||||
- benchmark_ids 选入后 prompt 如何消费标杆 highlights/screenshot(归入第2环 S10/S11)。
|
||||
Reference in New Issue
Block a user