Skip to content

Fix definitions import of federation-upstream-set parameters - #2536

Merged
kickster97 merged 4 commits into
mainfrom
fix-definitions-import-upstream-set
Oct 27, 2026
Merged

kickster97 merged 4 commits into
mainfrom
fix-definitions-import-upstream-set

Conversation

@weistrand

@weistrand weistrand commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

POST /api/definitions fails with 400 "Cast from Array(JSON::Any) to Hash(K, V) failed" when the body contains a federation-upstream-set parameter, so the broker can't import its own export. Queues, exchanges, bindings and policies from the same body are already applied when it fails, which leaves a half-imported state. The code is the same in 2.10.2.

What

The parameter import cast every value to a hash before it looked at the component, but a set's value is an array. Only vhost-limits and operator_policy need a hash, so the cast now happens in those two branches. Other components pass the raw JSON value to Parameter as before.

An import is still not all-or-nothing across sections (queues and exchanges are applied before parameters are parsed). That's a separate change.

@claude

claude Bot commented Oct 23, 2026

Copy link
Copy Markdown

No issues found.

@weistrand
weistrand marked this pull request as ready for review October 23, 2026 11:47
@weistrand weistrand added this to the 2.11.0 milestone Oct 23, 2026
Comment thread src/lavinmq/definitions.cr Resolved
Comment thread src/lavinmq/definitions.cr Resolved
@weistrand
weistrand requested a review from kickster97 October 27, 2026 07:26
@kickster97 kickster97 self-assigned this Oct 27, 2026
@kickster97
kickster97 merged commit 0b740c2 into main Oct 27, 2026
24 checks passed
@kickster97
kickster97 deleted the fix-definitions-import-upstream-set branch October 27, 2026 09:15
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.

2 participants