Skip to content

EdgeField cannot declare enum values, so RBAC roles on a relationship would be free text #2387

Closed

Description

@malibio

Gap

EdgeField cannot declare an enum. SchemaField can.

packages/nodespace-types/src/schema.rs:197-211 — the complete EdgeField:

pub struct EdgeField {
    pub name: String,
    pub field_type: String,
    pub indexed: Option<bool>,
    pub required: Option<bool>,
    pub default: Option<serde_json::Value>,
    pub target_type: Option<String>,
    pub description: Option<String>,
}

SchemaField additionally carries core_values, user_values and extensible (:139-147) — the machinery that makes an enum an enum: a closed value set, user-extensible values, and labels for display.

So an edge property can be typed "enum" by string, but nothing declares what the permitted values are, nothing validates a write against them, and no UI can render a picker instead of a free-text box.

Why it matters now

The collection↔person relationship will carry RBAC — ownership, read-only, modify. That is precisely an enum edge property:

{
  "name": "member_of",
  "targetType": "collection",
  "edge_fields": [
    { "name": "role", "type": "enum", "required": true, "default": "viewer",
      "core_values": [
        {"value": "owner",  "label": "Owner"},
        {"value": "editor", "label": "Editor"},
        {"value": "viewer", "label": "Viewer"}
      ]
    }
  ]
}

The core_values above cannot be expressed today.

Without it, a permission role is a free-text string on the edge. For an access-control field specifically, that is worse than the usual enum-as-text problem:

  • Nothing constrains the value. "Owner", "owner", "onwer" are three distinct roles to any code reading the edge. A typo silently produces a role that grants nothing — or, depending on how checks are written, is not the role the user believes they set.
  • No UI affordance. The relationships modal has no declared value set to build a picker from, so RBAC would be assigned by typing a string. That is a poor experience for the one field where a wrong value is a security-relevant outcome.
  • No validated default. default exists on EdgeField, but with no declared value set there is nothing asserting the default is itself a legal value.
  • Enum-driven queries do not work. Filtering "which collections does this person own" depends on the value set being known and stable.

Options

  1. Add core_values / user_values / extensible to EdgeField, mirroring SchemaField. Most consistent — edge properties and node properties would describe values the same way — and the round-trip tests in nodespace-types already guard this boundary. Largest surface.
  2. Add core_values only. RBAC roles are a closed set; user-extensible permission levels are arguably undesirable anyway. Smaller, and deliberately narrower than node fields.
  3. Reference a node type instead, via the existing target_type — model roles as nodes. More machinery than three fixed values justify, and it makes every permission check a graph lookup.

Option 2 looks right for the RBAC case; option 1 is the better general answer if edge properties are expected to grow beyond it. Worth deciding on that basis rather than on this one use case.

Acceptance criteria

  • Decide between the options above and record why
  • An edge_field can declare a closed value set, with labels for display
  • Writes are validated against the declared set — including --edge-data from the CLI, not just the UI path
  • A declared default is validated as a member of that set
  • The relationships modal renders a picker rather than a free-text input for such a field
  • nodespace-types round-trip tests cover the new fields (the existing tests fail if a field is dropped at the conversion boundary — keep that property)
  • Schema-authoring guidance in packages/agent/src/skill_rules.rs covers enum edge fields, so agents declaring an RBAC-style relationship produce a valid value set

Context

Found while reviewing the relationships UI, where per-row edge-property editing is being reworked. This is the schema-side prerequisite for the RBAC work on collection↔person: the UI cannot offer a role picker for values the schema has no way to declare.

Activity

  1. malibio commented on Sep 7, 2026

    @malibio
    CollaboratorAuthor

    Frontend: 4863 passed (232 test files)

  2. self-assigned this
    on Sep 7, 2026
  3. added 2 commits that reference this issue on Sep 7, 2026
    7d7fbf8
    0368a34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions