From df99ab3a7218dc9030fcdbe38b15193822ec3050 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Mon, 7 Sep 2026 16:12:01 +0000 Subject: [PATCH] Guard attribute writes against an uninstalled layout offset --- node-graph/libraries/core-types/src/record/serve.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node-graph/libraries/core-types/src/record/serve.rs b/node-graph/libraries/core-types/src/record/serve.rs index 65bdc80f9c..bafb4487c1 100644 --- a/node-graph/libraries/core-types/src/record/serve.rs +++ b/node-graph/libraries/core-types/src/record/serve.rs @@ -130,8 +130,14 @@ impl<'e, 'l> FrameClaim<'e, 'l> { /// Writes a field at its wiring-resolved offset. /// /// # Safety - /// `offset` must be this layout's resolved offset for a field of `T`. + /// `offset` must be this layout's resolved offset for a field of `T`. A + /// generated write offset defaults to 0 until `set_layout` installs it, so + /// the debug assertion catches a serve that ran before the install. pub unsafe fn attr_at(&mut self, offset: usize, value: T) { + debug_assert!( + self.layout.fields.iter().any(|field| field.offset == offset), + "attribute write at an offset this layout does not carry; the layout must install before serving" + ); unsafe { write_field(self.dst(), offset, value) }; self.filled_fields = true; }