Skip to content

fix(userflags): read the fee override from its own field - #1321

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/userflags-fee-override
Aug 24, 2026
Merged

fix(userflags): read the fee override from its own field#1321
bmc08gt merged 1 commit into
code/cashfrom
fix/userflags-fee-override

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

UserFlags.resolve() passed overrides.newCurrencyPurchaseAmount to both newCurrencyPurchaseAmount and newCurrencyFeeAmount. 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.newCurrencyFeeAmount was already declared, defaulted in Overrides.None, read from preferences via prefs.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 ResolvedFlagTest and FieldOverrideTest, but nothing exercised resolve() itself, which is how this got through. ResolvedUserFlagsTest drives a table of all ten overridable fields against a server-flags fixture with distinct values:

  • each override applied on its own lands on its own resolved field and leaves the other nine unoverridden and at their server value;
  • all ten applied together each land on their own field;
  • with Overrides.None, every resolved field reports its server value — this also pins the server-side mapping, including minimumHolderValueminimumHolderAmountForLeaderboard and the OnRampProvider.Defined filtering;
  • a reflection check over 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.

`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.
@github-actions github-actions Bot added the type: fix Bug fix label Aug 24, 2026
@bmc08gt
bmc08gt merged commit 19e1964 into code/cash Aug 24, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the fix/userflags-fee-override branch August 27, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant