Skip to content

feat(proposals): use selfDescribingAction from governance canister instead of nns-dapp payload#7742

Merged
yhabib merged 8 commits intomainfrom
nss1-4334/proposals-action
Feb 27, 2026
Merged

feat(proposals): use selfDescribingAction from governance canister instead of nns-dapp payload#7742
yhabib merged 8 commits intomainfrom
nss1-4334/proposals-action

Conversation

@yhabib
Copy link
Copy Markdown
Contributor

@yhabib yhabib commented Feb 24, 2026

Motivation

The governance canister now exposes a selfDescribingAction field on proposals via a returnSelfDescribingAction flag in listProposals. This field contains the decoded proposal action data (type name, description, and value) directly in the response. Before, we had to fetch and decode the proposal payload separately through the nns-dapp canister's get_proposal_payload endpoint, which internally used the rs/proposals crate to parse raw Candid binary into JSON via idl2json. Since the governance canister now does this translation itself, the nns-dapp canister endpoint and all the frontend code around it become redundant.

Note that this PR only addresses /frontend; a follow-up will clean up /rs.

Changes

  • Added returnSelfDescribingAction: true to both queryProposals and queryProposal API calls.
  • Removed queryProposalPayload from the API layer and loadProposalPayload from
    the service layer.
  • Removed proposalPayloadsStore and related types.
  • Removed getProposalPayload method from NNSDappCanister and its error classes (ProposalPayloadNotFoundError, ProposalPayloadTooLargeError, UnknownProposalPayloadError).
  • Deleted NnsProposalProposerPayloadEntry.svelte and ProposalProposerPayloadEntry.svelte components.
  • Updated NnsProposalProposerActionsEntry.svelte to render action data from selfDescribingAction.value using a new selfDescribingValueToJson utility.
  • Simplified mapProposalType to derive the proposal type label and description directly from selfDescribingAction.typeName and typeDescription.
  • Added selfDescribingValueToJson utility that converts the SelfDescribingValue Candid tagged union to a plain JS object, with alphabetical key sorting to match the previous behavior.
  • Removed i18n action and nns function label translations that are no longer needed (actions, actions_description, nns_functions, nns_functions_description).

Tests

  • Updated tests.

Todos

  • Accessibility (a11y) – any impact?
  • Changelog – is it needed?

Comment thread frontend/src/lib/components/proposal-detail/NnsProposal.svelte
@yhabib yhabib changed the title DRAFT: feat(proposals): use selfDescribingAction from governance canister instead of nns-dapp payload feat(proposals): use selfDescribingAction from governance canister instead of nns-dapp payload Feb 24, 2026
@yhabib
Copy link
Copy Markdown
Contributor Author

yhabib commented Feb 24, 2026

Blocked by dfinity/snsdemo#582 as we need a new version of the replica with an updated governance canister.

yhabib added a commit to dfinity/dfx-extensions that referenced this pull request Feb 25, 2026
# Motivation

https://github.com/dfinity/snsdemo uses dfx-extensions to set up a local replica. This is utilized by the [nns-dapp](https://github.com/dfinity/nns-dapp/). The pull request at dfinity/nns-dapp#7742 is blocked by end-to-end tests that depend on snsdemo, as the version of the Governance canister does not include the new API.

# Changes

- Updated `NNS_SNS_REPLICA_REV` to the latest version to support `return_self_describing_action` in the Governance canister.
- Updated dependencies.
- Updated ledger init to fulfill dfinity/ic@88516cb
@yhabib yhabib force-pushed the nss1-4334/proposals-action branch 3 times, most recently from 1ad46c0 to 881861d Compare February 27, 2026 07:34
@yhabib yhabib requested a review from Copilot February 27, 2026 07:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the frontend proposals flow to rely on the governance canister’s selfDescribingAction (requested via returnSelfDescribingAction: true) instead of fetching/decoding proposal payloads via the nns-dapp canister, removing the now-redundant payload API/store/components and associated i18n labels.

Changes:

  • Request selfDescribingAction in queryProposals and queryProposal, and remove the proposal payload fetch path (API/service/canister method/errors/store).
  • Render proposer “payload/action” details from selfDescribingAction.value via the new selfDescribingValueToJson utility.
  • Remove action / NNS-function i18n label tables and update unit/e2e tests accordingly.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/lib/api/proposals.api.ts Adds returnSelfDescribingAction: true; removes queryProposalPayload API.
frontend/src/lib/services/public/proposals.services.ts Removes loadProposalPayload service logic and related error handling/toasts.
frontend/src/lib/stores/proposals.store.ts Removes proposalPayloadsStore and related payload types.
frontend/src/lib/utils/proposals.utils.ts Derives proposal type from selfDescribingAction; adds selfDescribingValueToJson conversion utility.
frontend/src/lib/components/proposal-detail/NnsProposalProposerActionsEntry.svelte Switches proposer action/payload rendering to selfDescribingAction.value and labels section as “Payload”.
frontend/src/lib/components/proposal-detail/NnsProposal.svelte Removes proposer payload entry component from the proposal detail page.
frontend/src/lib/components/proposal-detail/ProposalProposerPayloadEntry.svelte Deleted (payload entry no longer needed).
frontend/src/lib/components/proposal-detail/NnsProposalProposerPayloadEntry.svelte Deleted (nns-dapp payload fetch UI no longer needed).
frontend/src/lib/canisters/nns-dapp/nns-dapp.canister.ts Removes getProposalPayload method and related imports.
frontend/src/lib/canisters/nns-dapp/nns-dapp.errors.ts Removes proposal-payload-specific error classes.
frontend/src/lib/i18n/en.json Removes proposal-payload-related error strings.
frontend/src/lib/i18n/en.governance.json Removes actions* and nns_functions* label/description tables.
frontend/src/lib/types/i18n.d.ts Removes corresponding i18n type definitions for deleted keys.
frontend/src/tests/lib/api/proposals.api.spec.ts Updates API expectations; removes payload API tests.
frontend/src/tests/lib/services/public/proposals.services.spec.ts Removes payload service tests and store assertions.
frontend/src/tests/lib/stores/proposals.store.spec.ts Removes proposalPayloadsStore tests.
frontend/src/tests/lib/canisters/nns-dapp.canister.spec.ts Removes getProposalPayload method tests and payload error expectations.
frontend/src/tests/lib/utils/proposals.utils.spec.ts Updates type mapping tests; adds selfDescribingValueToJson unit tests.
frontend/src/tests/lib/components/proposals/NnsProposalCard.spec.ts Updates card heading expectations to use selfDescribingAction-derived type.
frontend/src/tests/lib/components/proposal-detail/ProjectSystemInfoSection.spec.ts Updates system info type rendering expectations to use selfDescribingAction.
frontend/src/tests/lib/components/proposal-detail/NnsProposalProposerActionsEntry.spec.ts Updates proposer actions/payload rendering tests to use selfDescribingAction.value.
frontend/src/tests/lib/components/proposal-detail/NnsProposal.spec.ts Removes proposer payload entry assertion and payload API mocking.
frontend/src/tests/lib/components/proposal-detail/ProposalProposerPayloadEntry.spec.ts Deleted (component removed).
frontend/src/tests/lib/components/proposal-detail/NnsProposalProposerPayloadEntry.spec.ts Deleted (component removed).
frontend/src/tests/lib/services/vote-registration.services.spec.ts Updates proposal type label expectation (no longer i18n-driven).
frontend/src/tests/mocks/proposal.mock.ts Adds selfDescribingAction to proposal mock data.
frontend/src/tests/mocks/proposals.store.mock.ts Adds selfDescribingAction to proposals store mock data.
frontend/src/tests/e2e/proposals.spec.ts Updates E2E expectation for proposer actions section title (“Payload”).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/lib/utils/proposals.utils.ts
@yhabib yhabib force-pushed the nss1-4334/proposals-action branch from 881861d to 9ecc1b5 Compare February 27, 2026 08:10
@yhabib yhabib marked this pull request as ready for review February 27, 2026 08:10
@yhabib yhabib requested a review from a team as a code owner February 27, 2026 08:10
@yhabib yhabib added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit 74cd3d5 Feb 27, 2026
34 checks passed
@yhabib yhabib deleted the nss1-4334/proposals-action branch February 27, 2026 13:20
github-merge-queue Bot pushed a commit that referenced this pull request Feb 27, 2026
# Motivation

The frontend no longer calls `get_proposal_payload` after switching to
`selfDescribingAction` in #7742. This is the first step toward removing
the `proposals` crate entirely.

# Changes

- Removed the `get_proposal_payload` update endpoint from the backend
canister.
- Removed the `proposals` crate dependency from the backend
`Cargo.toml`.
- Removed `GetProposalPayloadResponse` type and `get_proposal_payload`
method from the Candid interface (backend and frontend copies).
- Removed the `get_proposal_payload` entry from canister export lists
(production and test).
- Removed the `test-proposal-payload` script and its CI step in the
build workflow.
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.

3 participants