fix(api): apply base_config defaults for boolean/int fields (#2121) - #2194
Open
Battleplus wants to merge 1 commit into
Open
fix(api): apply base_config defaults for boolean/int fields (#2121)#2194Battleplus wants to merge 1 commit into
Battleplus wants to merge 1 commit into
Conversation
…e#2121) The base_config merging logic checked `current_value is None or current_value == ""` to detect fields the client didn't send. This missed boolean defaults (False), integer defaults (0), and other non-None/non-empty defaults — so server-side config.yml values like `simulate_user: true` were silently ignored. Fix: preserve the raw client config dict before deserialization and check `key not in raw_dict` instead of comparing against the current value. Closes unclecode#2121
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.
Summary
Fixes #2121 — server-side base_config values (from config.yml) are silently ignored for boolean, integer, and other fields with non-None/non-empty defaults.
Root cause
api.py merged base_config defaults by checking
current_value is None or current_value == "". Since CrawlerRunConfig fields likesimulate_userdefault toFalse(not None, not ""), the server default was never applied.Fix
Preserve the raw client config dict before deserialization and check
key not in raw_dictinstead of comparing against the current value. This correctly detects whether the client explicitly sent a field, regardless of its default type.Files changed