Skip to content

Person node view: revisit _possible_duplicate, plus system-field column leak, raw-type-id titles, and hardcoded placeholders #2374

Closed

Description

@malibio

Four related problems surfaced by looking at the person node view. The first is a design question worth reopening; the rest are contained bugs.


1. Revisit _possible_duplicate — the mechanism is half-wired and out of norm

What exists

  • Create-time suggestion — live. person-schema-form.svelte:185 calls findDuplicateFor('person','email',…) on entry and offers "adopt existing".
  • Badge — built and wired into base-node.svelte, re-running the same lookup with "Use existing" / "Dismiss".
  • The marker is never set for people. NodeService::mark_possible_duplicates (services/node_service/schema.rs:186) has zero production callers — tests only. The sole live writer is mark_collection_name_collision (db/sqlite_store/nodes.rs:108), which handles collection names, from create_node / update_node.

The person path depends on "nodespace-sync's own mark_possible_duplicate" in a separate repo. On a local-only install person._possible_duplicate can never become true. The badge is unreachable, and the table column is permanently empty by construction.

No resolution path

From possible-duplicate-badge.svelte's own header:

Dismissing only closes this popover; the underlying marker is not cleared (no dismiss-persistence mechanism is in scope — see the parent ADR's non-goals), so the badge can reappear on a later render if the node is still flagged.

So: no merge, no dismiss, no clear. A flag that reappears indefinitely once set.

The design question

ADR-065 conflates two separable questions:

  1. Should a colliding write be rejected? — No. ADR-065 is right: NodeSpace is local-first, two offline devices can each validly create the same person, and rejecting at convergence turns a benign duplicate into a stuck sync cursor. This part is not in dispute.
  2. Should the resolution live as a per-type boolean on the node? — This is what deserves review.

The flag approach has produced: a system field leaking into every table view, a badge with no resolution path, a marker nothing ever clears, and parallel implementations for person-email and collection-name that already accept the same TOCTOU caveat independently.

A conflict-resolution surface — one place listing convergence conflicts of every kind, with actions — generalises where a per-type boolean does not. That matters as more converging types arrive.

ADR-065 already deferred this: "Full admin-driven merge (re-pointing edges, tombstoning the loser) is deliberately deferred until the prevention/suggestion layers prove insufficient." They arguably have: suggestion works, convergence marks nothing locally, and nothing resolves.

Note email should stay unique in the schema-declared sense. The question is not whether uniqueness is declared, but whether suggest-don't-block plus a per-node boolean is the right expression of it, versus a first-class conflict queue.

Where the handling should live

Steer from the issue author: this belongs in the generic node layer or NodeService, not as per-type machinery bolted onto person.

That extends ADR-065's own reasoning. §1 put unique evaluation in NodeService rather than in NodeBehavior precisely because uniqueness is a cross-node invariant, and because a per-type Rust behavior cannot serve schema-only extension types that have no behavior at all. The identical argument applies to resolution: a conflict surface implemented per type cannot serve user-defined types, and the current split is already evidence — person.email marking lives in nodespace-sync, collection name marking lives in SqliteStore, and the two independently accept the same TOCTOU caveat.

A generic mechanism would let any type declaring a converging constraint participate without new per-type code, which is the property that matters as more such types arrive (playbook among them).

  • Decide: keep the per-type marker, or replace it with a general conflict-resolution surface
  • Whatever is built lives in the generic node layer / NodeService, usable by schema-only extension types with no Rust behavior — not per-type machinery
  • If kept: give it an actual resolution path (merge, or a dismiss that persists)
  • If kept: document why person.email marking lives in nodespace-sync while collection-name marking lives in core
  • If replaced: migrate the collection-name collision path onto the same mechanism
  • Either way: the marker must stop appearing as a user-facing table column (see item 2)
  • Revisit ADR-065's deferral now that the suggestion layer is shipped and the convergence layer is not

2. Table view leaks protection: "system" fields as columns

table-view.svelte:43 iterates schema.fields with no protection filter. generic-schema-form.svelte:51 does it correctly:

const visibleFields = $derived(schema.fields.filter((f) => f.protection !== 'system'));

So the detail view correctly shows only Name and Email, while the table renders a third column, "Possible duplicate" — a localOnly, system-managed field documented as "Never written directly".

This affects every node type, not just person. ai-chat has several system fields (last_active, context_tokens, created_nodes, capture:session_id, capture:transcript, capture:summary) that would leak the same way.

There is already a generic-schema-form-protection-filter.test.ts guarding the form side. The table has no equivalent.

  • table-view.svelte filters protection !== 'system' when deriving columns
  • Regression test mirroring generic-schema-form-protection-filter.test.ts
  • Verified against ai-chat, which has the most system fields

3. Untitled nodes fall back to "<raw type id> Node" — the plugin-name branch is gated out

The tab reads "person Node" — lowercase raw type id, not a phrase anyone would write.

A plugin-name lookup already exists and is meant to handle this (navigation-service.ts:145-148):

if (rendersAsEntityRow(node.nodeType)) {
  const plugin = pluginRegistry.getPlugin(node.nodeType);
  if (plugin?.name) return plugin.name;
}

// Fallback to node type
return `${node.nodeType} Node`;

person's plugin registers name: 'Person' (core-plugins.ts:652), so the branch would return the right thing. It never runs, because the gate excludes person:

// node-type-predicates.ts:36
export function rendersAsEntityRow(nodeType: string): boolean {
  return !hasInlineNodeComponent(nodeType);
}

person does register an inline node component (core-plugins.ts:663, person-node.svelte), so rendersAsEntityRow('person') is false, the branch is skipped, and control reaches the raw-type-id fallback.

The gate's intent is sound and documented at lines 142-144: inline-editable types name their plugins for the registry ("Text Node", "Header Node"), so using those as titles would render "Text Node" for an untitled text node. The problem is that the gate asks "does this render as an entity row?" when the question it needs to answer is "is this plugin name a user-facing entity noun?" person has both an inline component and an entity-noun name — a combination the gate does not anticipate.

Proposed behaviour: Untitled <schema display name> ("Untitled Person"), applied generically after the node's own title/content and its titleTemplate have both failed. That is better than bare "Person" too, since it distinguishes an unnamed node from a named one.

Fixing the gate rather than special-casing person is the point — otherwise every future type with both an inline component and an entity noun hits this again.

  • Fallback reads Untitled <schema display name>, not <raw type id> Node
  • The gate distinguishes "plugin name is a user-facing noun" from "renders as an entity row", rather than conflating them
  • Untitled text / header still avoid rendering "Text Node" / "Header Node" as titles — the original reason the gate exists
  • Applies only after title/content and titleTemplate both yield nothing
  • Works for user-defined schema types, not just core ones

4. Form placeholders are hardcoded, and one restates its own label

person-schema-form.svelte:266 hardcodes placeholder="Display name" on a field already labelled Name — the placeholder restates the label instead of showing an example. email gets it right ([email protected]).

The string traces to the schema field's description ("Display name; optional — a person may exist before a name is set"), which is documentation, not placeholder text — which is why it reads oddly in the slot.

SchemaField has no placeholder field (confirmed: only friendly_name, description, field_type, default). So every type-specific form invents its own, and they drift.

Immediate fix: make it an example (or drop it). Larger question: should SchemaField gain a placeholder? Worth it if generic-schema-form is meant to fully replace per-type forms — the placeholder is otherwise the one bit of presentation that cannot be schema-driven. Overkill if per-type forms are staying.

  • name's placeholder stops restating its label
  • Decide whether SchemaField gains a placeholder field
  • If added: generic-schema-form uses it, and per-type forms stop hardcoding
  • Audit other per-type forms for the same label-restating pattern

Context

Found while reviewing the person node view on a clean v0.2.7 install. Item 1 is a design question (ADR-065); items 2-4 are contained. Item 2 is the one with blast radius beyond person.

Activity

  1. added
    bug
    on Sep 7, 2026
  2. malibio commented on Sep 7, 2026

    @malibio
    CollaboratorAuthor

    Item 1 (the _possible_duplicate design question) is answered and moved to #2377.

    ADR-066 — Convergence Conflicts Are Local-Only Records in a Generic Conflict Journal, Not Per-Node Boolean Flags (nodespace-docs/decisions/066-convergence-conflicts-are-records-not-flags.md), with the data shape and resolution surface specified in nodespace-docs/components/conflict-journal-and-resolution.md.

    Short version: the per-node boolean is deleted and replaced by a local-only conflict table holding records that carry participants, evidence, and a resolution lifecycle (dismiss-with-persistence, adopt, rename, restore, merge). ADR-065's suggest-don't-block holding is unchanged — colliding writes are still never rejected — but its §4 representation is replaced and its deferral of merge is lifted. Recovered Items folds into the same journal. This is also what makes the mechanism reachable on a local-only install, which it is not today.

    Items 2-4 here (system-field column leak, raw-type-id titles, hardcoded placeholders) are unaffected and stay in this issue. Note that item 2's column leak resolves for this field specifically as a side effect of #2377 deleting it, but the general table-view leak is still its own fix.

  3. self-assigned this
    on Sep 9, 2026
  4. mstomar125 commented on Sep 9, 2026

    @mstomar125
    Contributor

    Frontend baseline: 239 test files, 4929 tests passed. Scope confirmed: items 2-4 only (item 1 moved to #2377, actively owned elsewhere). Item 2 (table-view system-field leak) found already fully fixed on main via duplicate issue #2376 -> PR #2404 (merged 2026-09-07): filter + regression test (table-view-protection-filter.test.ts) already cover person and all six ai-chat system fields. Proceeding with items 3 and 4.

  5. mstomar125 commented on Sep 9, 2026

    @mstomar125
    Contributor

    Items 2-4 resolved in PR #2533 (branch issue-2374-table-title-placeholder-fixes). Item 1 (_possible_duplicate design question) remains out of scope here, tracked in #2377.

    Item 2 — table-view system-field leak: already fully fixed on main before this session started, via a duplicate issue (#2376) and PR #2404 (merged 2026-09-07). Both the filter (table-view.svelte uses the shared isUserVisibleField predicate) and a regression test (table-view-protection-filter.test.ts, covering person's _possible_duplicate and all six of ai-chat's system fields) are already in place and verified passing. No new change needed for this item.

    Item 3 — untitled-node title fallback: fixed. navigation-service.ts's generateTabTitle gated its plugin-name fallback on rendersAsEntityRow alone, so person (which has an inline node component) fell through to the raw 'person Node' instead of using its plugin name. Added a new, independent hasEntityNounName predicate (PluginDefinition.entityNoun) answering 'is this plugin's name a real user-facing noun', distinct from rendersAsEntityRow ('does this render as a read-only row') — person opts in, rendersAsEntityRow itself is untouched (it still drives arrow-nav/entity-row rendering elsewhere). The fallback text is now 'Untitled ' (e.g. 'Untitled Person'), applied uniformly to every type that reaches this branch, not just person. text/header/task are unaffected and keep the original raw ' Node' fallback — verified with explicit new tests plus mutation testing.

    Item 4 — hardcoded placeholder restating its label: fixed. person-schema-form.svelte's name field(s) (now first_name/last_name after an intervening, unrelated PR #2508 split the single 'name' field — same bug, different field names) had placeholder text identical to their own labels. Replaced with example values ('Jane'/'Doe'), matching the email field's existing '[email protected]' pattern.

    Decided AGAINST adding a placeholder field to SchemaField — reasoning is in the PR description in detail, short version: only 2 per-type forms exist codebase-wide (task, person) and both are documented as staying (bespoke business logic GenericSchemaForm can't express), task has zero hardcoded placeholders to migrate, PR #2508 (2 days prior) deliberately kept person's form hardcoded rather than migrating to GenericSchemaForm even while consolidating title composition into the schema, and the Rust SchemaField struct is constructed via ~60 exhaustive struct literals with no ..Default::default() usage — adding a field means touching all of them for a benefit that lands on exactly 3 fields in 1 form today.

    Full detail, reasoning, and test plan (mutation-tested every new/changed test, bun run test:all clean, quality:fix clean) in PR #2533: #2533

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

Metadata

Metadata

Assignees

Labels

architecturebug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions