Commit a4c2ed4
committed
test(auth): cover the better-auth 2FA lockout path; regenerate object translation bundles (#3624 follow-up)
Follow-up to #3647, which provisioned four better-auth 1.7 columns that no
platform object had. Two loose ends from that PR.
## The 2FA lockout path had no test at all
`sys_two_factor.failed_verification_count` / `locked_until` were added blind
alongside the team fix — found by the new parity gate, not by anything
exercising the behavior. That is why they went missing in the first place: the
whole path was untested, so a column better-auth writes on every wrong code
could vanish without a single failure.
The new dogfood test pins the behavior, not just the schema: a wrong code is
COUNTED (the counter advances in the database), and a correct code RESETS the
count — which is what makes the budget track *consecutive* failures.
It has to go through the mid-sign-in two-factor cookie, not a bearer token:
better-auth only runs `assertTwoFactorNotLocked` / `recordTwoFactorFailure`
when `isSignIn` is true, and deliberately skips both when the same endpoint is
called with a live session. A bearer-token test would have passed while the
lockout path stayed entirely unexercised — the exact blind spot that let the
columns through.
Reverting the `AUTH_TWO_FACTOR_SCHEMA` mapping makes it fail, and shows the
breakage was wider than the wrong-code path: `two-factor/enable` itself 500s
with `table sys_two_factor has no column named failedVerificationCount`, so
enrollment was broken too.
TOTP is generated in-test from the otpauth:// secret via RFC 6238 over
node:crypto rather than importing `@better-auth/utils/otp` — that is a
transitive dependency, and taking a direct one on it to produce six digits
would tie the test to an internal package's resolution.
## Translation bundles
`os i18n extract` regenerated for the four new fields, which were absent from
every locale bundle. Also picks up `sys_organization.parent_organization_id` /
`sort_order` from the earlier ADR-0105 D6 work, which had the same gap.
The `*.metadata-forms.generated.ts` bundles are deliberately NOT included: the
same run rewrites them with unrelated spec drift (agent `visibility` and
`capabilities.trash`/`mru` removed, `summaryOperations.*` added). Those are
DELETIONS of curated translations for a spec change this branch has nothing to
do with, so they are left for whoever owns that change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UYLC8TfjzHGwatNxZKdX7H1 parent ce1f100 commit a4c2ed4
5 files changed
Lines changed: 312 additions & 0 deletions
File tree
- packages
- platform-objects/src/apps/translations
- qa/dogfood/test
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
510 | 518 | | |
511 | 519 | | |
512 | 520 | | |
| |||
709 | 717 | | |
710 | 718 | | |
711 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
712 | 724 | | |
713 | 725 | | |
714 | 726 | | |
| |||
759 | 771 | | |
760 | 772 | | |
761 | 773 | | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
762 | 778 | | |
763 | 779 | | |
764 | 780 | | |
| |||
993 | 1009 | | |
994 | 1010 | | |
995 | 1011 | | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
996 | 1020 | | |
997 | 1021 | | |
998 | 1022 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
510 | 518 | | |
511 | 519 | | |
512 | 520 | | |
| |||
709 | 717 | | |
710 | 718 | | |
711 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
712 | 724 | | |
713 | 725 | | |
714 | 726 | | |
| |||
759 | 771 | | |
760 | 772 | | |
761 | 773 | | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
762 | 778 | | |
763 | 779 | | |
764 | 780 | | |
| |||
993 | 1009 | | |
994 | 1010 | | |
995 | 1011 | | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
996 | 1020 | | |
997 | 1021 | | |
998 | 1022 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
510 | 518 | | |
511 | 519 | | |
512 | 520 | | |
| |||
709 | 717 | | |
710 | 718 | | |
711 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
712 | 724 | | |
713 | 725 | | |
714 | 726 | | |
| |||
759 | 771 | | |
760 | 772 | | |
761 | 773 | | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
762 | 778 | | |
763 | 779 | | |
764 | 780 | | |
| |||
993 | 1009 | | |
994 | 1010 | | |
995 | 1011 | | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
996 | 1020 | | |
997 | 1021 | | |
998 | 1022 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
510 | 518 | | |
511 | 519 | | |
512 | 520 | | |
| |||
709 | 717 | | |
710 | 718 | | |
711 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
712 | 724 | | |
713 | 725 | | |
714 | 726 | | |
| |||
759 | 771 | | |
760 | 772 | | |
761 | 773 | | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
762 | 778 | | |
763 | 779 | | |
764 | 780 | | |
| |||
993 | 1009 | | |
994 | 1010 | | |
995 | 1011 | | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
996 | 1020 | | |
997 | 1021 | | |
998 | 1022 | | |
| |||
0 commit comments