Skip to content

Completed node output destructuring implementation#3806

Open
JustJ01 wants to merge 6 commits intoGraphiteEditor:masterfrom
JustJ01:finish-deconstruct-outputs
Open

Completed node output destructuring implementation#3806
JustJ01 wants to merge 6 commits intoGraphiteEditor:masterfrom
JustJ01:finish-deconstruct-outputs

Conversation

@JustJ01
Copy link
Contributor

@JustJ01 JustJ01 commented Feb 22, 2026

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @JustJ01, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request finalizes the implementation of node output destructuring, a feature that significantly enhances the granularity and flexibility of node interactions. By allowing complex struct outputs to be broken down into their constituent fields, it simplifies data flow and improves the usability of nodes within the graph, making it easier to connect specific data points without intermediate processing steps.

Highlights

  • Node Output Destructuring: Implemented the ability to deconstruct node outputs, allowing individual fields of a struct returned by a node to be exposed as separate outputs in the node graph.
  • New Destruct Trait: Introduced a Destruct trait in graphene-core to define how a struct's fields can be extracted and registered as node outputs.
  • Procedural Macro Support: Developed a new #[derive(Destruct)] procedural macro to automatically implement the Destruct trait for structs and generate corresponding field extractor nodes.
  • Node Metadata Extension: Extended the NodeMetadata struct to include a list of output_fields, providing registry information for destructured outputs.
Changelog
  • node-graph/gcore/src/registry.rs
    • Added output_fields to NodeMetadata struct to store information about destructured outputs.
    • Introduced StructField struct to represent metadata for individual fields.
    • Defined the Destruct trait, which types can implement to specify their destructurable fields.
  • node-graph/node-macro/src/codegen.rs
    • Modified generate_node_code to conditionally include output_fields in NodeMetadata based on the new deconstruct_output attribute.
    • Updated the protonode_identifier function to store &'static str directly in OnceLock for improved efficiency.
  • node-graph/node-macro/src/destruct.rs
    • Added a new module containing the implementation for the derive_destruct procedural macro.
    • Implemented logic to generate Destruct trait implementations for structs.
    • Included functionality to create individual extractor nodes for each field of a destructured struct.
    • Provided parsing for the #[output(name = "...")] attribute to allow custom naming of destructured outputs.
  • node-graph/node-macro/src/lib.rs
    • Integrated the new destruct module.
    • Registered the #[proc_macro_derive(Destruct)] attribute macro.
  • node-graph/node-macro/src/parsing.rs
    • Added a deconstruct_output field to the NodeFnAttributes struct.
    • Updated the parsing logic to recognize and process the deconstruct_output attribute for node functions.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Keavon
Copy link
Member

Keavon commented Feb 22, 2026

Please rebase on the latest upstream master.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces functionality for node output destructuring, allowing for the extraction of individual fields from a node's output. This involves adding output_fields to NodeMetadata, implementing a Destruct trait, and generating extractor nodes via a new destruct.rs module. The changes appear well-structured and integrate smoothly with the existing macro system. The OnceLock usage for protonode_identifier has been updated to correctly handle &'static str by leaking the boxed string, which is a common pattern for static string storage in Rust. The new deconstruct_output attribute in NodeFnAttributes provides a clear way to enable this feature for specific nodes.

@JustJ01 JustJ01 force-pushed the finish-deconstruct-outputs branch from e27f090 to e215927 Compare February 22, 2026 22:10
@TrueDoctor
Copy link
Member

Also, please configure your ai / editor / git to automatically run cargo fmt on save or pre commit

@JustJ01
Copy link
Contributor Author

JustJ01 commented Feb 23, 2026

@TrueDoctor I have made the requested changes which u asked for

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