Skip to content

Treat undefined config options as silent fallback in Config::getOption#140

Open
BinqAdams wants to merge 1 commit intoNVIDIAGameWorks:mainfrom
BinqAdams:fix/config-getoption-silent-fallback
Open

Treat undefined config options as silent fallback in Config::getOption#140
BinqAdams wants to merge 1 commit intoNVIDIAGameWorks:mainfrom
BinqAdams:fix/config-getoption-silent-fallback

Conversation

@BinqAdams
Copy link
Copy Markdown
Contributor

Summary

Stop logging "Option failed to parse" when a bridge config option is simply not defined. Real parse failures (value present but malformed) still warn.

Motivation

Config::getOption<T> (in bridge/src/util/config/config.h) previously logged Logger::warn("Option failed to parse: <name>") whenever the option wasn't defined in any config file — the empty looked-up value would fall through to parseOptionValue, which fails on empty input. Several options are read on hot paths (e.g. client.optimizedDynamicLock fires from the LockableBuffer ctor); a per-call warning floods the log at high frequency under heavy buffer creation.

An empty looked-up value semantically means the option is undefined, which is exactly what the fallback parameter is for — the explicit contract for absence.

What Changed

bridge/src/util/config/config.h: in Config::getOption<T>, short-circuit to the supplied fallback when getOptionValue(option) returns an empty string. Real parse failures (non-empty value that fails parseOptionValue) still emit the Logger::warn as before.

Net diff: bridge/src/util/config/config.h only, +5.

Testing

Verified that:

  • Options not defined in any config now silently use their fallback (no log emission).
  • Options defined with valid values continue to parse correctly.
  • Options defined with malformed values still emit the parse-failure warning.

The behavioral change is limited to the absent-option case, which previously logged but otherwise returned the same fallback value.

Config::getOption<T> previously logged "Option failed to parse: <name>"
whenever the option wasn't defined in any config file - the empty
value would fall through to parseOptionValue, which fails on empty
input. Several options are read on hot paths (e.g.
client.optimizedDynamicLock fires from the LockableBuffer ctor); a
warning per call floods the log at high frequency under heavy buffer
creation.

An empty looked-up value semantically means the option is undefined,
which is exactly what the fallback parameter is for - the contract
for absence. Use it silently. Real parse failures (value present but
malformed) still emit the warning as before.
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.

1 participant