Skip to content

fix(governance): scope DTF settings validation to changes - #1084

Merged
lcamargof merged 2 commits into
masterfrom
fix/dtf-settings-confirm-button
Aug 10, 2026
Merged

fix(governance): scope DTF settings validation to changes#1084
lcamargof merged 2 commits into
masterfrom
fix/dtf-settings-confirm-button

Conversation

@reserve-hermes

@reserve-hermes reserve-hermes commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bug Description

On the DTF Settings proposal page, Confirm & prepare proposal remained disabled after a valid change when an unchanged on-chain setting failed the form's deploy-time validation. The reported SMEL DTF reproduces this through fee-distribution rounding drift.

Root Cause

The confirm gate used formState.isValid, which validates every seeded setting. Existing on-chain values can fall outside the UI schema or lose precision when displayed, even though unchanged settings are omitted from proposal calldata. An unrelated valid change was therefore blocked by an error that would not be proposed.

Fix

  • Gate confirmation on validation errors that correspond to settings the user actually changed.
  • Keep changed invalid fields blocked, including cross-field role and revenue-distribution errors.
  • Remove the obsolete global form-validity atom/updater synchronization.
  • Add an end-to-end regression for an unrelated mandate change with unchanged distribution rounding drift.

How to Verify

  1. Open DTF Settings for a DTF whose current distribution does not round-trip exactly into the UI schema.
  2. Change only the mandate.
  3. Confirm that Confirm & prepare proposal enables.
  4. Enter an out-of-range TVL fee and confirm the button remains disabled.

Test Plan

  • Regression test failed before the fix and passes after it.
  • Changed-field/error mapping unit tests pass (27/27).
  • DTF Settings proposal flow and fee-bounds E2E tests pass (5/5).
  • Full TypeScript typecheck passes.
  • Full unit suite passes (878 tests).
  • E2E helper suite passes (72 tests).
  • Smoke suite passes (58 passed, 1 skipped).

Risk Assessment

Medium — this changes a governance proposal gate. Proposal calldata construction is unchanged, and validation still blocks errors tied to changed settings. Engineer review is required before merge.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed DTF Settings proposal confirmation being blocked by validation errors in unchanged settings.
    • Confirmation now reflects validation errors only for settings that are being modified.
    • Updated validation coverage across token, roles, revenue, auction, governance, and optimistic settings.
  • Tests
    • Added regression coverage for fee-recipient rounding differences, mandate updates, and proposal confirmation.
  • Documentation
    • Updated governance test maps and progress logs to reflect the new validation behavior.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@reserve-hermes, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a30c402-0d84-4131-be14-a93fe4820a3b

📥 Commits

Reviewing files that changed from the base of the PR and between 13a0655 and 0e3de80.

📒 Files selected for processing (6)
  • docs/wiki/progress.md
  • e2e/tests/flows/governance-propose-dtf-settings.spec.ts
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/components/changes/basics-changes.tsx
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/components/dtf-settings-proposal-overview.tsx
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/components/sections/propose-metadata.tsx
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/components/sections/propose-revenue-distribution.tsx
📝 Walkthrough

Walkthrough

DTF settings proposal validation now checks errors only for changed settings. Proposal confirmation uses this scoped validation state. Unit tests, E2E coverage, and project records document the behavior.

Changes

DTF Settings Validation

Layer / File(s) Summary
Relevant error evaluation
src/views/index-dtf/.../hooks/has-relevant-form-errors.ts, src/views/index-dtf/.../hooks/tests/use-has-relevant-form-errors.test.ts
Added grouped change types and validation logic for changed DTF settings. Tests cover field-level and cross-field errors, unchanged settings, and no-change proposals.
Proposal confirmation flow
src/views/index-dtf/.../hooks/use-has-relevant-form-errors.ts, src/views/index-dtf/.../components/dtf-settings-proposal-overview.tsx, src/views/index-dtf/.../atoms.ts, src/views/index-dtf/.../updater.tsx
Connected relevant form errors to proposal readiness and confirmation. Removed the aggregate form-validity atom and its updater integration.
E2E regression coverage
e2e/tests/flows/governance-propose-dtf-settings.spec.ts, e2e/TEST_MAP.md, docs/wiki/log.md, docs/wiki/progress.md
Added coverage for fee-recipient rounding with an unchanged invalid distribution and a mandate update. Updated the test map, log, and progress ledger.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProposalInstructions
  participant useHasRelevantFormErrors
  participant hasRelevantFormErrors
  participant ConfirmProposalButton
  ProposalInstructions->>useHasRelevantFormErrors: provide form errors
  useHasRelevantFormErrors->>hasRelevantFormErrors: provide errors and changed settings
  hasRelevantFormErrors-->>ProposalInstructions: return relevant error state
  ProposalInstructions->>ConfirmProposalButton: provide canProceed
  ConfirmProposalButton-->>ProposalInstructions: block or allow confirmation
Loading

Possibly related PRs

Suggested reviewers: lcamargof

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: limiting DTF settings validation to user-modified settings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dtf-settings-confirm-button

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/tests/flows/governance-propose-dtf-settings.spec.ts`:
- Around line 144-155: Replace the translated-copy selectors in the governance
flow with kebab-case data-testid selectors: update the assertions for “Remaining
allocation: 22.23%” and “Basics Update”, and the mandate field lookup around
snapshot.mandate, using the corresponding test IDs exposed by those elements
while preserving the existing interactions and assertions.

In
`@src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/components/dtf-settings-proposal-overview.tsx`:
- Around line 23-37: Update ConfirmProposalButton so the button remains enabled
when isProposalConfirmed is true, even if canProceed is false, allowing the user
to unconfirm and edit the proposal. Preserve the existing disabled state for
unconfirmed proposals that cannot proceed and keep handleConfirm’s transition
logic unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fd5ed738-60c8-4980-9f52-ce2c8c229b96

📥 Commits

Reviewing files that changed from the base of the PR and between 6854a37 and 13a0655.

📒 Files selected for processing (10)
  • docs/wiki/log.md
  • docs/wiki/progress.md
  • e2e/TEST_MAP.md
  • e2e/tests/flows/governance-propose-dtf-settings.spec.ts
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/atoms.ts
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/components/dtf-settings-proposal-overview.tsx
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/hooks/has-relevant-form-errors.ts
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/hooks/tests/use-has-relevant-form-errors.test.ts
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/hooks/use-has-relevant-form-errors.ts
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/updater.tsx
💤 Files with no reviewable changes (1)
  • src/views/index-dtf/governance/views/propose/views/propose-dtf-settings/atoms.ts

Comment thread e2e/tests/flows/governance-propose-dtf-settings.spec.ts Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying register-app with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0e3de80
Status: ✅  Deploy successful!
Preview URL: https://de55db5f.register-app.pages.dev
Branch Preview URL: https://fix-dtf-settings-confirm-but.register-app.pages.dev

View logs

@lcamargof lcamargof left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lcamargof
lcamargof merged commit 48d2357 into master Aug 10, 2026
5 checks passed
@lcamargof
lcamargof deleted the fix/dtf-settings-confirm-button branch August 10, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants