Files
beige/plans/核销-工程底座.md
yangqianqian 6a2632da70 baseline: Clover 独立仓库首次基线提交
将 Clover 从上层产品包旧仓库中独立出来,建立专属版本控制。
当前状态=纵切片端到端已打通(登录→选品→出文出图→审核→下载包),
M1文案质量去套路化已验收。此提交作为后续按核销清单逐条修复的基线。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 11:30:22 +08:00

34 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 核销表 · 工程底座
> 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 numberJPEG `\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 存 hasKeyNewTaskForm 按钮 disabled 加 `hasKey===false`false 时 alert 区显示"未配置Key,去配置-API Key录入" | tasks/new/page.tsx:36 + NewTaskForm.tsx:112 |
| S5 | 新建 BenchmarkSelector.tsx(≤80行) 调 GET /products/{id}/benchmarks 多选 checkboxNewTaskForm 引入放"今天主题"后,传 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**automagic 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**humanlightbox`ls ImageLightbox.tsx` 存在 + ImageProgressCard 含 onClick人工点图确认放大弹层、Esc 关闭。
- [ ] **A7**auto前端无token余额(红线):⚠️审计修正——`grep -rn '余额\|用量\|balance\|token_usage' frontend/src` 排除 ApiKeysTab 的引导语"余额和用量请到中转站后台查看"(合规用法),其余必须为空。
- [ ] **A8**autoSSE 用 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)。