fix(gateway): PlatformConfig.from_dict now maps top-level platform keys into extra#10208
Open
rainow wants to merge 1 commit into
Open
fix(gateway): PlatformConfig.from_dict now maps top-level platform keys into extra#10208rainow wants to merge 1 commit into
rainow wants to merge 1 commit into
Conversation
Add handling for extra fields in from_dict method
Collaborator
|
Likely duplicate of #10453 — same root cause: PlatformConfig.from_dict() drops unknown top-level platform keys instead of folding into extra dict. Please coordinate or close one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add handling for extra fields in from_dict method to solve platforms.webhook.port doesn't work problem
What does this PR do?
Fix a silent config drop bug where top-level keys written under a platform
block in
config.yaml(e.g.platforms.webhook.port) were silently ignoredinstead of being forwarded to the adapter.
Problem
PlatformConfig.from_dict()only recognised a fixed set of known fields(
enabled,token,api_key,home_channel,reply_to_mode,extra).Any other key — such as
port,host,secret, orroutes— was silentlydropped when the YAML block was parsed.
Platform adapters (e.g.
WebhookAdapter) read their settings exclusively fromconfig.extra:So a user writing the natural top-level form:
…would never see the port change take effect. The only working form was the
nested
extra:block, which is not obvious from the documentation or theerror log (no warning is emitted):
The same silent drop affected every other platform adapter that reads
settings from
config.extra(e.g.api_server.host,api_server.key,webhook
secret,routes, etc.).Related Issue
#10206
Fixes #
Type of Change
Changes Made
In
PlatformConfig.from_dict()(gateway/config.py), after extracting theknown fields, iterate over the remaining keys and merge them into
extraviasetdefault(so an explicitextra:sub-dict always takes precedence):This means both config styles now work identically:
How to Test