fix(components): only treat gating args as evidence of configuration - #4746
Open
mgazza wants to merge 1 commit into
Open
fix(components): only treat gating args as evidence of configuration#4746mgazza wants to merge 1 commit into
mgazza wants to merge 1 commit into
Conversation
Follow-up to #4737, which shipped a noise guard with two flaws. The guard counted every arg a component declares. gecloud_data declares the general-purpose days_previous, which the shipped apps.yaml sets for everyone, so any user without ge_cloud_key - i.e. every non-GivEnergy user on a default config - now sees this on every startup: Warn: Skipping GivEnergy Cloud Data interface, missing required configuration: ge_cloud_data, ge_cloud_key That is exactly the noise #4737 set out to avoid, aimed at the whole user base. Restrict the check to the args that actually gate activation (required, required_true, required_or). Second, the guard tested truthiness, so a setting supplied as an empty string, 0 or False counted as absent and stayed silent. That is precisely when the warning earns its place - a secret or environment substitution that resolved to an empty string still skips the component, and the user needs telling. Test key presence instead. Verified against the shipped apps.yaml: no component warns on a default config, while a partly configured one still does. The test now uses an empty credential for the warning case, covering the truthiness fix, and adds an unrelated shared setting to the silent case, covering the gating fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Follow-up to #4737, which I authored — a review after it merged found two flaws in the noise guard. The first is user-visible on a default config, so worth landing promptly.
1. Every non-GivEnergy user now gets a spurious warning on every startup
The guard counted every arg a component declares:
gecloud_datadeclares the general-purposedays_previous(components.py:172), and the shippedapps.yaml:487setsdays_previous: [7]for everyone. So any user withoutge_cloud_key— i.e. every non-GivEnergy user on a stock config — now sees this on every startup:They never configured GivEnergy Cloud. That is exactly the noise #4737 set out to avoid, aimed at the whole user base — my mistake in the original PR.
Fix: restrict the check to the args that actually gate activation (
required,required_true,required_or). Incidental shared settings no longer imply the user was setting the component up.2. An empty credential stays silent, which is the case that most needs the warning
The guard tested truthiness, so a setting supplied as
"",0orFalsecounted as absent:The
required_orgate rejects the empty key, so Solis is skipped — and the guard also considers it unconfigured, so nothing is logged. A secret or environment substitution that unexpectedly resolves to an empty string is precisely when a user needs telling.Fix: test key presence rather than truthiness.
Verification
Simulated every component in
COMPONENT_LISTagainst the shippedapps.yaml:gecloud_datawarns. After: no component warns on a default config.missing required configuration: <key>.Tests
The existing test is updated to cover both fixes rather than adding a new one:
days_previous), which would have failed under the old guardsolis_api_key: ""), which would have been silent under the old guard