Skip to content

feat(server): Warn on unknown config keys#392

Draft
lcian wants to merge 2 commits intomainfrom
lcian/warn-unknown-config-keys
Draft

feat(server): Warn on unknown config keys#392
lcian wants to merge 2 commits intomainfrom
lcian/warn-unknown-config-keys

Conversation

@lcian
Copy link
Member

@lcian lcian commented Mar 19, 2026

Uses serde_ignored to detect unrecognized keys after merging the YAML
file and environment variables, emitting a warning per unknown key.

Since config is loaded before tracing is initialized, warnings are
buffered in a static log queue (BufferedLogsState) and flushed once
init_tracing completes. The log_or_buffer function handles the
routing: if tracing is ready it emits immediately, otherwise it queues.

This helps catch typos and stale keys that would otherwise be silently
ignored by Figment's default deserialization.

Use `serde_ignored` to detect unrecognized keys in the merged config
(YAML + env vars) and emit warnings at startup. Since config is loaded
before tracing is initialized, warnings are buffered in a static log
queue and flushed once `init_tracing` completes.
@lcian lcian requested a review from a team as a code owner March 19, 2026 11:27
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

tracing::Level::WARN,
format!("Ignoring unknown config key `{unknown_path}`"),
);
})?;
Copy link

Choose a reason for hiding this comment

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

False positive warnings from default storage config fields

Medium Severity

The serde_ignored check runs against the full merged figment Value, which includes deep-merged defaults. Since Config::default() uses StorageConfig::FileSystem(FileSystemConfig { path: "data" }), figment's deep merge retains storage.path even when a user switches to a different backend (e.g., S3, GCS, BigTable). The serde_ignored::deserialize then flags storage.path as an unknown key, producing a spurious warning on every non-filesystem deployment — which is essentially every production environment.

Additional Locations (1)
Fix in Cursor Fix in Web

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