test(repository): assert the auth projection carries require_privacy_set

OpenAI scheduling now reads the privacy gate from the auth snapshot; cover
the GetByKeyForAuth projection so a dropped column fails here instead of
admitting accounts without privacy set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
harukaandClaude Opus 5.5 committed 2026-11-06 03:00:03 -05:00
1 parent f654c23eb7
commit 1c83bb825a
2 files changed
+5 -1

No files matched your search

@@ -28,6 +28,7 @@ func TestGetByKeyForAuthCarriesProfitControlProjection(t *testing.T) {
ProfitControlEnabled: true,
ProfitMinMargin: 0.2,
ProfitSafetyBuffer: 0.05,
RequirePrivacySet: true,
})
user := mustCreateUser(t, integrationEntClient, &service.User{
Email: fmt.Sprintf("profit-proj-%d@example.com", suffix), Concurrency: 5,
@@ -57,4 +58,6 @@ func TestGetByKeyForAuthCarriesProfitControlProjection(t *testing.T) {
require.True(t, got.Group.ProfitControlEnabled, "profit_control_enabled 必须进入认证投影(投影漏列会让门静默失效)")
require.InDelta(t, 0.2, got.Group.ProfitMinMargin, 1e-9)
require.InDelta(t, 0.05, got.Group.ProfitSafetyBuffer, 1e-9)
// OpenAI 选号从认证分组读取隐私门,漏列会放行未设置隐私的账号。
require.True(t, got.Group.RequirePrivacySet, "require_privacy_set 必须进入认证投影")
}
@@ -96,7 +96,8 @@ func mustCreateGroup(t *testing.T, client *dbent.Client, g *service.Group) *serv
SetCodexModelsManifestConfig(g.CodexModelsManifestConfig).
SetProfitControlEnabled(g.ProfitControlEnabled).
SetProfitMinMargin(g.ProfitMinMargin).
SetProfitSafetyBuffer(g.ProfitSafetyBuffer)
SetProfitSafetyBuffer(g.ProfitSafetyBuffer).
SetRequirePrivacySet(g.RequirePrivacySet)
if g.Description != "" {
create.SetDescription(g.Description)
}