Skip to content

Person schema: replace name with first_name and last_name #2111

Closed

Description

@malibio

Change

Replace person's single name field with first_name and last_name. Final field set:

Field Type Notes
first_name string replaces name
last_name string new
email string unchanged — indexed, unique, uniqueCaseInsensitive

Current schema (packages/core/src/models/core_schemas.rs:1129-1182) has only name + email, both optional, isCore: true, no relationships, no titleTemplate.

Pre-release: no migration, no compat shim — reset the database.

Display name is the real work

name is not just a field; it is the person's display identity, and three separate mechanisms depend on it. Splitting it into two fields means each needs an explicit rule for composing a display string.

1. compute_display_name — packages/core/src/behaviors/mod.rs:2233-2255

// current fallback chain
properties.person.name  →  properties.person.email  →  "Unknown"

Needs a new chain over two fields. Decisions required: how to join ("{first} {last}"), and what to do when only one is present. Suggested: join the non-empty parts with a space; if both are empty fall back to email, then "Unknown". Keep the existing behaviour that a person with no name at all is valid — the schema deliberately allows a person to exist before a name is set, and tests person_empty_name_is_valid / person_absent_name_is_valid (behaviors/mod.rs:5405,5412) assert it.

2. Name→content sync — person-schema-form.svelte:41-44

The form writes name into the node's content so the person renders inline (documented at person-node.svelte:4 and person-schema-form.svelte:5). With two fields this must sync the composed string, and must recompose when either field changes.

3. titleTemplate — currently None

Person has no title template. This is the natural mechanism for a composed display string ("{first_name} {last_name}") and would keep the rule in the schema rather than in three code paths. Worth deciding whether to adopt it here rather than hand-composing in each consumer — but note the template would need to degrade sensibly when one or both fields are empty, which templates may not express today. Implementer should check before committing to it.

The three mechanisms must agree. Today they can drift; this change is a good point to converge them on one composition rule.

Other call sites

  • seed_local_person_if_needed (node_service/mod.rs:1061-1069) creates the local owner PersonNode with empty properties — no name — so it is unaffected mechanically, but it is the node most likely to display as "Unknown". Worth confirming that is still the intended first-run state.
  • person-schema-form.svelte:62-93 hardcodes exactly two inputs reading properties.person.{name,email} — becomes three fields. Note Add typed property forms for packaged schemas person and project, following the task form pattern #2102 replaces this form entirely; coordinate so the work is not done twice.
  • Fixtures/examples embedding {"person":{"name":"Alice"}}: behaviors/mod.rs:2437,5449,5475, daemon/src/services/node_service.rs:2016.
  • packages/skill/SKILL.md:335 uses nodespace schema get person as an example — harmless, but check the output shown is not stale after this change.

Seeding caveat

seed_core_schemas_if_needed (node_service/mod.rs:1344) creates only schemas missing from the database and leaves existing ones untouched. The revised person schema will not reach any existing install without a database reset. Same trap recorded in #2101 — resolve consistently.

Field descriptions

The current descriptions are genuine prose ("Display name; optional — a person may exist before a name is set"), which is why they leak into table column headers today. Under #2101 these become LLM-facing and gain a separate friendly_name for display. When authoring first_name / last_name, write descriptions in that spirit rather than as terse labels — see #2101 for which field the UI will read.

Acceptance criteria

  • Person schema defines first_name, last_name, email; name removed
  • One documented composition rule for the display string, applied consistently by compute_display_name, the content sync, and any title mechanism
  • Composition degrades sensibly when only one name field is set, and when neither is
  • A person with no name remains valid; person_empty_name_is_valid / person_absent_name_is_valid updated and passing
  • email retains unique + uniqueCaseInsensitive
  • Local owner person seed still produces a valid node and a sensible display string
  • All {"person":{"name":…}} fixtures updated
  • Decision recorded on whether person adopts a titleTemplate
  • Coordinated with Add typed property forms for packaged schemas person and project, following the task form pattern #2102 so the person form is built once against the new field set

Activity

  1. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Additions and corrections

    1. Adopt a titleTemplate — with corrected syntax

    Decided: person gets a title template composing the display string.

    The syntax is single braces, not double. interpolate_title_template_with_schema (packages/core/src/utils/markdown.rs:132-183) scans for { … }. A {{first_name}} template would emit a literal {first_name} plus a stray brace.

    {first_name} {last_name} ({email})
    

    Empty-value behaviour needs a decision. A missing/null field interpolates to nothing, but surrounding literal text is preserved (only whitespace is collapsed and trimmed, markdown.rs:181-182). With all three person fields optional, that yields:

    State Rendered title
    all three set Jane Doe ([email protected])
    no email Jane Doe () ← dangling parens
    only email ([email protected])
    nothing set `` (empty)

    The parenthesised-email form is only safe if email is effectively always present, which the schema explicitly does not guarantee. Options: (a) accept the dangling parens; (b) drop email from the template — {first_name} {last_name}; (c) extend the interpolator to drop literal text adjacent to an empty placeholder. (c) is the only one that renders correctly in every state but is a change to shared template behaviour affecting all schemas.

    Recommend (b) for the template plus keeping compute_display_name's email fallback for the nameless case — that covers every state without a dangling-punctuation edge and without changing shared interpolation. Proceeding on that basis unless redirected.

    Whichever is chosen, the template and compute_display_name (behaviors/mod.rs:2233-2255) must agree, or the title and the inline display will disagree for the same person.

    2. Add a tasks relationship to person

    Person currently has relationships: []. Add a task relationship mirroring project's (core_schemas.rs:318-329):

    SchemaRelationship {
        name: "tasks",
        target_type: "task",
        direction: Out,
        cardinality: Many,
        reverse_name: /* see below */,
        reverse_cardinality: One,
        description: "Tasks assigned to this person",
    }

    Reverse-name collision to resolve. Project's tasks relationship uses reverse_name: "project", so task already gets a reverse edge named project. Person's needs a distinct reverse name — assignee is the natural choice and matches task's existing assignee field. That collision must be settled deliberately: either name the reverse edge something else (assigned_to), or decide the relationship supersedes the scalar assignee field on task. Do not ship both a field and an edge with the same name.

    Note task's own relationships list is empty (core_schemas.rs:190) and a test asserts exactly that (core_schemas.rs:1426-1443) — reverse edges are declared from the far side. That test will need updating.

    Project's tasks relationship already exists and needs no change.

    3. friendly_name is now required on every field

    #2101 shipped (PR #2105, 5c4b437f). SchemaField now carries friendly_name as a non-optional String — person's existing name field reads friendly_name: "Name". The new fields must supply it:

    • first_name → friendly_name: "First name"
    • last_name → friendly_name: "Last name"

    Descriptions are now LLM-facing semantic content, not labels — write them accordingly rather than restating the friendly name.

    4. Ordering note

    #1998 also landed (e57af24a, "Classify node types by frontend integration, not core-list membership"), which touches the node-type classification #2102 depends on. Worth re-checking #2102's premises against current main before starting it.

  2. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Decided — template keeps all three fields

    {first_name} {last_name} ({email})
    

    Single braces, per interpolate_title_template_with_schema (packages/core/src/utils/markdown.rs:132-183). Email stays in the template — the earlier recommendation to drop it is overruled.

    Consequence: the interpolator must handle empty placeholders

    With all three person fields optional and literal text currently preserved verbatim (only whitespace collapsed/trimmed, markdown.rs:181-182), the template as written produces:

    State Today's output Wanted
    all set Jane Doe ([email protected]) same
    no email Jane Doe () Jane Doe
    only email ([email protected]) ([email protected])
    first only Jane () Jane
    nothing set (empty) (empty)

    So keeping email in the template requires extending the interpolator to drop literal text adjacent to an empty placeholder, rather than emitting orphaned punctuation.

    This is a change to shared template behaviour used by every schema, not a person-specific tweak — but it is the correct general fix: any user- or AI-authored template with optional fields and surrounding punctuation hits the same problem today. There is exactly one production call site (packages/core/src/services/node_service/crud.rs:2033), so the blast radius is contained.

    Implementation note: the rule should be "an empty placeholder consumes immediately-adjacent literal punctuation/whitespace", not "drop the whole segment" — ([email protected]) with no name must still render its parens, since those literals are adjacent to a non-empty placeholder.

    Also decided: person gets the task relationship

    Both person and project carry a task relationship. Project's already exists (core_schemas.rs:318-329); person's is new.

    The reverse-name collision flagged earlier still needs settling before implementation: project's tasks uses reverse_name: "project", and person's natural reverse name assignee collides with task's existing assignee field. Pick one — rename the reverse edge (e.g. assigned_to), or have the edge supersede the scalar field. Do not ship a field and an edge sharing a name.

    Open question — does person still sync its name into content?

    Project and task take their display name from the node's built-in content and define no name field. Person is now the exception: structured name parts plus a title template.

    The existing person form syncs name into content (person-schema-form.svelte:41-44) so person renders inline like every other type. With a title template there would be two mechanisms producing a display string, which must agree or the same person renders differently in different places.

    Decide explicitly:

    • (a) Person keeps syncing the composed name into content — the template is the composition rule, content stays the universal display source, every consumer keeps working unchanged.
    • (b) Person relies on the template alone and stops writing content — cleaner, but makes person special in every consumer that reads content for a display string.

    Recommend (a): it keeps one display-source contract across all node types and confines the change to how the string is composed. compute_display_name (behaviors/mod.rs:2233-2255) must produce the same result as the template either way.

    Added acceptance criteria

    • Template is {first_name} {last_name} ({email}) with single braces
    • Interpolator drops literal text adjacent to an empty placeholder; no orphaned punctuation in any of the states tabled above
    • Interpolator change covered by tests for other schemas' templates, not just person
    • Person declares a task relationship; reverse-name collision with task's assignee field resolved
    • Task's empty-relationships assertion (core_schemas.rs:1426-1443) updated
    • Decision recorded on content sync (option a or b), and compute_display_name agrees with the template in every state
  3. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Coordination — #2115 just landed in the file this issue changes

    a23226cd (PR #2115, ADR-065) shipped adopt-existing duplicate suggestion, and it lives in person-schema-form.svelte — the same file this issue's name → first_name/last_name split has to touch.

    What shipped:

    • person-schema-form.svelte: 116 → 255 lines. On email blur it calls find_duplicate_for and offers "use existing" (navigate to the match) / "keep as new" (dismiss). The save is never gated on the lookup — suggest-don't-block.
    • New find_duplicate Tauri command wrapping the FindDuplicate gRPC RPC; backendAdapter.findDuplicateFor on Tauri + HTTP transports; MockAdapter stub.
    • Core-side NodeService::mark_possible_duplicates stamping a non-blocking marker via OCC-bypassing set_property_bool.

    Consequences for this issue:

    1. The name-to-content sync is still the thing to delete, but the file around it has changed substantially. Re-read before editing — the earlier line reference (:41-44) is almost certainly stale.
    2. The duplicate flow keys on the email field, which this issue leaves unchanged, so the two should not conflict. Worth verifying that holds once first_name/last_name land — particularly if the title template later composes a display string used in the duplicate-suggestion UI.
    3. Sequencing: this issue, Add typed property forms for packaged schemas person and project, following the task form pattern #2102 (form rebuild), and Adopt-existing suggestion UI + convergence duplicate marker (ADR-065) #2115's shipped behaviour all converge on one file. Whoever goes next should land the schema change first, then rebuild the form around the final field set preserving the adopt-existing flow — it is shipped behaviour, not scaffolding.

    No change to this issue's decisions; this is a coordination note so the work is not planned against a stale reading of the file.

  4. malibio commented on Sep 8, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 238 test files passed, 4925 tests passed

  5. self-assigned this
    on Sep 8, 2026
  6. added a commit that references this issue on Sep 8, 2026
    3e9c81a
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