docs: 登记 WFW-9 M2 整章重写预检澄清——契约 C-Clarify 扩 + PROGRESS 台账

This commit is contained in:
Yaojia Wang
2026-07-08 11:47:26 +02:00
parent 6fd637596b
commit 6b7391d1b7
2 changed files with 3 additions and 0 deletions

View File

@@ -377,3 +377,5 @@
- [2026-07-08] @backend 改 C3CR-H9 输入大小上界 + 请求体守卫):给用户请求字符串字段补 `max_length``Field(...,max_length=)` / `StringConstraints(max_length=)`,保留既有 `min_length`,命名常量无魔数)——`providers.py`{provider≤64,model≤128,api_key≤512}、`generation.py`{brief≤10_000}、`projects.py`{title≤200,final_text/draft/text≤200_000}、`style.py`{segment≤20_000,samples 列表≤20 且每条≤20_000}、`foreshadow.py`{code≤100,title≤500}、`rules.py`{content≤10_000}、`templates.py`{`NonBlankStr``NonBlankTitle`(≤200)+`NonBlankBody`(≤20_000)}`ProjectPlanGenerateRequest`/`RewriteStreamRequest`/`RefineClarifyRequest` 早前已有上界,未动。**新增错误码** `ErrorCode.PAYLOAD_TOO_LARGE`(413)`ww_shared.errors``ErrorBody.code` 为裸 str → **OpenAPI schema 不变**+ 应用级 `body_size_limit_middleware``apps/api/ww_api/middleware.py``MAX_BODY_BYTES=2 MiB`,按 `Content-Length` 拦超大 body 直接自建 413 信封——用户中间件跑在 AppError 处理器外chunked 无 Content-Length 为原型可接受限制)+ `main.py``request_id_middleware` 后注册。**无 DDL/无迁移**。超界 → 422字段 ValidationError/ 413整体 body。→ 影响 @frontend:请求字段现有 `maxLength`,须 **`pnpm gen:api`** 重生成 TS 客户端(**本 cluster 不代跑**)。
- [2026-07-08] @backend/@llm/@frontend 立 C-ClarifyWFW-9 M1 refine 侧 AI 反问澄清路线A 两阶段):新增 **`POST /projects/{project_id}/chapters/{chapter_no}/refine/clarify`****非流式** JSON 预检)← `RefineClarifyRequest{segment:str(1..20000), instruction:str(默认"",0..2000)}`**`ClarifyDecision`**{need_clarification:bool, questions:[ClarifyQuestion{question, options:[ClarifyOption{label,value}](0..4), allow_free_text:bool}](0或1,v1硬上限1问), verification:str|null}。tier=**analyst**,结构化输出(instructor)**只读不写库**(末尾 commit 仅记 usage_ledger不变量 #3);判别/校验失败**确定性回退 need_clarification=false**(放行)。`ClarifyDecision` 定义在 `ww_agents`(供 producer+端点共用),注册 `clarify_refine_spec`(SPECS #24)+SCHEMA_CATALOG+金标准。**既有 `POST .../refine`(RefineRequest/RefineResponse)完全未改**。→ 影响 @frontend(已 gen:api`useClarify` 映射 snake→VM + `ChoiceChips` 选项芯片 + `RefinePanel` 门控预检:意见<10字或点按钮预检needClarification 则渲染选项答案 foldClarifications 折进 instruction走既有 refine)。** DDL/无迁移**。门禁绿后端 ruff/mypy227/pytest900/alembic前端 tsc/lint/vitest654/build/cov95.36%。M2(rewrite 侧两阶段)/M3(UX+E2E) 待办
- [2026-07-08] @llm/@backend C-ClarifyWFW-9 M2 **rewrite 侧** AI 反问澄清镜像 M1新增 **`POST /projects/{project_id}/chapters/{chapter_no}/rewrite/clarify`****非流式** JSON 预检)← `RewriteClarifyRequest{feedback:str(1..4000), prior_draft:str|null(0..200000)}` **`ClarifyDecision`**复用 M1 同一 schema{need_clarification, questions[0或1,硬上限1问], verification?})。tier=**analyst**,结构化输出,**只读不写业务表**(末尾 commit 仅记 usage_ledger不变量 #3)判别/校验失败**确定性回退 need_clarification=false**(放行)。端点只把 `prior_draft` **开头 3000 字摘录**喂预检(不整章入 LLM日志只记 `feedback_len`(脱敏)。注册 `clarify_rewrite_spec`(analyst,reads=()/writes=(),SPECS **#25**)+SCHEMA_CATALOG(复用 ClarifyDecision)+教条 `prompts/clarify_rewrite.md`(segment整章)+金标准(仅新增 1 条哈希无漂移)。**既有 `POST .../rewrite`(RewriteStreamRequest, SSE)完全未改**。→ 影响 @frontend** `pnpm gen:api`** 纳入新端点再仿 M1 `RefinePanel` `ChapterRewritePanel` 接门控预检意见含糊/极短预检needClarification 则选项芯片折答案进 feedback走既有 rewrite SSE)。** DDL/无迁移**。门禁绿后端 ruff/format 干净·mypy **229**·pytest **948**·alembic 无漂移M2 前端 UI 接线 + M3(UX/E2E) 待办