Skip to content

web/flow: revert locale-driven flow re-request from FlowExecutor (cherry-pick #24050 to version-2026.5) - #24068

Merged
BeryJu merged 1 commit into
version-2026.5from
cherry-pick/24050-to-version-2026.5
Jul 15, 2026
Merged

BeryJu merged 1 commit into
version-2026.5from
cherry-pick/24050-to-version-2026.5

Conversation

@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

Cherry-pick of #24050 to version-2026.5 branch.

Original PR: #24050
Original Author: @GirlBossRush
Cherry-picked commit: dff7424

)

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]>
Co-authored-by: Jens L. <[email protected]>
@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.28%. Comparing base (4dd48ad) to head (d3c85b5).
⚠️ Report is 5 commits behind head on version-2026.5.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                Coverage Diff                 @@
##           version-2026.5   #24068      +/-   ##
==================================================
- Coverage           93.30%   93.28%   -0.02%     
==================================================
  Files                1037     1037              
  Lines               60561    60561              
  Branches              400      400              
==================================================
- Hits                56504    56496       -8     
- Misses               4057     4065       +8     
Flag Coverage Δ
conformance 36.39% <ø> (+<0.01%) ⬆️
e2e 41.53% <ø> (-0.08%) ⬇️
integration 32.82% <ø> (+<0.01%) ⬆️
rust 0.00% <ø> (ø)
unit 92.29% <ø> (+<0.01%) ⬆️
unit-migrate 92.31% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit d3c85b5
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a5795b9da91ac00081088a1
😎 Deploy Preview https://deploy-preview-24068--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants