Skip to content

Fix entity-noun title gate and person placeholders (#2374 items 2-4) - #2533

Merged
mstomar125 merged 1 commit into
mainfrom
issue-2374-table-title-placeholder-fixes
Sep 9, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-2374-table-title-placeholder-fixes

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Addresses items 2-4 of #2374 (item 1, the _possible_duplicate design question, moved to #2377 and is owned by a separate, active workstream — untouched here).

Item 2 — table-view system-field leak: already fixed, no change needed

table-view.svelte was already filtering protection: 'system' fields (via the shared isUserVisibleField predicate) and already had a regression test (table-view-protection-filter.test.ts) covering person's _possible_duplicate and all six of ai-chat's system fields — landed by PR #2404 against a duplicate issue (#2376) two days before this session started. Verified the fix and its tests are still correct and passing; nothing further to do.

Item 3 — untitled-node fallback showed the raw type id ("person Node")

navigation-service.ts's generateTabTitle gated its plugin-name fallback on rendersAsEntityRow alone. person has an inline node component, so rendersAsEntityRow('person') is false, and it fell all the way to ${nodeType} Node → "person Node".

Fix:

  • New PluginDefinition.entityNoun flag (types.ts) and hasEntityNounName predicate (node-type-predicates.ts / PluginRegistry), answering "is this plugin's name a real user-facing noun" — a genuinely different question from rendersAsEntityRow ("does this render as a read-only row"). person opts in; rendersAsEntityRow itself is untouched, since it also drives arrow-nav skipping and entity-row rendering elsewhere and those must not change.
  • The fallback gate is now rendersAsEntityRow(type) || hasEntityNounName(type).
  • The fallback text changed from a bare name ("Person") to "Untitled <name>" ("Untitled Person") — applied uniformly to every type that reaches this branch (ai-chat, document, user, collection, user-defined schema types, and now person), not just person, per the issue's own reasoning that it "distinguishes an unnamed node from a named one."
  • Title/content resolution now goes through the shared resolveTitleOrContent helper (already used by node-row.svelte/plugin-registry.ts) instead of an ad hoc duplicate check, so a title_template-driven type (person) with stale content left over from before a type conversion can no longer leak through instead of reaching the fallback.
  • text/header/task (and any other inline-editable, non-entity-noun type) are untouched — they still fall through to the original raw "<type> Node" form. New tests pin this explicitly for text and header.

Item 4 — hardcoded placeholder restating its own label

person-schema-form.svelte's name field was hardcoded as placeholder="Display name" when the issue was filed; by the time this session started, an unrelated PR (#2508, "Person schema: replace name with first_name and last_name") had already split it into first_name/last_name inputs — but the same bug persisted, now literally placeholder="First name" on a field labeled "First name" (and the same for last name). Fixed to example values ("Jane"/"Doe"), matching how the email field already does it ("[email protected]").

Decision: did not add a placeholder field to SchemaField. Reasoning:

  • Only two per-type forms exist in the entire codebase — task and person — both explicitly documented (types.ts) as reserved for types with genuine bespoke business logic (task's status state machine, person's duplicate-detection UX) that GenericSchemaForm cannot express regardless of placeholder support. There's no evidence of "drift across many forms" — the bug was isolated to these 3 fields in 1 form. task-schema-form.svelte has zero hardcoded placeholders to migrate (its fields are all Select/date-picker, no free text).
  • The most recent related change (PR Person schema: replace name with first_name and last_name #2508, 2 days before this session) explicitly consolidated title composition into titleTemplate but deliberately kept person's form hardcoded rather than migrating it to GenericSchemaForm — the strongest available signal that per-type forms are staying, not being phased out.
  • Concretely: the Rust SchemaField struct (nodespace-types/src/schema.rs) is constructed via ~60 exhaustive struct literals across core_schemas.rs, markdown.rs, schema_node.rs, schema/mod.rs, context_ops.rs, and entity_types_block.rs — none using ..Default::default(). Adding a field there means touching all ~60 call sites for a benefit that, today, would land on exactly one form's three text inputs.
  • GenericSchemaForm's SchemaFieldLeaf does have a real (if narrow) gap — it only derives a placeholder from field.default, nothing else — but that's a separate, independently-decidable architectural question, not one this issue's contained scope obliges fixing given the above.

Why one PR

All three items are independent but small (9 files, ~220 lines, cleanly separable by file), and item 4 turned out to be simpler than expected (a decision against a schema change, not an implementation of one) — so landing them together keeps review simple without inflating any single PR's surface.

Test plan

  • bun run test — 239 files, 4939 tests passed (10 new: 4 hasEntityNounName predicate tests, 5 generateTabTitle fallback tests incl. text/header/ai-chat/stale-content-ignored, 1 placeholder test)
  • Every new/changed test mutation-tested individually (temporarily broke the invariant, confirmed the expected failure, restored, confirmed pass) — entityNoun flag, Untitled prefix, resolveTitleOrContent template gating, the text/header raw-fallback regression guard, and the placeholder test all independently verified to fail on the corresponding regression.
  • bun run quality:fix — eslint, svelte-check, tsc, cargo fmt, cargo clippy (-D warnings -D clippy::unused-async) all clean
  • bun run test:all (unit + browser + skill + full Rust workspace) — 0 failures
  • Pre-push gate (test:all + cargo build --bin nodespaced + test:e2e) — green, pushed successfully

Confirmation: no regressions to text/header/ai-chat

  • text/header: explicit new tests confirm untitled nodes of these types still produce the original raw "text Node"/"header Node" fallback (mutation-tested: forcing the new gate to always pass makes these tests fail, confirming they actually exercise the guard).
  • ai-chat: already an entity row before this change (unaffected by the entityNoun gate), so its only behavior change is the same "Untitled " prefix every entity-row type now gets — explicit new test confirms "Untitled AI Chat".
  • table-view (item 2): unaffected by this PR entirely — that fix predates this session.

Closes #2374 (items 2-4; item 1 lives on in #2377).

🤖 Generated with Claude Code

…#2374)

Table-view system-field leak (item 2) was already fixed on main by a
duplicate issue's PR before this session started; verified still passing,
no change needed here.

Untitled-node fallback (item 3): 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 its plugin name. Splits the gate into two independent predicates:
rendersAsEntityRow (unchanged, still drives arrow-nav/entity-row rendering)
and the new hasEntityNounName (whether a plugin's name is a real noun, not
a registry label like "Text Node"). person opts in via
PluginDefinition.entityNoun. The fallback itself now reads
"Untitled <name>" instead of a bare name, applied uniformly to every type
that reaches it (ai-chat, document, user, collection, user-defined schema
types, and now person) rather than only person. Also switches title/content
resolution to the shared resolveTitleOrContent helper so a title_template-
driven type's stale content can no longer leak through before reaching the
fallback. text/header/task keep their original raw "<type> Node" fallback
unchanged.

Hardcoded placeholders (item 4): person-schema-form's first/last name
inputs placeholder'd their own labels back ("First name" input labeled
"First name"). Replaced with example values, matching how the email field
already does it. Did not add a placeholder field to SchemaField: only two
per-type forms exist in the whole codebase (task, person), task has no
hardcoded placeholders to migrate, and the Rust SchemaField struct
(nodespace-types) is constructed via ~60 exhaustive struct literals across
core_schemas.rs/markdown.rs/schema_node.rs/schema/mod.rs/context_ops.rs/
entity_types_block.rs with no ..Default::default() usage, so a new field
would require editing all of them for a benefit that would land on exactly
one form with three fields.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Reviewed (adversarial pass): item 2's already-fixed claim independently confirmed (PR#2404, merged 2026-09-07, current main already filters via isUserVisibleField — PR#2533 touches neither file). Item 3's hasEntityNounName confirmed purely additive, text/header regression explicitly tested and correct, new tests traced by hand and correctly shaped to fail on pre-fix code for person/ai-chat/stale-content cases. Item 4's placeholder-field-cost reasoning independently verified (75 SchemaField literal constructions repo-wide, zero using ..Default::default(), exactly 2 hardcoded per-type forms with task having zero placeholders to migrate) — a well-cited judgment call, not corner-cutting. Scope clean, no stray changes. Merging.

@mstomar125
mstomar125 merged commit 7be7294 into main Sep 9, 2026
@mstomar125
mstomar125 deleted the issue-2374-table-title-placeholder-fixes branch September 9, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant