Write an attribute under a name the graph supplies

`Named<X>` in parameter position declares where a placeholder's name is
wired, and the macro gives that input constant text; `Attr<Named<X, V>>`
in the return writes under it. The kernel is handed the bare placeholder,
since the name is spent resolving the layout and a folded offset is all
the write needs, so the hot path matches a marker node's exactly.

A name-generic write names its value type through the wired generic,
which only an implementations row resolves, so those nodes emit their
layout meta per row rather than sharing one across rows.

`write_attribute` is the catalog's set half, restoring the identifier
master's documents carry with its input positions. Its name input is a
constant, so those documents resolve without migration, and the reset
marker that stood in for the missing node retires with it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Dennis Kobert
2026-09-09 09:26:17 +00:00
parent 348e9022a6
commit 9b92edc0e9
10 changed files with 363 additions and 34 deletions

View File

@@ -1024,12 +1024,6 @@ fn replace_optional_f64_null(input: &str) -> String {
result
}
/// Serialized proto identifiers of the pre-flip Merge and Artboard layer internals.
/// A document containing any of them predates the leveled-records flip and rebuilds its
/// layer definitions through the same reset mechanism as the `SourceNodeIdNode` entry in
/// `document_migration_reset_node_definition`.
pub const FLIP_RESET_NODE_MARKERS: &[&str] = &["graphic_nodes::graphic::WriteAttributeNode"];
pub fn document_migration_reset_node_definition(document_serialized_content: &str) -> bool {
// Upgrade a document being opened to use fresh copies of all nodes
if document_serialized_content.contains("node_output_index") {
@@ -1051,12 +1045,6 @@ pub fn document_migration_reset_node_definition(document_serialized_content: &st
return true;
}
// The leveled-records flip replaced the layer internals; documents from before it rebuild
// their layer definitions.
if FLIP_RESET_NODE_MARKERS.iter().any(|marker| document_serialized_content.contains(marker)) {
return true;
}
false
}
@@ -2616,10 +2604,12 @@ mod tests {
use super::*;
#[test]
fn the_flip_reset_markers_keep_the_historical_merge_internals_spelling() {
// The node itself is removed; the marker matches its spelling in
// documents saved before the flip, which must stay stable.
assert_eq!(FLIP_RESET_NODE_MARKERS, &["graphic_nodes::graphic::WriteAttributeNode"]);
fn a_written_attribute_no_longer_resets_the_layer_definitions() {
// The node resolves natively again, so a document carrying it keeps
// its own layer internals instead of rebuilding them.
assert!(!document_migration_reset_node_definition(
r#"{"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}}}"#
));
}
#[test]