Files
Keavon Chambers a708a54492 Make the data model use Item and List types universally, with nodes authored as rank-polymorphic kernels (#4335)
* Add rank polymorphism node audit classifying all 271 nodes

* Implement StaticType for Item<T>

* Generate Item and mapped List wire variants for nodes declaring an Item<T> primary input

* Migrate nine nodes to Item element-wise kernels, dissolving the blending trait boilerplate

* Document the Item kernel implementation and staging plan

* Route Item<Vector> through TaggedValue::TypeDefault

* Add executor integration tests covering the Item and List wire variants

* Collapse element-wise Item/List wire pairs to the List form for conversion insertion

* Migrate sixteen vector modifier nodes to Item element-wise kernels

* Migrate Sample Image, Extend Image to Bounds, and Dehaze to Item element-wise kernels

* Fix bevel_with_transform test to actually exercise the transform attribute

* Implement From<T> for Item<T>

* Register PromoteNode rank adapters wrapping bare values into Item wires

* Insert PromoteNode adapters for Item/List wire pair fields in the preprocessor

* Define a real promote node backing the PromoteNode registry identifiers

* Zip ranked Item connectors by frame slot in the mapped element-wise variant

* Register ItemToListNode singleton raise adapters

* Resolve Item wires against List connectors by inserting promotion adapters at construction

* Rank the Offset Points distance connector and prove mixed-rank resolution end-to-end

* Implement Clampable for Item and List wires with per-variant clamp bounds

* Rank the Round Corners radius connector, exercising hard bounds on a ranked wire

* Implement ApplyTransform for Item

* Add Item wire implementations to the Transform node, keeping rank-0 chains rank 0

* Detect element-wise nodes by lazy primary connectors declaring Output = Item

* Convert Transform to an Item kernel with ranked parameters, delivering the broadcast milestone

* Rename Apply Transform to Bake Transform, baking item transforms on Vector, DAffine2, and DVec2

* Promote bare wires onto Item connectors at resolution via WrapItemNode adapters

* Rank the numeric, vector, and boolean parameters across the migrated element-wise nodes

* Rank the enum, integer, and seed parameters, registering their rank adapters via a consolidated macro

* Amend the audit with the DashPattern value type resolution

* Migrate the string family to Item element-wise kernels

* Unwrap Item wires into bare legacy connectors at resolution via UnwrapItemNode adapters

* Shadow owned node parameters in bodies instead of mut in signatures

* Migrate the math family and string measure nodes to Item element-wise kernels

* Convert the comparison and clamp nodes to Item kernels, dropping unreachable &str rows

* Flat-map expander kernels returning List under the mapped variant's frame

* Migrate the expander nodes to Item kernels flat-mapping under the frame

* Remove the unused peel_list helper

* Rank the raster adjustment and blending kernels, recontextualizing shader nodes onto an Item stand-in

Migrate the 16 adjustment nodes, Mix, Color Overlay, and Gradient Map from whole-List kernels to rank-0 Item kernels, letting the macro derive the List-mapped (zip) variants. Move the Adjust and Blend per-element seams off List onto the element types (add the Raster<CPU> impls, drop the now-dead List impls).

Shader nodes keep their bodies verbatim: PerPixelAdjust re-emits the identical kernel against a transparent no_std Item stand-in, so every Item<T> connector and .element() call resolves to a zero-cost identity on the GPU while the uniform buffer stays bare repr(C). The macro peels Item off ranked uniform params, wraps the fetched texel and uniforms at the entry point, and unwraps the result. This drops the shader_node/Item incompatibility guard. Register rank adapters for the adjustment enums.

* Update the rank polymorphism roadmap for the landed shader-node and adjustments chunk

* Rename the GPU Item stand-in to ShaderItem, aliased as Item at its shader-node import sites

* Flip the vector shape generators to emit rank-0 Item<Vector>

The shape generators (Rectangle, Circle, Ellipse, Arc, Spiral, Polygon, Star, Arrow, Line, Grid, QR Code) each produced exactly one shape wrapped in a singleton List<Vector>. Emit Item<Vector> directly so they connect to the rank-0 content connector of the migrated Transform node. Downstream List consumers receive the value through the existing Item to List promotion.

Relax the element-wise validation so a `()` (generator) primary may return Item<T> without being element-wise. Adapt the Repeat on Points test, which still takes a List content connector, by raising the generator's Item output through a singleton wrapper node.

* Parse ranked Item<T> parameter defaults against the bare element type

A ranked `Item<T>` parameter's default value is a bare, unranked `T` (promoted to the wire at resolution), but the preprocessor was handed the wrapped `Item<T>` type and could not parse the literal, flooding the console with warnings and dropping the defaults. Key the field's default_type metadata off the peeled element type for concrete ranked parameters, leaving generic `Item<T>` primaries and skip_impl nodes untouched.

* Parse an element-wise primary's scalar default against the bare element type

An element-wise node's primary reports its default_type as the List wire form so an unconnected primary defaults to an empty list. But when the primary carries a scalar `#[default]` (such as Root's radicand), that literal must parse as a bare element, not a List. Key the primary's default_type off the bare element type when it has a Default value source, keeping the List form otherwise.

* Add the DashPattern value type for stroke dash sequences

Introduce a rank-0 DashPattern value type (a Vec<f64> of alternating dash and gap lengths) so a stroke's dash pattern is a single frameable value rather than a rank-1 List<f64>. Register it as an auto-generated TaggedValue variant, parse its default from a comma or space separated string, and register its rank adapters. Not yet wired into the Stroke node.

* Rank the Fill and Stroke nodes element-wise and give Stroke a DashPattern connector

Migrate Fill and Stroke to element-wise Item<V> primaries (over Vector and Graphic element types) via a new element-level VectorItemMut trait, so styling one shape yields one shape and rank is preserved instead of promoting the input to a singleton List and emitting a List. The macro derives the List-mapped variant for genuine collections.

Wire the Stroke dash sequence to the new rank-0 DashPattern value type, collapsing the old content x paint x dash cartesian and dropping the IntoF64Vec trait. Update the stroke properties dash widget, the drawing tool, and graph-operation plumbing to read and write DashPattern, and migrate legacy F64Array, F64, and String dash inputs on document open.

Assign Colors stays a whole-collection node: each element's gradient position depends on its index among all siblings, which the element frame does not expose, so it keeps its List primary and the VectorListIterMut trait.

* Register rank adapters for the ranked Stroke enum parameters

The element-wise Stroke node ranks its align, cap, and paint order parameters as Item<StrokeAlign>, Item<StrokeCap>, and Item<PaintOrder>, but those enums lacked promotion adapters, so a bare default enum value could not be promoted to its Item wire and no Stroke variant resolved ("No construct found for node"). Register their rank adapters alongside StrokeJoin.

* Display Item wires in the Data panel without a List's ID column

Add a TableItemLayout impl for Item<T> and recognize Item wire types when introspecting graph data. An Item holds a single element, so it renders as a one-row table of the element plus its attributes with no leading index column, and it labels as its element type T rather than a List's T[]. Add ItemAttributeValues::get_any for the attribute widget dispatch.

* Register MonitorNode for Item wire types so the Data panel introspects them directly

Graph introspection wraps the inspected output in a generic MonitorNode typed to the wire. Without Item<T> monitor registrations, an Item<Vector> output could only be monitored after an Item to List promotion, so the Data panel captured and displayed a List<Vector> despite the connector being Item<Vector>. Register monitors for the Item types the element-wise nodes emit, and add the matching Data panel downcast entries.

* Color and double Item/List wires and cleave layer-stack connectors in the node graph

* Route wire color and rank through hidden nodes and refresh them on type changes

* Rework the DashPattern connector conversions with element-wise promotion and an explicit reducer node

* Rank the remaining value, context, aggregation, and transform nodes onto Item<T> wires

* Back DashPattern with a List<f64> so the Data panel can introspect its lengths

* Carry a single Item<T> through varargs so the Read context nodes emit Item<T> not List<T>

* Relax rank validation for aggregation shapes, add element adapters, and match variants by fewest promotions

* Rank the remaining bare and unnecessarily-List connectors across the node catalog

* Add Graphic::None and the FillChoice paint value, making colors and gradients plain values

* Rename GradientStops to Gradient and the legacy Gradient/Fill structs to LegacyGradient/LegacyFill

* Restore generator frame-from-params ranking to the roadmap as a planned stage

* Rename the ranked-field adapter identifier from PromoteNode to FieldAdapterNode to reflect its full contract

* Unload only the wires whose displayed style changed when types update

* Peel wire rank in the editor's semantic type checks so rank-0 layers are recognized

* Restore the whole-List Transform variant so rank-1 content wires resolve again

* Register the Item wire forms for the Memoize and Context Modification infrastructure nodes

* Give every ranked connector a field adapter and add numeric cast variants for legacy wires

* Key a ranked param's type default off its Item wire form when no literal default exists

* Inherit the layer's content value when splicing a node into an empty chain

* Migrate stale List-form TypeDefault inputs to the definition's current default

* Generate the mapped wire variant only when the element-wise node has a frame source

* Let a bare wire feed a List connector via a wrap-raise adapter, costed as two rank steps

* Add a zip companion to the whole-List Transform so ranked List parameters pair per slot

* Add the Sum, Average, Minimum, Maximum, Any, and All list reducers

* Convert the measure family to element-wise Item kernels per the audit classification

* Prefer the bare element value over the Item type default so ranked params keep their widgets

* Rename GradientStopsUI to GradientUI

* Split Fill's optional transform into a _has_transform bool and a ranked _transform matrix

* Rename the migration-only OptionalDAffine2 TaggedValue to LegacyOptionalDAffine2

* Flow byte buffers as Item<Resource> instead of List<u8> across the byte nodes

* Macro-generate the list-content wire variant, retiring the hand-written Transform-zip, Area, and Centroid companions

* Let ()-primary generators take ranked params and frame over them via the mapped variant, ranking Circle's radius

* Rank the vector shape generators' params to Item, adding a rank-aware input grab to the introspection harness

* Rank the value, color, and text generator params to Item

* Rank the raster, web-request, and context-reader generator params to Item

* Fix the repeat and brush test wirings left behind by the param-ranking sweeps

* Delete the vestigial Some, Unwrap Option, and Size Of debug nodes

* Delete the Attach Attribute node, folding its role into Write Attribute

* Add the Filter and Sort list companion nodes

* Guard the removed-definition migration swap target with a test

* Add the Box Corners value type in place of the rectangle corner radius list

* Split Text to Vector's per-glyph mode into a Text to Vector Glyphs node

* Rank the Combine Channels node's channel connectors to Item

* Make Map Points an element-wise node

* Delete the deprecated Upload Texture node

* Update the implementation roadmap to reflect the landed stages

* Let monitor introspection read rank-0 wires, locking in the layer coercion promotion path

* Prefer the rank-0 default when disconnecting a rank-capable input

* Make Path Modify an element-wise node

* Wrap node paths in a NodeIdPath newtype so they flow as a single Item

* Give Item<Raster<CPU>> a default so an unconnected Brush background resolves

* Stop the Brush node from setting layer attributes its paint operation doesn't produce

* Present-gate Flatten Path's adopted layer path like its fill and stroke

* Gate carried layer attributes on static column presence, not runtime values

* Give the remaining graphic Item<T> types a default so unconnected primaries resolve

* Dispatch a ranked param's Properties widget from its rank-0 element type

* Make Extract Transform an element-wise node, restoring the Origins to Polyline body

* Rename Flatten Path to Combine Paths

* Stamp Legacy Layer Extend's adopted layer path as a readable NodeIdPath

* Drop the dead List<u8> and List<NodeId> wire rows

* Rank Flatten Graphic's Fully Flatten toggle to Item

* Update the implementation roadmap with the endgame scope

* Make Combine Paths a reducer that collapses the whole frame into one path

* Stop type-converter nodes from carrying the source's unrelated attributes

* Format the Origins to Polyline regression test

* Wrap the Brush node's trace in a BrushTrace newtype so it flows as one value

* Make Switch a framed element-wise select, bundling whole collections

* Widen and align element-type coverage across the list and graphic nodes

* Register the compiler's cache chain pair for every ranked enum and newtype wire

* Fix wire colors for Passthrough outputs, bundled lists, and bools, and widen list wires

* Represent List wire types structurally with Type::List, replacing name-parsed rank promotion

* Treat scope and data fields as environment, rank scope wires as Item, and feed the render boundary through a context vararg

* Delete the vestigial Clone debug node

* Reinstate Upload Texture as an element-wise node and fix the GPU variants' scope executor and rank adapters

* Rename Combine Paths back to Flatten Path, deferring that rename to its own PR

* Deduplicate the promotion adapter registrations into the field adapter macro

* Rank Write Attribute's value connector to Item<AttributeValueDyn>, retiring the UnwrapItem bridge

* Vertical wire styling

* Store the editor layer path attribute as a bare NodeIdPath, not an Item<NodeIdPath>

* Rank Context Modification's features connector to Item<ContextFeatures>, dropping the dead memoize row

* Rank Path Modify's modification parameter to Item<Box<VectorModification>>

* Rename the field adapter node family to input adapter

* Drop the dead bare scalar rows from Context Modification's implementations list

* Move the dynamic executor's test module into its own file

* Drop the registry's unreachable bare rows for Memoize, the cache chain, and ConvertNode

* Materialize stored TaggedValues as ranked Item wires at the source

* Remove the bare-wire promotion and adapter machinery made dead by ranked value materialization

* Plant the input adapter for List-only inputs, composing position conversion from standard rows

* Consolidate Into/Convert conversions into the input adapter umbrella and rename the rank adapter identifiers

* Fix grouped layers gaining a phantom None stack element from the FillChoice default hijacking every List<Graphic> disconnect

* Enforce ranked node inputs in the macro, rejecting bare wire declarations

* Remove the unit Context => () machinery rows, leaving () purely as the no-primary sentinel

* Add a --signatures rank-audit mode to node-docs for the ranked-wire migration

* Remove the node-docs --signatures rank-audit mode now that ranked wires are enforced

* Migrate legacy no-color values on the Black & White, Color Overlay, and Empty Image color inputs

* Rewrite the element-wise accessor wire type at the primary input, not raw index 0

* Register the cache chain for Resource wires, replacing the lone hand-written Monitor row

* Gate the remaining Raster<GPU> registry rows behind the gpu feature

* Let List<DVec2> wires erase to ListDyn for the attribute reader and element counter

* Rename Extract Element to Item at Index, Count Elements to List Length, and Omit Element to Remove at Index

* Store paint picks as plain color/gradient values, removing the FillChoice value type

* Code review restructuring

* Sort by the consumed sort_key attribute or natural element order, adding the Sort Key node

* Remove the new list-combinator and reducer nodes to defer them to a follow-up PR

* Parse Fill and Stroke color defaults through the paint wire's Graphic element

* Emit ranked implementation-row default types structurally so their element TypeIds survive to default-literal parsing

* Exempt the deliberate no-paint choice from the stale List-form TypeDefault migration

* Migrate the legacy 4-input Fill directly to the split has-transform shape

* Upgrade the demo artwork

* Fix the valid AI review findings: Item eq/hash contract, table-era no-paint migration, quantize List rows, and other smaller issues

* Remove the rank polymorphism working documents

* Hash Item attribute values directly instead of debug-formatting them, speeding up cached evaluation

* Replace the data panel's dead bare-wire downcast arms with full coverage of the ranked monitor row types

* Derive PartialEq for Item now that attributes participate in equality

* Extend the data panel's attribute dispatchers with the newly supported scalar and choice enum types

* Add List monitor rows for the framed numeric conversion outputs so inspecting them resolves, with matching data panel arms
2026-09-08 16:03:01 +00:00
..

The Graphite Node Graph

Graphite is a node based image editor. Everything it renders comes from evaluating a graph of nodes, and this directory holds that system: the types nodes are built on, the node library, the macro that turns a plain Rust function into a node, and the compiler and executor that turn a saved document into a running graph.

This is an orientation document, not a specification. It says what lives where and what the vocabulary means. The code is the ground truth, and the module level //! headers under libraries/core-types/src/ carry the real design detail.

Crate map

Foundations, in libraries/:

Crate Directory What it is
core-types libraries/core-types The Node trait, records, attributes, the arena, contexts, and the node registry. Everything else sits on it.
no-std-types libraries/no-std-types no_std primitives shared with the GPU shader crates: color, blending, choice types.
graphene-hash libraries/graphene-hash CacheHash, which hashes floats by bit pattern so cache keys stay stable.
graphic-types libraries/graphic-types Document element types: Graphic, Vector, Artboard, and their attribute markers.
raster-types libraries/raster-types Image, Raster<CPU> and Raster<GPU>, Texture, and the pixel traits.
vector-types libraries/vector-types Vector geometry: Vector, subpaths, point and segment domains, gradients, styles.
rendering libraries/rendering The Render trait and the SVG and Vello backends.
graphene-application-io libraries/application-io Traits for reaching the host: GPU access, resource loading, EditorApi.
graphene-resource libraries/resources Content addressed binary blobs and their async loading.
graphene-canvas-utils libraries/canvas-utils HTML canvas helpers, and nothing at all off wasm.
wgpu-executor libraries/wgpu-executor The GPU backend: wgpu context, pipeline and texture caches, the Vello renderer.

The node library, in nodes/:

Crate Directory What it is
graphene-core nodes/gcore Core nodes: arithmetic, context modification, memoization, animation, and the pilot record nodes.
graphene-std nodes/gstd The standard library. Re-exports every other node crate and adds the render pipeline, text, and platform IO nodes.
blending-nodes nodes/blending Blend mode, opacity, and fill.
brush-nodes nodes/brush Brush strokes, stamping, and brush rendering.
graphic-nodes nodes/graphic Grouping and artboard construction over Graphic.
math-nodes nodes/math The expression parser node plus arithmetic, random, and vector math.
path-bool-nodes nodes/path-bool Boolean path operations on vector geometry.
raster-nodes nodes/raster Color adjustments, blending, and filters. Written no_std capable so the kernels double as GPU shaders.
repeat-nodes nodes/repeat Grid, linear, and circular repeats.
text-nodes nodes/text Font loading, glyph shaping, text to path, and string operations.
transform-nodes nodes/transform Translation, rotation, scale, skew, and footprint aware transforms.
vector-nodes nodes/vector Shape generators, path operations, and vector modification.

Compiler and runtime:

Crate Directory What it is
graph-craft graph-craft The document graph and its lowering: NodeNetwork and DocumentNode down to ProtoNetwork, plus type inference.
preprocessor preprocessor The pass over a freshly loaded document: expands proto nodes into their definitions, injects scopes, resolves resource inputs.
interpreted-executor interpreted-executor The dynamic executor. Instantiates a ProtoNetwork into a tree of boxed nodes and evaluates it.
node-macro node-macro #[node] and friends. Generates the node struct, its Node impl, the registry entries, and the editor metadata.
graphene-cli graphene-cli Headless CLI: load a document, compile it, run it, export the result.

Core concepts

Nodes

Node lives in libraries/core-types/src/node.rs and has exactly one required method, serve. A node serves its output record through a frame claim its caller hands it, and returns a proof that only the claim's own closing methods can mint, so a served record is of the claimed layout by construction rather than by convention. Each node claims its frame out of the free space its caller left, so the frame space divides without bookkeeping.

Everything else on the trait has a default. extent_at and extent report how many items the node produces at a nesting level, layout reports the record layout, and eval_batch serves a whole range at once. The default eval_batch advertises no support and drivers fall back to per lane serves with copy out, so an override exists to beat that loop and never for correctness.

Kernels written with the macro do not see serve. They receive typed inputs and call eval on them, and the generated code handles the claim, the protocol, and status folding.

Records

A record is what flows between nodes: the element at offset 0 plus one field per attribute written upstream. Its Layout is computed at wiring time from the upstream write set and is never serialized. Records of inline layouts live in the RecordValue itself, and larger ones live as per lane views on the evaluation's Frames, which the root owns and every node claims its own frame out of. Only generated and wiring code touches offsets, so a safe kernel cannot misalign a field.

libraries/core-types/src/record/ is split by abstraction level, and each module's //! header states its job:

Module Concern
layout Wiring time shape facts: the layout a record takes and the writes it folds from.
access Raw typed access to a record at a wiring proven layout.
frames The evaluation's record frame storage.
serve The serving protocol: a node's own frame claim and the proof it closes with.
input Consumer side bindings onto a record input, and the drivers they run.
route Producer side routing: a source's translation into the union layout.
promote Transient to persistent promotion of records and their parked payloads.
owned The owned crossing: deep copies that outlive the evaluation their content borrowed.
run Runs and groups: many records of one layout, resident or owned.
testkit Law test scaffolding over the record tier.

Two words are used precisely throughout. An input is the consumer side of a connection, and a source is the producer side. Neither is called a wire; that word belongs to the editor UI.

Attributes

An attribute is a named, typed channel that rides along with an element. A marker declares the name once, fixing its value type and its name specific default, and a census collects every declaration so name resolution, defaults, and diagnostics all happen at graph compile time. One name belongs to one marker, so a name can never mean two types. Declare markers with core_types::attribute!:

core_types::attribute! {
	/// The measured length of an element.
	pub Length("length"): f64;
	/// A label parked in the arena by whoever writes it.
	pub Label("label"): &str;
}

Values are Copy and pack directly into record fields. Anything with drop glue rides the arena instead: the marker declares a reference value such as &str, the writing kernel parks the payload in the arena, and the record field carries a reference good for the evaluation.

In a kernel, Attr<A> as a parameter is a read, yielding the declared default where nothing upstream wrote it. Attr<A> in the return tuple is a write, and the same marker on both sides is a modify. OwnedAttr<A> carries a value across the evaluation boundary, and RemoveAttr<A> subtracts the attribute from the layout. See libraries/core-types/src/attribute.rs, and nodes/gcore/src/record.rs for worked examples of every form.

The arena

Two regions, both in libraries/core-types/src/arena.rs. The transient arena is reset at the top of every evaluation, so anything parked in it lives exactly as long as the evaluation that parked it. The persistent region backs promoted memo levels; it is flushed whole between evaluations and never during one, so no flush can land while a promoted value is still readable.

Arena::move_park is the promotion. It copies a payload's header into the receiving region, hands over the drop obligation, and tombstones the source entry in place. The heap the payload owns is neither copied nor freed, since ownership travels with the obligation, and a payload two records share moves once. Region sizes and the flush policy live in interpreted-executor/src/dynamic_executor.rs.

Serving

Evaluating a graph is a walk of serve calls down from the root. The root claims the frame buffer, each node claims its own frame out of what its caller left, and status rides the GPoll return: Final, Partial for a result that is correct but incomplete, Pending for work not yet ready, Error, and Fallback for a usable value paired with the error that degraded it. StatusCell folds each input's status into the serving node's own, which is what lets a kernel be written as though its inputs simply returned values.

Adding a node

Write a function and put #[node_macro::node] on it. The macro generates the node struct, the Node implementation, the registry entries, and the metadata the editor builds its catalog and properties panel from.

use core_types::Ctx;
use core_types::attribute::{Attr, Opacity};

/// Scales the opacity attribute of every element passing through.
#[node_macro::node(category("Raster: Adjustments"))]
fn multiply_opacity(
	_: impl Ctx,
	/// The element and its current opacity.
	(element, opacity): (f64, Attr<Opacity>),
	/// The factor to scale the opacity by.
	#[default(1.)]
	#[range]
	#[soft(0..2)]
	factor: f64,
) -> (f64, Attr<Opacity>) {
	(element, Attr(*opacity * factor))
}

Reading that back: the first parameter is the evaluation context. A tuple parameter is a record input, binding the element alongside the attributes this kernel reads, while a plain parameter is an ordinary value input the user can set. The return tuple is the write set, and returning Attr<Opacity> after reading it makes this a modify rather than a fresh write.

Doc comments are not decoration. The one on the function becomes the node's description in the editor's catalog, and the one on each parameter becomes that input's description.

Options on the invocation are category, name, path, properties (naming a function in editor/src/messages/portfolio/document/node_graph/node_properties.rs for a custom panel), extent (naming a function that computes the node's extent, for nodes that change the item count), and skip_impl.

Per parameter there are #[default(..)], #[expose], #[name(..)], #[widget(..)], and #[implementations(..)], which enumerates the concrete type rows a generic node registers. For numbers, #[range] renders a draggable slider, #[soft(a..b)] sets its suggested extent, and #[hard(a..b)] sets the enforced clamp. Either endpoint may be omitted and both are inclusive, so there is no ..= form. Typed values may exceed the soft extent but are clamped to the hard bounds, so #[soft] only means anything together with #[range]. The macro checks these and will reject a #[range] missing an end, or a #[soft] bound equal to its #[hard] counterpart.

Registration is automatic. The macro emits a ctor constructor that inserts into NODE_REGISTRY and NODE_METADATA in libraries/core-types/src/registry.rs at process start, and interpreted-executor/src/node_registry.rs takes that table and adds a hand written set of conversion nodes to build the registry the compiler consumes. There is no separate definition table to edit; writing the function is the whole job. On wasm the ctor attribute is skipped and registration is driven explicitly instead.

From a document to a result

A saved document arrives as a NodeNetwork. The preprocessor expands each proto node reference into the DocumentNode template built from its registry metadata, reconciling saved inputs against what the current definition expects, which is what lets old documents load against new node definitions. NodeNetwork::flatten then dissolves nested networks into one graph, into_proto_networks lowers it to a ProtoNetwork, and TypingContext resolves types against the registry. The executor pushes each ProtoNode into its BorrowTree, which keeps a node alive as long as anything references it, and eval_root resets the transient arena, sizes the frame buffer to the graph's need, and serves the output.

Deeper reading

The design documentation for the record tier is the //! headers in the source. Read libraries/core-types/src/record/mod.rs first, then the submodule headers in the table above, then node.rs, attribute.rs, and arena.rs.

Two RFCs cover work adjacent to this system:

Debugging

log::debug!() works inside a node body. For running a graph without the editor in the way, graphene-cli loads a document, compiles it, evaluates it, and can list every registered node.

If any of this is wrong or unclear, please ask in the Graphite Discord. We are happy to help.