Skip to content

nodespace-types::SchemaNode::from_node's relationships extraction has the same silent-swallow shape fields did #2130

Closed

Description

@mstomar125

Context

PR #2128 (closes #2107) fixed nodespace_types::SchemaNode::from_node silently swallowing a fields JSON parse failure to an empty Vec with zero diagnostic signal, by extracting the parse into a parse_fields helper that surfaces a diagnostic via eprintln! on a genuine failure.

The adversarial review of that PR noted that from_node's relationships extraction, two lines below fields in packages/nodespace-types/src/schema.rs, still uses the exact same pattern that was just fixed:

let relationships: Vec<SchemaRelationship> = node
    .properties
    .get("relationships")
    .and_then(|v| serde_json::from_value(v.clone()).ok())
    .unwrap_or_default();

A malformed/legacy relationships JSON value on a schema node would silently read back as zero relationships, with no diagnostic — same bug shape, same function, now inconsistent with its fields neighbor.

This was explicitly out of scope for #2107 (which named only fields), so it wasn't touched there. Filing separately to close the gap consistently.

Suggested approach

Apply the same fix shape as #2107/#2128: extract the relationships parse into a helper analogous to parse_fields that returns the (possibly empty, on failure) list alongside an optional diagnostic message, and print it via eprintln! in from_node, for consistency with the fields fix.

Acceptance criteria

  • A parse failure in nodespace_types::SchemaNode::from_node's relationships extraction is surfaced via a diagnostic (mirroring the fields fix), rather than silently producing an empty Vec.

Activity

  1. mstomar125 commented on Aug 18, 2026

    @mstomar125
    ContributorAuthor

    Fixed in #2131 — mirrors PR #2128's parse_fields fix for the sibling relationships field: extracted the parse into a parse_relationships helper that returns (Vec<SchemaRelationship>, Option<String>), with from_node printing the diagnostic via eprintln! on a genuine parse failure. Same reasoning as #2128 for leaving from_node's Result untouched (batch-collect blast-radius risk in nodes_to_typed_values). New regression tests mirror #2128's fields coverage 1:1, including the batch-safety pin in convert.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions