diff --git a/apps/cli/src/commands/config/pull/pull.integration.test.ts b/apps/cli/src/commands/config/pull/pull.integration.test.ts index 7bcf2433b1..2c40961777 100644 --- a/apps/cli/src/commands/config/pull/pull.integration.test.ts +++ b/apps/cli/src/commands/config/pull/pull.integration.test.ts @@ -194,7 +194,7 @@ function v2Response( mailer_notifications_mfa_factor_enrolled_enabled: false, mailer_notifications_mfa_factor_unenrolled_enabled: false, external_phone_enabled: false, - sms_autoconfirm: false, + sms_autoconfirm: true, sms_max_frequency: 5, sms_otp_exp: 60, sms_otp_length: 6, diff --git a/apps/cli/src/commands/config/push/push.encoders.ts b/apps/cli/src/commands/config/push/push.encoders.ts index ac2158ea44..09f8e88faf 100644 --- a/apps/cli/src/commands/config/push/push.encoders.ts +++ b/apps/cli/src/commands/config/push/push.encoders.ts @@ -1334,7 +1334,7 @@ export const PUSH_AUTH_LEAF_MAP: ReadonlyArray = [ { configPath: ["auth", "sms", "enable_confirmations"], apiKey: "sms_autoconfirm", - transform: asBoolean, + transform: invert, }, { configPath: ["auth", "sms", "template"], apiKey: "sms_template", transform: asString }, { configPath: ["auth", "sms", "otp_length"], apiKey: "sms_otp_length", transform: asNumber }, diff --git a/apps/cli/src/commands/config/push/push.encoders.unit.test.ts b/apps/cli/src/commands/config/push/push.encoders.unit.test.ts index 75d775c235..cf59f3ab84 100644 --- a/apps/cli/src/commands/config/push/push.encoders.unit.test.ts +++ b/apps/cli/src/commands/config/push/push.encoders.unit.test.ts @@ -504,6 +504,13 @@ describe("encodeAuthBody", () => { expect(result.body).toEqual({ mailer_autoconfirm: false }); }); + it("inverts sms.enable_confirmations into sms_autoconfirm", () => { + const result = encodeAuthBody( + authInput({ changes: [change(["auth", "sms", "enable_confirmations"], true)] }), + ); + expect(result.body).toEqual({ sms_autoconfirm: false }); + }); + it("maps password_requirements through the character-class table", () => { const result = encodeAuthBody( authInput({ changes: [change(["auth", "password_requirements"], "letters_digits")] }), diff --git a/apps/cli/tests/helpers/config-fixtures.ts b/apps/cli/tests/helpers/config-fixtures.ts index a9b22abffa..b8605c097d 100644 --- a/apps/cli/tests/helpers/config-fixtures.ts +++ b/apps/cli/tests/helpers/config-fixtures.ts @@ -96,7 +96,7 @@ export function v2ProjectConfigResponse( sms_messagebird_originator: null, sms_textlocal_sender: null, sms_vonage_from: null, - sms_autoconfirm: false, + sms_autoconfirm: true, sms_max_frequency: 5, sms_otp_exp: 60, sms_otp_length: 6, diff --git a/packages/config/src/project-config/project-config.unit.test.ts b/packages/config/src/project-config/project-config.unit.test.ts index 6032b555dd..dbb83d8d6f 100644 --- a/packages/config/src/project-config/project-config.unit.test.ts +++ b/packages/config/src/project-config/project-config.unit.test.ts @@ -1018,10 +1018,9 @@ describe("fromApiProjectConfig — auth section", () => { expect(result.auth?.email?.enable_confirmations).toBe(false); }); - test("sms_autoconfirm maps to auth.sms.enable_confirmations WITHOUT inverting", () => { - // Unlike mailer_autoconfirm/email.enable_confirmations, this key isn't inverted. + test("sms_autoconfirm inverts to auth.sms.enable_confirmations", () => { const result = fromApiProjectConfig({ auth: { sms_autoconfirm: true } }); - expect(result.auth?.sms?.enable_confirmations).toBe(true); + expect(result.auth?.sms?.enable_confirmations).toBe(false); }); test("rate_limit_otp renames to auth.rate_limit.sign_in_sign_ups", () => { diff --git a/packages/config/src/project-config/registry-auth.ts b/packages/config/src/project-config/registry-auth.ts index e67a7e7484..8d6af692a4 100644 --- a/packages/config/src/project-config/registry-auth.ts +++ b/packages/config/src/project-config/registry-auth.ts @@ -782,8 +782,7 @@ const web3Rows: ReadonlyArray = [ const smsBaseRows: ReadonlyArray = [ boolRow(["auth", "sms", "enable_signup"], "external_phone_enabled"), - // Not inverted, unlike mailer_autoconfirm: sms_autoconfirm maps to enable_confirmations directly. - boolRow(["auth", "sms", "enable_confirmations"], "sms_autoconfirm"), + invertedBoolRow(["auth", "sms", "enable_confirmations"], "sms_autoconfirm"), stringRow(["auth", "sms", "template"], "sms_template"), secondsDurationRow(["auth", "sms", "max_frequency"], "sms_max_frequency"), uintRow(["auth", "sms", "otp_length"], "sms_otp_length"),