Consolidate feature flags into a single registry#854
Open
mzihlmann wants to merge 2 commits into
Open
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
6efb869 to
a6c479c
Compare
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.
Fixes #852
The two flags in #852 declared their default at each read site, so the same flag could be read with conflicting defaults, which is what caused the panic and the self-contradictory deprecation warning. Rather than patch the individual call sites, this moves every
FF_KANIKO_*flag into a single registry inpkg/config. The environment is read once at startup into aFeatureFlagsstruct and call sites just readconfig.FF.X, so a flag's default has exactly one source of truth and the whole class of drift becomes impossible. Startup now logs which flags are active, warns when a default-on flag is explicitly disabled, and warns when an unknownFF_KANIKO_*variable is set; a completeness check guarantees every struct field is wired to a flag so a new flag cannot be left uninitialised. The assertion helper moved into its ownpkg/assertbecause the registry guard needs it andpkg/utilalready depends onpkg/config, so it could not live inutilwithout an import cycle.Supersedes #853, which patched the two call sites directly.