Resolve a named read's offset when the graph compiles

The fold already holds the name and the read input's finished layout, so
the offset falls out there rather than at construction: `RecordLayout`
carries the resolved numbers and `set_layout` copies them into the read
slots. Constructors are untouched, and census-marker reads keep their
current installation.

A read meets the value type the name was written at, so a disagreement
between a read here and a write upstream is the same graph error as two
writes disagreeing; the one-name-one-type check now spans reads and
writes together. An absent attribute stays absent and the read serves
the forced default rather than reporting it.

`read_attribute` is the catalog's get half, typed and never `Option` at
the kernel boundary, with the name declared exactly as the write side
declares it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Dennis Kobert
2026-09-09 10:50:08 +00:00
parent fc94487d0b
commit 5eb80721dd
23 changed files with 349 additions and 69 deletions

View File

@@ -127,7 +127,10 @@ fn validate_record_io(parsed: &ParsedNodeFn) {
_ => None,
};
if async_source && token.is_some() {
emit_error!(carrier.pat_ident.span(), "an async source's element crosses the future boundary as a value; a passthrough generic element has none");
emit_error!(
carrier.pat_ident.span(),
"an async source's element crosses the future boundary as a value; a passthrough generic element has none"
);
}
let element = writes.as_ref().map(|writes| &writes.element).unwrap_or(&value);
match &token {
@@ -164,7 +167,10 @@ fn validate_record_io(parsed: &ParsedNodeFn) {
let mut seen_writes: Vec<String> = Vec::new();
for write in &writes.markers {
if write.owned && !async_source {
emit_error!(parsed.output_type.span(), "an owned attribute crossing belongs to an async source; a synchronous write parks its value in the kernel");
emit_error!(
parsed.output_type.span(),
"an owned attribute crossing belongs to an async source; a synchronous write parks its value in the kernel"
);
}
let written = write.marker.to_token_stream().to_string();
if seen_writes.contains(&written) {