fix(synastry): store only the two marriage-match profiles

The saved row was the whole dossier twice. Keep the default and Raman match results, drop a concurrent duplicate insert back to the first row, and hide the new rows from the old history list.

Checked service tests 9/9, tsc 0, lint 0 errors, and test:db 73 pass / 13 fail matching the Windows known list.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jesse-ux
2026-10-18 19:14:31 +08:00
co-authored by Grok (agent loop) Cursor
parent 52160a9cef
commit cf5a62c684
10 changed files with 206 additions and 18 deletions
+2 -1
View File
@@ -36500,7 +36500,8 @@
- 根因:旧接口只收两个月亮度数,并写死男方 / 女方。
- 修复:改用上游合盘模块。配对层对两个方向取平均,不读性别。
- 验证:上游产品测试与本地对调测试。公开名人证据包可以进入解读。
- 防复发:对调后配对分、火星冲克和婚姻宫压力一致的测试。
- 复查(2026-10-18 打回):第一次实现把整份证据包写入 `report` 和 `structured_result`。修复后这两列只存 `{ rules_version, default, raman }`,`default` 是默认 profile 的配对结果,`raman` 是 Raman profile。命中不再返回证据包。同时点两次时,第二次读第一次存下的行。
- 防复发:对调后配对分、火星冲克和婚姻宫压力一致的测试。存档单测要求结构结果不含证据包,且小于 64 KB。
- 相关记录:BUG-1371。
- 复发自:无。
- 修复版本:分支 `codex/marriage-match-p1-20261017`。
@@ -41,6 +41,22 @@
| 数据库 | `npm run test:db` | 86 项:73 通过,13 失败,0 取消。13 条失败名称与 `tools/agent-loop/windows-known-failures.txt` 逐条相同。婚恋合盘这一项通过。 |
| 全量 pytest / 快速门 | 未跑 | Windows 执行约定由验收方跑。 |
## 第 1 次打回(F1 / F2)
结构结果的键是 `rules_version`、`default`、`raman`。`default` 取证据包里的 `marriage_match`,`raman` 取 Raman profile。`report` 列存同一份结构结果,不存证据包。现算返回 `{ cached: false, structured, dossier }`;命中返回 `{ cached: true, structured }`,不带证据包。后续单要证据包时自己调证据包接口。旧历史列表只取 `rules_version is null` 的行。同一对人同时写入时,第二次遇到唯一冲突就重读第一次的行。
大小用 `frontend/tests/fixtures/marriage-match-snapshot.json` 当两套 profile 的金样,存进去的 JSON 小于 64 KB。证据包里的盘面快照不入库。
## 修复后的检查
| 检查 | 命令 | 结果 |
| --- | --- | --- |
| 服务端函数与旧历史过滤 | `node node_modules/tsx/dist/cli.mjs --test tests/marriage-match-service.test.ts tests/synastry-reports-history.test.ts` | 9 通过,0 失败,0 取消。 |
| 类型检查 | `tsc --noEmit` | 0 错。 |
| lint | `npm run lint` | 0 error,123 warning(原有)。 |
| 数据库 | `npm run test:db` | 86 项:73 通过,13 失败,0 取消。13 条与 Windows 已知失败清单逐条相同。`database-marriage-match.test.ts` 通过。 |
| 全量 pytest / 快速门 | 未跑 | 留给验收方。 |
## 偏离
- 不做页面、不扣点,与第六版一致。
+2 -2
View File
@@ -501,8 +501,8 @@
| `TASK-data-layer-types-20261013.md` | `PROGRESS-data-layer-types-20261013.md` | 数据访问层改用自己的 DataClient 类型第一阶段(BUG-1351;任务书预留的 1343 已被更大编号越过) | 待验收 | `codex/data-layer-types-20261013` |
| `TASK-contracts-helpers-dedupe-20261013.md` | — | 前后端契约与小工具去重第一阶段 | 待领取(排队:frontend-dead-code、consult-route-split) | `codex/contracts-helpers-dedupe-20261013` |
| `TASK-people-archive-limit-20-20261017.md` | `PROGRESS-people-archive-limit-20-20261017.md` | 星盘档案上限 5→20 人(触发器新迁移 + 常量 + 文案;婚恋合盘前置单) | 待验收 | `codex/people-archive-limit-20-20261017` |
| `TASK-marriage-match-p1-20261017.md` | #79 | 婚恋合盘引擎(搬上游 bde5d615:marriage_match + 合盘证据包;35 分七项、不分男女;第六版不扣点、不做页面)(BUG-1370 起) | 执行中(第 1 次打回修复) | `codex/marriage-match-p1-20261017`;动表 |
| `TASK-marriage-match-p1-fix-20261018.md` | #79 | 只存两个 profile 的配对结果;旧历史列表不读新行;并发重复写入改为重读 | 执行中 | `codex/marriage-match-p1-20261017` |
| `TASK-marriage-match-p1-20261017.md` | #79 | 婚恋合盘引擎(搬上游 bde5d615:marriage_match + 合盘证据包;35 分七项、不分男女;第六版不扣点、不做页面)(BUG-1370 起) | 待验收 | `codex/marriage-match-p1-20261017`;动表 |
| `TASK-marriage-match-p1-fix-20261018.md` | #79 | 只存两个 profile 的配对结果;旧历史列表不读新行;并发重复写入改为重读 | 待验收 | `codex/marriage-match-p1-20261017` |
| `TASK-full-reading-module-parity-20261018.md` | #81 | full-reading 补齐上游 5 个模块(西占层文件没搬致永远 blocked、Navamsha / Niryaana 用我们自己的实现填键、Lagna Vargottamamsa / Pushkara / Punarphoo)(BUG-1375 起) | 待执行(可与 #78 并行) | `codex/full-reading-module-parity-20261018` |
| `TASK-synastry-full-report-20261018.md` | #82 | 婚恋合盘:选人页 + 完整合盘报告(关系画像九节:结论+折叠的分析逻辑+关系时间线+技术依据摘要;英文按需;计费键 synastry.full) | 排队(等 #78、#79、#81) | `codex/synastry-full-report-20261018`;动表 |
| `TASK-synastry-report-chat-20261018.md` | #83 | 从合盘报告某一节进入对话问依据(绑定报告与节、对话里可用术语、只依据已存计算结果并逐条核对、计费照普通对话) | 排队(等 #82) | `codex/synastry-report-chat-20261018`;动表 |
@@ -5,7 +5,7 @@
- `origin/staging` = `f95eb670b`(开工前 `git fetch origin --prune`,以最新 `origin/staging` 为准)
- 分支:`codex/marriage-match-p1-20261017`;工作树:`.worktrees/marriage-match-p1-20261017`
- **前置**:~~档案上限单先合入~~ 第六版起本单不碰前端页面(D16),**不再依赖 #78,可以直接开工**。
- **后续单**:`TASK-synastry-full-report-20261018.md`(#82,完整合盘报告)在本单与 #78、#81 合入后开工,复用本单的引擎、证据包接口、存储与服务端函数;选人页和所有入口改动都在那一单。
- **后续单**:`TASK-synastry-full-report-20261018.md`(#82,完整合盘报告)在本单与 #78、#81 合入后开工,复用本单的引擎、证据包接口、存储与服务端函数;选人页和所有入口改动都在那一单。证据包不入库。本单只存两个 profile 的配对结果(`structured_result.default` / `raman`)。#82 要证据包时自己调证据包接口;已保存命中时服务端函数不返回证据包。
- 原型:https://claude.ai/artifact/Tq6vhXFMnGitDZhJdamaHe (v8;本单没有任何页面,原型给的是后续单的样子)
## 现状实证(按符号定位)