Skip to content

Implement PersonNodeBehavior #133

Closed

Description

@malibio

Overview

Implement PersonNode as a core node type: the person schema entry + PersonNodeBehavior (validation, computed display name). PersonNode is the identity primitive the ADR-037 access model builds on.

This issue owns PersonNode the type (schema + behavior). It does not create any PersonNode instance — see Scope.

Updated to reflect the revised data model: PersonNode is pure identity (name, email only). role moves to the has_role edge between PersonNode and DatabaseSettingsNode (see #[#1398]). auth_status moves to DatabaseSettingsNode. Supersedes the original pre-Universal-Graph body.

Read first

Data model (Universal Graph)

PersonNode is a node with node_type = 'person'; its data lives under properties (namespaced properties.person.*). There is no persons table.

PersonNode is pure identity — it carries no auth or role state. Those live on relationships:

Field Type Notes
name string? Display name. Optional — must not block instantiation. Used by compute_content.
email string? Optional; basic format validation (@ + .) when present.

Not on PersonNode:

  • role — lives on the has_role edge between PersonNode and DatabaseSettingsNode (tenant-level authority)
  • auth_status — lives on DatabaseSettingsNode (database sync state)

Implementation Tasks

  • Add a person SchemaNode to packages/core/src/models/core_schemas.rs with name and email (both optional).
  • Implement PersonNodeBehavior implementing the NodeBehavior trait.
  • Register it in NodeBehaviorRegistry::new() (packages/core/src/behaviors/mod.rs), alongside the existing behaviors.
  • validate: validate email format if present; do not require name.
  • compute_content helper for a display name (fall back gracefully when name is empty).
  • can_have_children() → false (person is a leaf).
  • Unit tests: schema present; behavior registered; email format validation; empty-name is valid; compute_content with and without a name.

Acceptance Criteria

  • person schema entry exists with optional name and email only.
  • PersonNodeBehavior implements all NodeBehavior methods and is registered.
  • email format-checked when present; empty name is accepted.
  • Unit tests cover validation, computed content, and the empty-name path.
  • Passes cargo clippy; no lint suppression.

Scope

In scope: PersonNode the type — schema + behavior + validation.

NOT in scope (deliberately):

Relationships

Activity

  1. malibio commented on Jun 8, 2026

    @malibio
    CollaboratorAuthor

    Coordination: this is now a dependency of #1372 (ADR-037 access model)

    PersonNodeBehavior became load-bearing for the ADR-037 collection access model — "members of a restricted collection = person nodes only." #1372 (core data plane for ADR-037) depends on this issue for Task C (person schema + behavior), Task D (seed the single local PersonNode), and Task E (person-only membership check).

    ⚠️ This body is stale and must be updated before implementation

    Written pre–Universal-Graph; several references no longer match the codebase:

    • Removed doc paths — docs/architecture/business-logic/node-behavior-system.md and .../database-schema.md don't exist. Current refs: components/node-behavior-system.md, components/schema-management.md.
    • "Persons Table" — there is no persons table. Person is a node in the Universal Graph (node_type = 'person'); data lives under properties (namespaced properties.person.*), not a dedicated table or metadata.
    • Behavior registration — register in NodeBehaviorRegistry::new() (packages/core/src/behaviors/mod.rs ~L2089), alongside the existing behaviors; mirror the validation/type-check pattern used by TaskNodeBehavior.
    • first_name/last_name required — reconsider. ADR-037's local-seeded singleton (the local user) may exist before a name is set; required name fields would block seeding. Suggest name optional, or default from the local user.

    New fields ADR-037 needs on the person schema (fold into this issue)

    • role — enum owner/admin/editor/viewer. This is the tenant-level authority axis, explicitly distinct from the collection-edge permission (admin/modify/readOnly) which lives on the member_of edge, not the person. Don't conflate them (ADR-037 § "Collection-Edge Permissions vs. Tenant Role").
    • auth_status — enum local/bound (default local, Core-protected). The local user seeds as local; cloud upgrade binds it to a Supabase identity (bound). The bind itself is pro/sync — out of scope here; this issue only lands the field + the seeded local instance.

    Scope split

    Recommend updating this body (paths, table→node, optional name, new fields) before picking it up, then implementing as Task C of #1372.

  2. self-assigned this
    on Jun 9, 2026
  3. added a commit that references this issue on Jun 9, 2026
  4. added a commit that references this issue on Jun 9, 2026
  5. added a commit that references this issue on Jun 9, 2026
  6. added 2 commits that reference this issue on Jun 22, 2026
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