Repository navigation
web/flow: revert locale-driven flow re-request from FlowExecutor - #24050
Conversation
Back out the `LOCALE_STATUS_EVENT` listener that #23007 added to `FlowExecutor`. The label-formatting half of that PR (`format.ts`, `ak-locale-select.ts`, the `activeLocaleTag`-keyed `repeat`, and the mixin `@remarks`) stays; only the executor-side re-request goes. The operator's report was that the flow executor isn't handling locale events well. Four failure modes make that report reproducible. First, on mount we get two concurrent `flowsExecutorGet` calls. `firstUpdated` already kicks off `refresh()` unconditionally, and `LOCALE_STATUS_EVENT` fires as soon as `@lit/localize` resolves the initial locale, which on the cached/default path is the same tick. Both GETs land in the server's dispatch loop; each one calls `plan.next(self.request)` and writes back to `request.session[SESSION_KEY_PLAN]`. Django sessions aren't transactional across concurrent requests, so the second write can clobber the first. Second, the promise chain in `firstUpdated` around line 253 breaks. `refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent()))` resolves against the challenge *its* GET returned, but a second refresh can overwrite `this.challenge` in between, so listeners that read `flowExecutor.challenge` on advance see a stale stage. Third, every user-initiated locale change destroys stage state. Once the executor is mounted, flipping the locale selector fires `LOCALE_STATUS_EVENT`, which calls `refresh()`, which replaces `this.challenge`. The `guard([challenge])` in the render tears down the whole stage subtree and rebuilds it, dropping typed input on password / email / identification stages and cancelling in-flight captcha and WebAuthn widgets. Fourth, auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs advance the plan twice and skip a stage. `CaptchaStage` already shows the right pattern for this: the stage owns its own `LOCALE_STATUS_EVENT` listener and re-runs the locale-dependent piece in place, without tearing down its containing view. Whoever picks this up next should either re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow. Re-opens the server-side-label half of #22954. Co-Authored-By: Agent (authentik-m-web-flow-wide-brief-cherry) <[email protected]>
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24050 +/- ##
==========================================
- Coverage 92.71% 92.67% -0.05%
==========================================
Files 1047 1047
Lines 61637 61637
Branches 424 424
==========================================
- Hits 57149 57121 -28
- Misses 4488 4516 +28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-5ee891a469575f1fd2ce3ef5ebbddaa63899fede
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-5ee891a469575f1fd2ce3ef5ebbddaa63899fedeAfterwards, run the upgrade commands from the latest release notes. |
|
🍒 Cherry-pick to |
* main: web/flow: revert locale-driven flow re-request from FlowExecutor (#24050) web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840) root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013) docs/social-logins: Add jumpcloud oidc and saml (#24048) core, web: update translations (#24037) web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007) ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045) website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043) web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044) web: bump aws-cdk from 2.1128.1 to 2.1129.0 (#24046) stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#24039) packages/django-dramatiq-postgres/broker: close unusable PostgreSQL connections (#24023) api/search: add number and boolean support in AKQL queries on JSON fields (#23418) (#24028) enterprise: simplify tests (#18404) website/docs: Remove Public Release Docs. (#24031) website/docs: sys-mgmt: tweak settings wording (#24029) website/docs: cleanup 07-12: update release process guidance (#23970) website/integrations: add infiscal (#23996)
* main: (104 commits) web/flow: revert locale-driven flow re-request from FlowExecutor (#24050) web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840) root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013) docs/social-logins: Add jumpcloud oidc and saml (#24048) core, web: update translations (#24037) web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007) ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045) website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043) web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044) web: bump aws-cdk from 2.1128.1 to 2.1129.0 (#24046) stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#24039) packages/django-dramatiq-postgres/broker: close unusable PostgreSQL connections (#24023) api/search: add number and boolean support in AKQL queries on JSON fields (#23418) (#24028) enterprise: simplify tests (#18404) website/docs: Remove Public Release Docs. (#24031) website/docs: sys-mgmt: tweak settings wording (#24029) website/docs: cleanup 07-12: update release process guidance (#23970) website/integrations: add infiscal (#23996) ...
…card-2 * web/cleanup/schedule-card-1: (104 commits) web/flow: revert locale-driven flow re-request from FlowExecutor (#24050) web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840) root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013) docs/social-logins: Add jumpcloud oidc and saml (#24048) core, web: update translations (#24037) web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007) ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045) website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043) web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044) web: bump aws-cdk from 2.1128.1 to 2.1129.0 (#24046) stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#24039) packages/django-dramatiq-postgres/broker: close unusable PostgreSQL connections (#24023) api/search: add number and boolean support in AKQL queries on JSON fields (#23418) (#24028) enterprise: simplify tests (#18404) website/docs: Remove Public Release Docs. (#24031) website/docs: sys-mgmt: tweak settings wording (#24029) website/docs: cleanup 07-12: update release process guidance (#23970) website/integrations: add infiscal (#23996) ...
…card-3-problem-children * web/cleanup/schedule-card-2: (113 commits) website/docs: release notes for 2026.5.5 (#24070) website/docs: release notes for 2026.2.6 (#24069) web, locale: Normalize legacy locale file names (#24024) web/bug: harmonize and make routine the display of tasks (part 4: schedule-list cards) (#23855) security: automated internal backport of patch 1822.sec.patch to authentik-main (#24064) security: automated internal backport of patch 1934.sec.patch to authentik-main (#24067) security: automated internal backport of patch 1887.sec.patch to authentik-main (#24065) security: automated internal backport of patch 1919.sec.patch to authentik-main (#24066) security: automated internal backport of patch 1817.sec.patch to authentik-main (#24063) web/flow: revert locale-driven flow re-request from FlowExecutor (#24050) web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840) root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013) docs/social-logins: Add jumpcloud oidc and saml (#24048) core, web: update translations (#24037) web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007) ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045) website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042) core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043) web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044) ...
…rry-pick #24050 to version-2026.5) (#24068) web/flow: revert locale-driven flow re-request from FlowExecutor (#24050) Back out the `LOCALE_STATUS_EVENT` listener that #23007 added to `FlowExecutor`. The label-formatting half of that PR (`format.ts`, `ak-locale-select.ts`, the `activeLocaleTag`-keyed `repeat`, and the mixin `@remarks`) stays; only the executor-side re-request goes. The operator's report was that the flow executor isn't handling locale events well. Four failure modes make that report reproducible. First, on mount we get two concurrent `flowsExecutorGet` calls. `firstUpdated` already kicks off `refresh()` unconditionally, and `LOCALE_STATUS_EVENT` fires as soon as `@lit/localize` resolves the initial locale, which on the cached/default path is the same tick. Both GETs land in the server's dispatch loop; each one calls `plan.next(self.request)` and writes back to `request.session[SESSION_KEY_PLAN]`. Django sessions aren't transactional across concurrent requests, so the second write can clobber the first. Second, the promise chain in `firstUpdated` around line 253 breaks. `refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent()))` resolves against the challenge *its* GET returned, but a second refresh can overwrite `this.challenge` in between, so listeners that read `flowExecutor.challenge` on advance see a stale stage. Third, every user-initiated locale change destroys stage state. Once the executor is mounted, flipping the locale selector fires `LOCALE_STATUS_EVENT`, which calls `refresh()`, which replaces `this.challenge`. The `guard([challenge])` in the render tears down the whole stage subtree and rebuilds it, dropping typed input on password / email / identification stages and cancelling in-flight captcha and WebAuthn widgets. Fourth, auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs advance the plan twice and skip a stage. `CaptchaStage` already shows the right pattern for this: the stage owns its own `LOCALE_STATUS_EVENT` listener and re-runs the locale-dependent piece in place, without tearing down its containing view. Whoever picks this up next should either re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow. Re-opens the server-side-label half of #22954. Co-authored-by: Teffen Ellis <[email protected]> Co-authored-by: Agent (authentik-m-web-flow-wide-brief-cherry) <[email protected]> Co-authored-by: Jens L. <[email protected]>
Details
#23007 landed two changes: the locale selector label fix, and a
LOCALE_STATUS_EVENTlistener that makesFlowExecutorre-request the flow whenever the locale finishes loading. This reverts the listener. The label fixes (format.ts,ak-locale-select.ts, theactiveLocaleTag-keyedrepeat, the mixin@remarks) stay as merged.The listener causes a duplicate GET on mount.
firstUpdatedalready callsrefresh()unconditionally, andLOCALE_STATUS_EVENTfires as soon as@lit/localizeresolves the initial locale, which on the cached or default path is the same tick. BothflowsExecutorGetcalls reach the server's dispatch loop, each callsplan.next(self.request)and writesrequest.session[SESSION_KEY_PLAN]. Django sessions aren't transactional across concurrent requests, so one write can clobber the other.That also breaks the promise chain in
firstUpdated.refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent()))resolves against the challenge its own GET returned, but a second refresh can overwritethis.challengein between, leaving listeners that readflowExecutor.challengeon advance with a stale stage. Auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs can advance the plan twice and skip a stage.The user-facing case is worse. Once the executor is mounted, flipping the locale selector fires the event, calls
refresh(), and replacesthis.challenge. Theguard([challenge])in render then tears down the whole stage subtree, dropping typed input on password, email, and identification stages and cancelling in-flight captcha and WebAuthn widgets.CaptchaStagealready handles locale changes the other way: the stage owns its ownLOCALE_STATUS_EVENTlistener and re-runs the locale-dependent part in place, without tearing down its containing view. A future pass should re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow.This re-opens the server-side-label half of #22954.
Test plan
Lint, typecheck, and precommit are clean on the branch. The change is confined to
web/src/flow/FlowExecutor.ts: the@lit/localizeimport returns tomsg-only and the listener block is removed. No other files change.Disclosure
Triaged and authored end-to-end by an agent running in a sandbox against
goauthentik/authentik@main. Reviewed and shipped by @GirlBossRush.closes #23857