
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-06-08 00:01:30 +08:00
2025-12-29 10:03:27 +08:00
2026-03-07 15:06:13 +08:00
2026-02-02 22:13:50 +08:00
2026-03-03 15:01:10 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-06-12 22:09:53 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-05-19 22:05:43 +08:00
2025-12-29 10:03:27 +08:00
2026-02-10 11:42:39 +08:00
2026-05-27 18:00:45 +08:00
2026-05-26 10:49:20 +08:00
2026-02-28 15:01:20 +08:00
2026-04-20 17:39:57 +08:00
2026-05-26 10:49:20 +08:00
2026-06-12 22:09:53 +08:00
2026-04-11 13:16:35 +08:00
2026-04-21 12:41:27 +08:00
2026-04-14 16:26:46 +08:00
2026-04-20 17:39:57 +08:00
2026-05-26 10:49:20 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-06-08 00:01:30 +08:00
2026-05-19 15:53:28 +08:00
2026-06-12 22:09:53 +08:00
2026-06-26 10:36:09 +08:00
2026-02-12 11:41:20 +08:00
2025-12-31 15:31:26 +08:00
2026-04-11 13:16:35 +08:00
2026-03-27 14:33:05 +08:00
2026-02-02 22:13:50 +08:00
2026-05-12 15:21:31 +08:00
2026-05-26 10:49:20 +08:00
2025-12-29 10:03:27 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-05-26 10:49:20 +08:00
2025-12-31 14:11:57 +08:00
2026-06-08 00:01:30 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2026-06-08 00:01:30 +08:00
2026-06-08 00:01:30 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-03-07 15:06:13 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-03-07 15:06:13 +08:00
2026-03-07 15:06:13 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-03-03 15:01:10 +08:00
2026-01-04 19:28:20 +08:00
2026-01-10 13:14:35 +08:00
2026-03-03 15:01:10 +08:00
2026-03-03 15:01:10 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-06-12 22:09:53 +08:00
2026-04-20 20:21:02 +08:00
2026-04-21 14:14:49 +08:00
2026-06-12 22:09:53 +08:00
2026-06-12 22:09:53 +08:00
2026-04-23 17:31:15 +08:00
2026-04-21 10:10:56 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-20 20:21:02 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-04-23 17:31:15 +08:00
2026-05-19 22:05:43 +08:00
2026-04-21 14:14:49 +08:00
2026-04-21 14:14:49 +08:00
2026-05-19 22:05:43 +08:00
2026-05-19 22:05:43 +08:00
2026-06-08 00:01:30 +08:00
2026-01-03 06:37:08 -08:00
2026-05-26 10:49:20 +08:00
2026-02-10 11:42:39 +08:00
2026-02-05 21:52:54 +08:00
2026-02-05 21:52:54 +08:00
2026-02-10 11:42:39 +08:00
2026-02-10 11:42:39 +08:00
2026-01-10 13:14:35 +08:00
2026-05-27 18:00:45 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2026-05-27 18:00:45 +08:00
2026-05-27 18:00:45 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-02-28 15:01:20 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-06-12 22:09:53 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-21 12:41:27 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-21 12:41:27 +08:00
2026-04-21 12:41:27 +08:00
2026-04-14 16:26:46 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-14 16:26:46 +08:00
2026-04-14 16:26:46 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-04-20 17:39:57 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-01-10 13:14:35 +08:00
2026-06-08 00:01:30 +08:00
2025-12-29 10:03:27 +08:00
2026-06-08 00:01:30 +08:00
2026-06-08 00:01:30 +08:00
2026-06-08 00:01:30 +08:00
2026-05-19 15:53:28 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2026-05-19 15:53:28 +08:00
2026-05-19 15:53:28 +08:00
2025-12-29 10:03:27 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2026-02-12 11:41:20 +08:00
2025-12-31 15:31:26 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-31 15:31:26 +08:00
2025-12-29 10:03:27 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-11 13:16:35 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-03-27 14:33:05 +08:00
2026-06-30 13:22:27 +08:00
2026-05-26 10:49:20 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-02-02 22:13:50 +08:00
2026-05-12 15:21:31 +08:00
2025-12-31 14:11:57 +08:00
2026-01-10 13:14:35 +08:00
2026-05-12 15:21:31 +08:00
2026-05-12 15:21:31 +08:00
2026-05-26 10:49:20 +08:00
2025-12-29 10:03:27 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-29 10:03:27 +08:00
2025-12-29 10:03:27 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-10 13:14:35 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-01-10 13:14:35 +08:00
2026-01-01 18:58:34 +08:00
2026-01-01 18:58:34 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2026-05-26 10:49:20 +08:00
2025-12-31 14:11:57 +08:00
2025-12-29 10:03:27 +08:00
2026-01-10 13:14:35 +08:00
2025-12-31 14:11:57 +08:00
2025-12-31 14:11:57 +08:00