Skip to content

refactor(governance): derive SelfDescribing for ManageNeuron nested types#9045

Merged
jasonz-dfinity merged 2 commits intomasterfrom
jason/misc-self-describing-more-derive
Mar 9, 2026
Merged

refactor(governance): derive SelfDescribing for ManageNeuron nested types#9045
jasonz-dfinity merged 2 commits intomasterfrom
jason/misc-self-describing-more-derive

Conversation

@jasonz-dfinity
Copy link
Contributor

Why

The From<T> for SelfDescribingValue impls for ManageNeuron nested types
were hand-written boilerplate that simply listed each field. The
SelfDescribing derive macro can generate these automatically.

What

  • Added SelfDescribing derive to 12 ManageNeuron nested types
    (e.g., IncreaseDissolveDelay, Split, Spawn, Merge, etc.) and
    the NeuronIdOrSubaccount oneof in the protobuf generator config.
  • Removed the corresponding hand-written From<T> for SelfDescribingValue
    impls (~130 lines of boilerplate).
  • Updated test imports accordingly.

Testing

Existing unit tests cover the removed impls and verify the derive-generated
versions produce equivalent output.

@jasonz-dfinity jasonz-dfinity requested a review from a team as a code owner February 25, 2026 22:58
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@jasonz-dfinity jasonz-dfinity force-pushed the jason/misc-self-describing-more-derive branch from b7428a8 to 765c566 Compare February 25, 2026 23:03
@jasonz-dfinity jasonz-dfinity enabled auto-merge March 6, 2026 18:29
@jasonz-dfinity jasonz-dfinity force-pushed the jason/misc-self-describing-more-derive branch 2 times, most recently from f339da6 to a007bea Compare March 9, 2026 18:33
@jasonz-dfinity jasonz-dfinity force-pushed the jason/misc-self-describing-more-derive branch from a007bea to a1675ed Compare March 9, 2026 19:16
@jasonz-dfinity jasonz-dfinity added this pull request to the merge queue Mar 9, 2026
Merged via the queue into master with commit c6108f3 Mar 9, 2026
39 checks passed
@jasonz-dfinity jasonz-dfinity deleted the jason/misc-self-describing-more-derive branch March 9, 2026 19:59
shilingwang pushed a commit that referenced this pull request Mar 10, 2026
…ypes (#9045)

## Why

The `From<T> for SelfDescribingValue` impls for `ManageNeuron` nested
types
were hand-written boilerplate that simply listed each field. The
`SelfDescribing` derive macro can generate these automatically.

## What

- Added `SelfDescribing` derive to 12 `ManageNeuron` nested types
  (e.g., `IncreaseDissolveDelay`, `Split`, `Spawn`, `Merge`, etc.) and
  the `NeuronIdOrSubaccount` oneof in the protobuf generator config.
- Removed the corresponding hand-written `From<T> for
SelfDescribingValue`
  impls (~130 lines of boilerplate).
- Updated test imports accordingly.

## Testing

Existing unit tests cover the removed impls and verify the
derive-generated
versions produce equivalent output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants