8000 fix: MigrateTo26_6_0 should only add organization step to built-in br… by maeventer · Pull Request #47991 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

fix: MigrateTo26_6_0 should only add organization step to built-in br… - #47991

Merged
pedroigor merged 4 commits into
keycloak:mainfrom
maeventer:fix/migration-26-6-0-custom-browser-flow
Apr 14, 2026
Merged

pedroigor merged 4 commits into
keycloak:mainfrom
maeventer:fix/migration-26-6-0-custom-browser-flow

Conversation

@maeventer
@maeventer maeventer commented Apr 13, 2026 •
Copy link
Copy Markdown
Contributor

Closes #47908

This fix prevents the issue from occurring on fresh migrations, but what about realms that have already been incorrectly migrated by 26.6.0?

Should we add a follow-up migration (e.g. MigrateTo26_6_1 or similar) that detects and cleans up the broken state — specifically, removing the injected built-in Organization sub-flow from non-built-in browser flows? Or is the expectation that
affected users fix this manually?

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.model.session.UserSessionProviderModelTest#testStreamsMarshalling

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at java.management@25.0.2/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
...

Report flaky test

@maeventer
maeventer force-pushed the fix/migration-26-6-0-custom-browser-flow branch 2 times, most recently from d080a0b to 1190791 Compare April 13, 2026 13:41
@pedroigor
Copy link
Copy Markdown
Contributor

@maeventer Thanks for the fix. I would expect users to manually fix this because it would be hard to fix custom browser flows without making this worse.

@pedroigor
Copy link
Copy Markdown
Contributor

@maeventer, I will add an upgrade note to warn people about how to fix.

@sonOfRa
sonOfRa commented Apr 13, 2026
Copy link
Copy Markdown
Contributor

@pedroigor There's potentially another level here: If I had a realm with a bound flow, the old migration will not have updated that realm's default browser flow with the alias "browser", but only the bound flow. If they then switch to the built-in flow (which they can't edit through API), they won't have the expected state in the "browser" flow, and future migrations that may expect all realms to have the same structure won't find that structure, and fail then.

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.model.session.UserSessionProviderModelTest#testStreamsMarshalling

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at java.management@25.0.2/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
...

Report flaky test

ahus1
ahus1 previously requested changes Apr 13, 2026
@ahus1 ahus1 left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume this migration needs to be renamed to ‎MigrateTo26_6_1.java‎ and scheduled for that patch release as otherwise it will not re-run on any installation that already update to 26.6.0

@sonOfRa
sonOfRa commented Apr 13, 2026
Copy link
Copy Markdown
Contributor

Is renaming it enough, or should we keep it around and copy it? Because if it's only renamed, in addition to "fixing" the non-renamed ones, everyone who has not yet upgraded to 26.6.0, but does upgrade to 26.6.1, will still get their custom bound flow broken by the existing migration?

@ahus1
ahus1 commented Apr 13, 2026
Copy link
Copy Markdown
Member

Is renaming it enough, or should we keep it around and copy it? Because if it's only renamed, in addition to "fixing" the non-renamed ones, everyone who has not yet upgraded to 26.6.0, but does upgrade to 26.6.1, will still get their custom bound flow broken by the existing migration?

Maybe "renaming" wasn't a good word. Let me describe it again:

Once the migration is fixed, and its VERSION is changed to 26.6.1, the following should happen:

  • Everyone who upgrades to from 26.6.0 to 26.6.1 will have their default flow updated. If they want to remove it from their custom flow where it was added in 26.6.0, they need to remove it manually, as we don't want to introduce any more problems.
  • Everyone who upgrades from 26.5.x or earlier to 26.6.1 will have only their default flow updated.

Please let me know if you disagree.

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.model.singleUseObject.SingleUseObjectModelTest#testCluster

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at java.management@25.0.2/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
...

Report flaky test

@ahus1
ahus1 force-pushed the fix/migration-26-6-0-custom-browser-flow branch from 07b54a8 to 3354d52 Compare April 14, 2026 06:52
@ahus1
ahus1 dismissed their stale review April 14, 2026 06:53

should be resolved

@ahus1
ahus1 requested a review from pedroigor April 14, 2026 06:53
@ahus1
ahus1 commented Apr 14, 2026
Copy link
Copy Markdown
Member

@pedroigor - please review my latest changes:

  • Renaming the file is not sufficient, you'll also need to change the VERSION in the class to see the expected behavior.
  • I've revised the migration guide, please have a look. This is not a breaking change, but a manual migration step (something that we didn't see earlier, so it doesn't fit the template). It now also states clearly that you are not affected when upgrading to 26.6.1 directly without running 26.6.0 first.

@maeventer
Copy link
Copy Markdown
Contributor Author

Is renaming it enough, or should we keep it around and copy it? Because if it's only renamed, in addition to "fixing" the non-renamed ones, everyone who has not yet upgraded to 26.6.0, but does upgrade to 26.6.1, will still get their custom bound flow broken by the existing migration?

Maybe "renaming" wasn't a good word. Let me describe it again:

Once the migration is fixed, and its VERSION is changed to 26.6.1, the following should happen:

  • Everyone who upgrades to from 26.6.0 to 26.6.1 will have their default flow updated. If they want to remove it from their custom flow where it was added in 26.6.0, they need to remove it manually, as we don't want to introduce any more problems.
  • Everyone who upgrades from 26.5.x or earlier to 26.6.1 will have only their default flow updated.

Please let me know if you disagree.

The only thing is that in the case you upgraded to 26.6.0 the added executions in your custom browser flow will have set builtIn to true what makes it quite hard to simply delete it via the admin api, maybe it's enough then to copy the own flow again and manipulate it there?

@sonOfRa
sonOfRa commented Apr 14, 2026
Copy link
Copy Markdown
Contributor

So it would require users to set the organization subflows/executions to not built-in on the database level, and then delete it via admin console/admin API, because deleting a flow that has built-in subflows/executions via the admin console/API is not supported. Maybe it's worth adding that part to the change note, so users aren't surprised by it?

@martin-kanis
Copy link
Copy Markdown
Member

I think you are right about the problem with the removal of a flow with builtIn=true. But there is a possible workaround with PUT /authentication/flows/{id} endpoint. This endpoint doesn't check builtIn flag so you can pass the affected flow representation but with builtIn=false to update it and the you should be able to remove the execution.

WDYT? Does it sound simpler and less messy than touching the DB or creating a new copy flows, updating all the connected bit and pieces and leaving some garbage flows around that cannot be deleted?

@pedroigor
Copy link
Copy Markdown
Contributor

WDYT? Does it sound simpler and less messy than touching the DB or creating a new copy flows, updating all the connected bit and pieces and leaving some garbage flows around that cannot be deleted?

Would it be an option to allow deleting sub-flows if a flow is not a built-in flow?

@pedroigor
Copy link
Copy Markdown
Contributor

Thanks, @ahus1. I think the remaining concern is how people can now (easily) update their custom flows?

@ahus1
ahus1 commented Apr 14, 2026
Copy link
Copy Markdown
Member

I think the remaining concern is how people can now (easily) update their custom flows?

@pedroigor - yes, I think so although I'm not so familiar with those flows.

Can we clean up the existing custom flows to not contain the build-in marker? Are sub-flows shared between flows? I have no knowledge in that area, sorry.

Waiting for your guidance how how to proceed.

@pedroigor
pedroigor commented Apr 14, 2026 •
Copy link
Copy Markdown
Contributor

Can we clean up the existing custom flows to not contain the build-in marker? Are sub-flows shared between flows? I have no knowledge in that area, sorry.

Sub-flows are not shared. We are adding a subflow to the browser flow, basically.

@pedroigor
pedroigor force-pushed the fix/migration-26-6-0-custom-browser-flow branch from 3354d52 to 069f6cd Compare April 14, 2026 12:02
@pedroigor
Copy link
Copy Markdown
Contributor

@maeventer @sonOfRa @ahus1 @martin-kanis Updated the PR to allow removing sub-flows and executions whenever the top-level flow (authentication flow) is not a built-in flow. It should be enough to allow people to remove the organization (subflow) entirely from their custom flows.

@maeventer
Copy link
Copy Markdown
Contributor Author

@maeventer @sonOfRa @ahus1 @martin-kanis Updated the PR to allow removing sub-flows and executions whenever the top-level flow (authentication flow) is not a built-in flow. It should be enough to allow people to remove the organization (subflow) entirely from their custom flows.

@pedroigor thats the best solution in my point of view, thank you very much

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.model.singleUseObject.SingleUseObjectModelTest#testCluster

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at java.management@25.0.2/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
...

Report flaky test

maeventer and others added 4 commits April 14, 2026 15:48
…owser flow

Closes keycloak#47908

Signed-off-by: maeberl <markus.eberl@eventim.de>
Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
…n flow

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
@ahus1
ahus1 force-pushed the fix/migration-26-6-0-custom-browser-flow branch from 3ab5817 to 0f67543 Compare April 14, 2026 13:53
@ahus1
ahus1 commented Apr 14, 2026
Copy link
Copy Markdown
Member

Rebased due to release notes conflict.

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.model.singleUseObject.SingleUseObjectModelTest#testCluster

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at java.management@25.0.2/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
...

Report flaky test

@ahus1 ahus1 self-assigned this Apr 14, 2026
@ahus1
ahus1 commented Apr 14, 2026
Copy link
Copy Markdown
Member

@pedroigor - looks good for me now, but I needed to resolve some conflicts with the release notes. CI also seems to be unstable. Can you continue to watch it? Once it looks good to you, please go ahead and merge.

@mposolda mposolda left a comment
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.

LGTM. I only reviewed, but did not tested, so relying also on the review by @pedroigor and @ahus1

@pedroigor
pedroigor merged commit ef730c6 into keycloak:main Apr 14, 2026
93 of 95 checks passed
@pedroigor
Copy link
Copy Markdown
Contributor

Thanks, @maeventer.

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.

MigrateTo26_6_0 modifies custom browser flows, breaking existing realm authentication

6 participants

0