
DaydreamCodingandClaude Opus 4.8
185f9c9920
fix(auth-signup): 平台配额快照脱离注册事务 + grok 补入 CHECK 约束
自助注册(含钉钉/OAuth)报 500→404 的根因:grok 自 2026-06 进入默认平台配额
(default_platform_quotas / auth_source_*),但 user_platform_quotas 的 CHECK
约束(迁移 142)仅允许 anthropic/openai/gemini/antigravity。注册时
snapshotPlatformQuotaDefaults 写 grok 行违反约束 → 整个注册事务被 Postgres 标记
aborted → consumePendingOAuthBrowserSessionTx 撞 "transaction aborted" → 500 →
clearCookies → 用户重试拿到 404(PENDING_AUTH_SESSION_NOT_FOUND)。
影响面:所有新自助注册(不限钉钉)。
修复(两层):
- 事务隔离(fix①):snapshotPlatformQuotaDefaults 用 ent.WithoutTx 剥离调用方事务,
在基础连接 autocommit 执行。best-effort 快照失败永不毒化注册主事务,从根上消除
"事务内 fail-open 形同虚设"陷阱——今后任何平台/约束漂移都不会再连累注册。
- 迁移 157:把 grok 加入 user_platform_quotas.platform 的 CHECK 约束,与代码平台
列表(domain/constants.go PlatformGrok)对齐(DROP IF EXISTS + ADD,可重入)。
新增 ent.WithoutTx(ctx) helper(手写文件,不动生成代码)。
测试:
- 单测 TestSnapshotPlatformQuotaDefaults_DetachesCallerTransaction(RED→GREEN):
快照即便在事务 ctx 中也必须用脱离事务的 ctx 调 repo。
- 集成测试 TestUserPlatformQuotaRepository_BulkInsertInitial_GrokAllowed:
迁移 157 后 grok 可写入(真实 postgres 容器验证)。
验证:go build ./... / go vet -tags unit ./... / 全量单测(-tags unit,45 包) /
平台配额+迁移集成测试 全绿。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 13:22:27 +08:00
..
2026-05-14 11:46:24 +08:00
2026-06-16 11:48:12 +08:00
2026-04-09 18:14:28 +08:00
2026-06-16 14:08:50 +08:00
2026-06-16 11:39:15 +08:00
2026-06-16 14:21:09 +08:00
2026-05-20 15:44:00 +08:00
2026-02-02 22:13:50 +08:00
2026-05-03 22:12:57 +08:00
2026-05-03 22:12:57 +08:00
2026-05-03 22:12:57 +08:00
2026-05-20 15:52:00 +08:00
2026-04-21 10:13:28 -07:00
2026-04-09 18:14:28 +08:00
2026-05-14 16:38:45 +08:00
2026-01-03 06:37:08 -08:00
2026-01-03 06:37:08 -08:00
2026-02-02 22:13:50 +08:00
2026-06-05 14:00:57 +08:00
2026-02-22 22:07:17 +08:00
2026-05-07 09:14:47 +08:00
2026-04-09 18:14:28 +08:00
2026-06-07 20:46:03 +08:00
2026-04-22 18:36:44 +08:00
2026-04-22 14:56:56 +08:00
2026-03-14 17:48:21 +08:00
2026-03-16 20:22:10 +08:00
2026-02-07 19:46:42 +08:00
2026-02-08 12:05:39 +08:00
2026-02-07 19:46:42 +08:00
2026-05-29 17:19:15 +08:00
2026-05-29 17:19:15 +08:00
2026-06-12 22:09:53 +08:00
2026-05-19 22:05:43 +08:00
2026-04-14 09:35:20 +08:00
2026-04-04 11:13:58 +08:00
2026-04-09 18:14:28 +08:00
2026-04-14 18:34:57 +08:00
2026-03-02 16:04:20 +08:00
2026-03-26 11:17:25 +08:00
2026-03-02 16:04:20 +08:00
2026-03-27 14:33:05 +08:00
2026-01-01 04:01:51 +08:00
2026-03-09 19:55:18 +08:00
2026-06-02 12:46:46 +08:00
2026-05-07 09:14:47 +08:00
2026-06-12 01:47:01 +08:00
2026-06-26 10:43:05 +08:00
2026-04-15 15:02:21 +08:00
2026-01-11 15:00:16 +08:00
2026-01-11 15:00:16 +08:00
2026-05-23 15:04:24 +08:00
2026-05-23 15:04:24 +08:00
2026-06-12 15:06:01 +08:00
2025-12-25 17:15:01 +08:00
2025-12-26 16:47:44 +08:00
2026-04-14 09:35:20 +08:00
2026-03-07 18:19:04 +08:00
2026-02-05 21:52:54 +08:00
2026-02-10 11:42:39 +08:00
2025-12-31 23:42:01 +08:00
2026-03-12 17:42:41 +08:00
2026-02-28 15:01:20 +08:00
2026-06-12 01:47:01 +08:00
2026-02-02 22:13:50 +08:00
2026-02-26 10:53:04 +08:00
2026-03-02 16:04:20 +08:00
2026-01-14 15:55:44 +08:00
2026-01-14 15:55:44 +08:00
2026-01-15 18:27:06 +08:00
2026-03-02 16:04:20 +08:00
2026-01-07 23:15:20 +08:00
2026-03-02 16:04:20 +08:00
2026-06-26 10:36:09 +08:00
2026-06-26 10:36:09 +08:00
2026-05-20 16:53:23 +08:00
2026-05-20 11:33:29 +08:00
2026-05-27 18:00:45 +08:00
2026-05-26 13:57:59 +08:00
2026-05-26 13:57:59 +08:00
2026-06-12 15:06:01 +08:00
2026-02-28 15:01:20 +08:00
2026-02-23 12:45:37 +08:00
2025-12-25 17:15:01 +08:00
2025-12-26 16:47:44 +08:00
2026-03-02 01:12:41 +08:00
2026-01-03 06:36:35 -08:00
2026-04-08 10:39:15 -07:00
2026-03-27 20:11:24 +08:00
2026-06-05 22:47:24 +08:00
2026-06-05 22:47:24 +08:00
2026-04-22 18:01:51 +08:00
2026-04-22 18:01:51 +08:00
2026-06-16 11:50:25 +08:00
2026-06-16 11:50:25 +08:00
2026-06-27 14:35:19 +08:00
2026-04-23 12:58:13 +08:00
2026-04-23 12:23:04 +08:00
2026-04-23 12:23:04 +08:00
2026-06-12 01:47:01 +08:00
2026-01-15 15:14:44 +08:00
2026-02-28 15:01:20 +08:00
2026-06-05 10:58:44 +08:00
2026-02-14 11:21:30 +08:00
2026-06-05 14:00:57 +08:00
2026-01-11 23:49:03 +08:00
2026-01-09 20:52:57 +08:00
2026-03-03 01:05:11 +08:00
2026-06-05 14:00:57 +08:00
2026-01-23 19:39:48 +08:00
2026-02-12 14:20:14 +08:00
2026-02-12 14:20:14 +08:00
2026-06-05 10:58:44 +08:00
2026-01-12 14:17:42 +08:00
2026-05-19 19:37:41 +08:00
2026-01-11 23:57:20 +08:00
2026-06-27 14:35:19 +08:00
2026-01-24 01:14:44 +08:00
2026-01-09 20:52:57 +08:00
2026-06-27 14:35:19 +08:00
2026-06-16 11:48:13 +08:00
2026-04-09 18:14:28 +08:00
2026-03-02 16:04:20 +08:00
2026-03-02 16:04:20 +08:00
2026-04-09 19:25:08 +08:00
2026-06-08 00:01:30 +08:00
2026-01-15 15:14:44 +08:00
2026-02-03 17:12:27 +08:00
2026-03-19 23:48:37 +08:00
2025-12-29 19:23:49 +08:00
2026-06-08 00:01:30 +08:00
2026-06-08 00:01:30 +08:00
2025-12-26 16:47:44 +08:00
2025-12-26 16:47:44 +08:00
2025-12-26 16:47:44 +08:00
2026-05-20 16:08:41 +08:00
2026-04-09 18:14:28 +08:00
2026-05-20 16:08:41 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-05 12:42:54 +08:00
2026-03-02 16:04:20 +08:00
2026-03-12 21:24:01 +08:00
2026-02-28 20:38:35 +08:00
2026-03-08 06:59:53 +08:00
2026-04-30 11:38:11 +08:00
2026-05-31 22:00:03 +08:00
2026-05-31 22:00:03 +08:00
2026-06-16 14:21:09 +08:00
2026-06-16 11:57:32 +08:00
2026-02-02 22:13:50 +08:00
2026-02-12 12:07:20 +08:00
2026-02-12 12:04:13 +08:00
2026-06-02 12:46:46 +08:00
2026-03-04 10:15:42 +08:00
2025-12-29 10:03:27 +08:00
2026-03-07 18:19:04 +08:00
2026-02-02 22:13:50 +08:00
2026-06-26 10:36:09 +08:00
2026-03-03 16:11:05 +08:00
2025-12-30 17:13:32 +08:00
2026-01-03 06:34:00 -08:00
2026-01-11 21:54:52 -08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-02-02 22:13:50 +08:00
2026-01-03 06:36:35 -08:00
2026-01-03 10:52:24 +08:00
2025-12-25 16:01:17 +08:00
2025-12-25 17:15:01 +08:00
2026-04-23 14:53:57 +08:00
2026-06-22 10:30:27 +08:00
2026-06-22 10:30:27 +08:00
2026-02-02 22:13:50 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-03-21 01:23:20 +08:00
2026-05-30 17:52:18 +08:00
2026-04-15 15:02:21 +08:00
2026-06-24 23:59:22 +08:00
2026-04-09 18:14:28 +08:00
2026-06-24 23:43:03 +08:00
2026-03-12 18:38:09 +08:00
2026-06-24 23:43:03 +08:00
2026-01-01 19:09:06 +08:00
2026-04-23 16:34:37 +08:00
2026-06-02 12:46:46 +08:00
2026-05-29 17:19:15 +08:00
2026-06-30 13:22:27 +08:00
2026-05-26 10:49:20 +08:00
2026-05-29 17:19:15 +08:00
2026-05-29 17:19:15 +08:00
2026-05-26 10:49:20 +08:00
2026-04-22 13:22:33 +08:00
2026-04-22 14:56:56 +08:00
2026-04-22 14:56:56 +08:00
2026-06-08 22:54:01 +08:00
2026-06-06 10:28:28 +08:00
2026-04-21 00:13:40 +08:00
2026-04-22 16:38:36 +08:00
2026-05-30 17:52:18 +08:00
2026-04-21 10:13:28 -07:00
2026-04-22 02:42:43 +08:00
2026-06-22 10:30:27 +08:00
2026-04-23 16:34:37 +08:00
2026-03-18 10:35:03 +08:00
2026-03-18 09:23:19 +08:00
2026-06-26 10:36:09 +08:00