feat: add get_effective_rule API with full resolution chain - #668
Open
samjay8 wants to merge 1 commit into
Open
Conversation
|
@samjay8 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
freebuff-web
Bot
force-pushed
the
fix/issue-524
branch
2 times, most recently
from
September 3, 2026 08:40
a9c0015 to
3c9e981
Compare
…ta-Pay#524) Added get_effective_rule(merchant) that always returns a rule by following the full resolution chain: merchant-specific → global default → governance fee config → bootstrap fallback. Added two integration tests. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
freebuff-web
Bot
force-pushed
the
fix/issue-524
branch
from
September 3, 2026 08:58
3c9e981 to
53308f8
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.
Closes #524
Summary
get_default_ruleonly returns the stored global default — when no default is stored but governance provides a fee config, it saysNonewhile the write/payment paths actually resolve the governance rule. This divergence misleads frontends about config state.get_effective_rule(merchant)that always returns a rule by following the full resolution chain: merchant-specific → global default → governance fee config → bootstrap fallback.Scope
Does not modify existing
get_default_ruleorget_settlement_rule— purely additive. Does not touch write paths or payment logic.Testing
cargo check --workspace— passesget_effective_rule_resolves_governance_fees_when_no_default_stored— verifies governance fee config is resolved when no default rule is storedget_effective_rule_returns_merchant_rule_when_set— verifies merchant-specific rule takes prioritycargo test -p settlement_contract --libhas pre-existing compilation errors in upstream'sintegration_tests.rs(unrelated type mismatches from recent PRs fix: scope payment references per merchant (closes #493) #657–test: cover governance authorization paths #663). Source code and new tests compile cleanly.Files changed
settlement_contract/src/settlement.rs— addedget_effective_rulemethod with documentationsettlement_contract/src/tests/integration_tests.rs— added two integration tests