Repository navigation
Description
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.
defaultexists onEdgeField, 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
- Add
core_values/user_values/extensibletoEdgeField, mirroringSchemaField. Most consistent — edge properties and node properties would describe values the same way — and the round-trip tests innodespace-typesalready guard this boundary. Largest surface. - Add
core_valuesonly. RBAC roles are a closed set; user-extensible permission levels are arguably undesirable anyway. Smaller, and deliberately narrower than node fields. - 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_fieldcan declare a closed value set, with labels for display - Writes are validated against the declared set — including
--edge-datafrom the CLI, not just the UI path - A declared
defaultis validated as a member of that set - The relationships modal renders a picker rather than a free-text input for such a field
-
nodespace-typesround-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.rscovers 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
malibio commentedon Sep 7, 2026
Frontend: 4863 passed (232 test files)
Address review: state the builtin limit, stop overstating enforcement
Let an edge field declare a closed enum value set (closes #2387) (#2427)
Merge origin/main into issue-2417-tree-cycle-guard