fix(db): 会话列表按 updated_at 再按 id 排
Independent Staging Quality Gate / validate (push) Failing after 9m55s
Independent Staging Quality Gate / publish (push) Skipped

兼容层 order() 改为追加,不再只留最后一键。
GET /api/sessions 与套餐列表的两次 order() 都会进 SQL。
This commit is contained in:
jesse-ux
2026-09-17 20:12:22 +08:00
parent 6d81062be9
commit e60a3a4d14
7 changed files with 106 additions and 7 deletions
+16
View File
@@ -12066,3 +12066,19 @@
- 相关记录:BUG-924
- 复发自:无
- 修复版本:待发布
## BUG-926 | 会话列表只按 id 排,游标按 updated_at,首页不是最近活动
- 状态:resolved
- 首次发现:2026-09-17
- 最近更新:2026-09-17
- 影响面:`local-postgres-client-core.ts` `order()``GET /api/sessions``GET /api/payment/packages`
- 用户现象:侧栏列表每次进来都不一样;当天新建的校正会话不在首页 50 条里。
- 触发条件:打开 `/` 或次级页拉会话列表。
- 根因:兼容层 `order()` 只保留最后一次调用。`.order("updated_at").order("id")` 实际只按 `id`;游标却按 `updated_at, id`。套餐列表同样只按 `created_at`
- 修复:`ordering` 改为数组,多次 `order()` 追加,SQL 生成 `order by a, b`。路由调用未改。
- 验证:`local-postgres-order.test.ts`。无 Docker,未跑 `test:db` 翻页重叠断言,见 `BLOCKED.md`
- 防复发:两次 `order()` 必须都出现在 SQL 里;列表排序键与 `sessionCursorFilter` 键一致。
- 相关记录:BUG-553
- 复发自:无
- 修复版本:待发布