Skip to content

perf(auth): score the password strength meter on the server - #1582

Merged
MBombeck merged 1 commit into
release/v1.50.0from
perf/150-bundle-headroom
Nov 26, 2026
Merged

MBombeck merged 1 commit into
release/v1.50.0from
perf/150-bundle-headroom

Conversation

@MBombeck

Copy link
Copy Markdown
Owner

The release branch sat at the 1990 KB gz cap on distinct client code (1991 locally, just under in CI). Source-map attribution of a local build put 375 KB gz of it in one module: zxcvbn's word-frequency dictionaries, which the password strength meter loaded on demand in the browser. Lazy loading does not lower that number (every module counts once wherever it loads), so the dictionaries have to leave the client.

  • POST /api/auth/password-strength answers zxcvbn's score and untranslated feedback for at most 256 characters. Anonymous like the registration form, rate limited per address (60 a minute) before the body is read, stores nothing. Public path in the proxy, published in the contract with security: [], listed in the security-declaration and feature-key guards.
  • The meter (PasswordStrength: registration, profile claim, admin reset) asks once typing pauses (200 ms), aborts the previous request, keeps the last answer until the next arrives, translates feedback as before. Same score and same feedback strings as the in-browser library.
  • bundle-budget.json: uniqueClientKbGz 1990 to 1640, so the gate can still catch a regression this size.
before after
unique client code (local arm64) 1991 KB gz, 1319 modules 1601 KB gz, 1296 modules
first load p50 / p95 / max 345 / 391 / 420 345 / 391 / 420
summed chunks (not gated) 4252 3864

Checked: tsc, lint, full unit suite (only the known dump-core failure), route test, e2e invite-registration and v142-managed-profile-handover on desktop and mobile against a local production build, and the meter on /auth/register in a browser (two typing bursts, two requests, same labels and feedback).

The meter loaded zxcvbn in the browser on demand. Its word-frequency
dictionaries are about 375 KB gzip, more than any page of the app, and
they made up most of the distinct client code the bundle budget counts:
the release branch sat at the 1990 KB cap. The server already runs the
same estimator when the form is sent.

POST /api/auth/password-strength answers zxcvbn's score and untranslated
feedback for at most 256 characters. Anonymous like the registration
form that uses it, rate limited per address before the body is read,
stores nothing. The meter asks once typing pauses (200 ms), keeps the
last answer until the next one arrives, and translates the feedback as
before.

Distinct client code on a local build: 1991 to 1601 KB gzip in 1296
modules; first loads unchanged. The cap drops from 1990 to 1640 so it
can still catch a regression of that size.
@MBombeck
MBombeck merged commit 9caab79 into release/v1.50.0 Nov 26, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant