Skip to content

flows: use the brand's default background in flow_info - #28193

Open
pcbeingused33 wants to merge 3 commits into
goauthentik:mainfrom
pcbeingused33:fix-flow-info-brand-background
Open

pcbeingused33 wants to merge 3 commits into
goauthentik:mainfrom
pcbeingused33:fix-flow-info-brand-background

Conversation

@pcbeingused33

@pcbeingused33 pcbeingused33 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #28189

Details

What does this PR change?

The flow executor uses the brand's default flow background and themed variants when a flow has no background of its own. It passes the brand explicitly to keep uploaded-file URLs app-relative.

FlowSerializer declares background_url as a read-only string field. This keeps the existing OpenAPI type and description and lets REST Framework call the same model method when serializing a flow.

Why is this change needed?

Since #21553, the flow executor stopped passing the request to the background helpers, so the helpers could no longer find the brand.

The new Brand parameter is imported only for type checking to avoid a circular import. With a generic read-only serializer field, drf-spectacular inspects all of the model method's annotations at runtime and raises NameError when it tries to resolve Brand. Declaring the field type directly lets drf-spectacular generate the schema without inspecting the method signature.

How was this tested?

  • Generated OpenAPI locally. The original PR head raised NameError. The follow-up generated the schema successfully, and the background_url definitions for Flow and FlowSet matched the checked-in schema.
  • The schema and flow view suites went from 2 failed and 45 passed to 47 passed with local PostgreSQL and Kerberos dependencies stubbed. The flow view suite covers the brand fallback for uploaded and themed backgrounds.
  • Ruff and Black passed for the changed serializer.

Linked issues

closes #28189

AI disclosure: Claude Code assisted with the original analysis, implementation, tests, and description. Codex assisted with diagnosing the CI failure, implementing the follow-up, validating it locally, and updating this draft.

Since goauthentik#21553 the flow executor no longer passed the request to
Flow.background_url(), which is the only way the brand was reached, so
flows without their own background always returned the stock image.
Pass the brand explicitly and keep the URLs app-relative.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pcbeingused33
pcbeingused33 requested a review from a team as a code owner November 26, 2026 13:12
@netlify

netlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit cabbb88
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6b0f89300fec48074976741c
😎 Deploy Preview https://deploy-preview-28193--authentik-docs.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.

@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.77%. Comparing base (3931139) to head (cabbb88).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28193      +/-   ##
==========================================
- Coverage   93.80%   93.77%   -0.03%     
==========================================
  Files        1262     1262              
  Lines       91705    91726      +21     
  Branches     5752     5752              
==========================================
- Hits        86023    86019       -4     
- Misses       5596     5621      +25     
  Partials       86       86              
Flag Coverage Δ
conformance 29.19% <30.76%> (-0.01%) ⬇️
e2e 33.63% <30.76%> (-0.01%) ⬇️
integration 26.55% <3.84%> (-0.31%) ⬇️
rust 62.37% <ø> (ø)
unit 94.99% <100.00%> (+<0.01%) ⬆️
unit-migrate 95.00% <100.00%> (+<0.01%) ⬆️

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.

Comment thread authentik/flows/models.py
self,
request: HttpRequest | None = None,
use_cache: bool = True,
brand: "Brand | None" = None, # noqa: UP037

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only noqa: UP037 in our whole system, and it should not be necessary. We target python 3.14 and above, and those later versions are annotations by default; did you build this with a deprecated version of python?

Resolve the flow_info conflict by passing the brand into the background helpers and keeping continuous_login_hold from main.

This branch has not been deployed

No deployments
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.

Flow executor ignores the brand's default flow background since 2026.5

2 participants