Skip to content

docs(spec): Translate 自动入生词本设计稿(Phase 1)#52

Merged
bob798 merged 3 commits into
mainfrom
feat/translate-auto-vocab
May 21, 2026
Merged

docs(spec): Translate 自动入生词本设计稿(Phase 1)#52
bob798 merged 3 commits into
mainfrom
feat/translate-auto-vocab

Conversation

@bob798
Copy link
Copy Markdown
Owner

@bob798 bob798 commented May 20, 2026

Summary

仅设计稿,不含实现。把 V0.8 「解读发起即自动写入 vocabulary」的同构模式平移到 Translate 页:点「翻译」立即占位入库,译文回填,匿名降级。

Spec: docs/superpowers/specs/2026-05-20-translate-auto-vocab-design.md

提交链:

  • 69dd3dc 初版 spec
  • f70e7a0 应用 codex review 反馈(3 处)
  • eb9e931 补 §8 Phase 2「生词本去重」留锚

Codex review 结果

严重度 反馈 处理
P2 direction 校验需在占位写入之前(否则非法 direction 留空白行) spec §3.2 step 2 提前
P2 update_translated_text 失败要降级,不能拖垮已成功的翻译 spec §3.2 step 6 加 try/except
P3 复用已有 get_current_user_id_optional,别新增重复依赖 spec §3.3 改"复用"

测试用例补 test_backfill_failure_degradestest_invalid_direction_no_placeholder

实施清单(spec §7,本 PR 范围之外)

  • 后端 vocab_service.update_translated_text
  • 后端 routers/translate.do_translate 改造(可选 auth + direction 前置校验 + 回填降级 + 扩响应字段)
  • 后端测试 tests/test_translate_auto_vocab.py(9 用例)
  • 老用例回归(test_v05_step3 / test_v05_translate_batch / test_v07_step2-3 / test_v05_step1-2)
  • 前端 Translate.vue 顶部能力条 + 译文状态行 + 删按钮
  • 前端测试 Translate.spec.js
  • 浏览器三态自测(匿名 / 登录新文本 / 登录已存在)
  • 文档同步(CLAUDE.md 接口清单)

Phase 2 占位

原始需求里「生词本做好去重」本次推迟,作为后续独立 brainstorm 启动 — 见 spec §8。

Test plan

  • 本 PR 仅 spec 文档,无代码改动,无测试要求
  • 合入主线后建独立 PR 走实施 + 实施 PR 走完整 test plan

🤖 Generated with Claude Code

bob798 added 3 commits May 20, 2026 15:36
V0.8 explain 自动入库模式平移到 Translate 页:点「翻译」立即占位,
译文回填,匿名降级。包含后端契约、前端 UI、测试与风险清单。
- direction 白名单校验前置到占位写入前(避免非法 direction 留空白行)
- update_translated_text 失败用 try/except 降级,不拖垮已成功的翻译
- 复用已有 get_current_user_id_optional,不再新增重复依赖
- 测试补 test_backfill_failure_degrades / test_invalid_direction_no_placeholder
记录原始需求里被推迟的「生词本去重」开放问题,作为后续
brainstorm 的入口,避免被遗忘。
@bob798 bob798 merged commit 9ff5c30 into main May 21, 2026
@bob798 bob798 deleted the feat/translate-auto-vocab branch May 21, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant