# Backend Semantic Fix Report > 2026-06-05T19:10:00Z ## Summary 三轮修复,彻底解决后端 schema 语义问题。 ## Fix 1: singularize 函数修复 **问题:** `reading_status` → `reading_statu`(去掉尾部 s 时误伤) **修复:** `backend-builder-agent.mjs` + `fullstack-composer-agent.mjs` 添加 `SINGULAR_EXCEPTIONS` 集合,识别 `status/bus/campus/focus` 等 s 为词根的词。复合词(`reading_status`)按最后一段检查。 ## Fix 2: 领域特有字段 **问题:** `deriveTableFromFeature()` 对所有表只生成 `title/description/status/data` 通用字段。 **修复:** `architecture-agent.mjs` 新增 `FIELD_TEMPLATES` 系统,40+ 关键词匹配规则,覆盖: - 书籍/阅读:author, isbn, cover_url, publisher, genre, book_id, rating, percentage - 任务/看板:board_id, priority, due_date, assignee_id, role - CRM:email, phone, company, source, stage, amount, probability - 库存:quantity, warehouse, min_stock, supplier - 教育:instructor, course_id, sort_order, duration_min, max_score - 宠物:species, breed, birth_date, weight_kg - 文章/媒体:content, excerpt, cover_url, mime_type, size_bytes - 等等... 匹配失败时 fallback 到通用字段。 ## Fix 3: 移除域模板残留 **问题:** `domainSchemas[domain]` 盲目补充域模板表(如 note 域的 tags/note_tags),与 features 派生的表冲突。 **修复:** 删除整个 `domainSchemas` 体系。tables 100% 从 features 和 API paths 派生,不再有域模板补充。 ## 验证结果 ### Benchmark | 测试 | 结果 | |------|------| | 10/10 领域 E2E | ✅ PASS | | 170/170 回归测试 | ✅ PASS | ### 真实需求语义验证 | 需求 | Tables | 中文标识符 | 域模板污染 | |------|--------|-----------|-----------| | BookShelf | users/books/reading_status/reading_progress/reviews/stats | ✅ None | ✅ None | | TeamFlow | users/boards/tasks/members/activity_logs | ✅ None | ✅ None | | MealPrep | users/foods/customers/meal_plans/nutrition | ✅ None | ✅ None | ### 字段质量验证 | 需求 | 特有字段示例 | |------|------------| | BookShelf | books: author/isbn/cover_url/publisher/publish_date/genre | | BookShelf | reviews: book_id/rating/content | | TeamFlow | tasks: board_id/priority/due_date/assignee_id | | MealPrep | foods: calories_per_100g/protein_g/fat_g/carb_g | ## 改动文件 - `scripts/architecture-agent.mjs` — FIELD_TEMPLATES + getDomainFields + 去重逻辑 + 删除 domainSchemas - `scripts/backend-builder-agent.mjs` — SINGULAR_EXCEPTIONS - `scripts/fullstack-composer-agent.mjs` — SINGULAR_EXCEPTIONS