fix(userflags): read the fee override from its own field - #1321
Merged
Conversation
`UserFlags.resolve()` passed `overrides.newCurrencyPurchaseAmount` to both `newCurrencyPurchaseAmount` and `newCurrencyFeeAmount`, so in the debug flag editor overriding the fee amount did nothing and overriding the purchase amount changed the fee too. `Overrides.newCurrencyFeeAmount` was already parsed from preferences and exposed as an editable field; it just had no consumer. Add ResolvedUserFlagsTest, which applies each of the ten overrides on its own against a server-flags fixture with distinct values and asserts it lands on its own resolved field and leaves the other nine untouched. A reflection check over `Overrides`' declared fields fails if a new override is added without a case, so the next mis-wiring of this kind shows up as a test failure.
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.
UserFlags.resolve()passedoverrides.newCurrencyPurchaseAmountto bothnewCurrencyPurchaseAmountandnewCurrencyFeeAmount. In the debug flag editor that meant overriding the new-currency fee amount did nothing, and overriding the new-currency purchase amount silently changed the fee amount too.Overrides.newCurrencyFeeAmountwas already declared, defaulted inOverrides.None, read from preferences viaprefs.readOverride(Field.NewCurrencyFeeAmount), and registered as an editable entry in the flags UI — it just had no consumer.The two fields use distinct preference keys, so no stored data needs migrating: a fee override set before this change was written correctly and simply ignored, and now takes effect.
Tests
The module had
ResolvedFlagTestandFieldOverrideTest, but nothing exercisedresolve()itself, which is how this got through.ResolvedUserFlagsTestdrives a table of all ten overridable fields against a server-flags fixture with distinct values:Overrides.None, every resolved field reports its server value — this also pins the server-side mapping, includingminimumHolderValue→minimumHolderAmountForLeaderboardand theOnRampProvider.Definedfiltering;Overrides' declared fields fails if a new override is added without a case, so the table can't fall behind.Reverting the one-word fix fails the table with
overriding newCurrencyPurchaseAmount also overrode newCurrencyFeeAmount.