Skip to content

Default new-node content to "Untitled {Type}" for name-as-content Core types - #2018

Merged
mstomar125 merged 2 commits into
mainfrom
issue-1995-untitled-content
Aug 10, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-1995-untitled-content

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

project and skill are Core types whose content field is the node's name, not body text — their NodeBehavior::validate() rejects empty content. The sidebar "+New" path (createSchemaInstance) always created with content: '', so creation always failed validation for these types — they had no working creation path. Closes #1995.

Change

  • schema-authoring.ts: createSchemaInstance seeds "Untitled {DisplayName}" for an explicit NAME_AS_CONTENT_TYPES set (project, skill, collection, agent-guidance, tool — all share the non-empty-content constraint); every other type keeps content: ''.
  • schema-plugin-loader.ts: export the existing humanizeSchemaId helper (reused for the display name — agent-guidance → "Untitled Agent Guidance").

Kept as an explicit list per the issue's guidance: no frontend signal (schema field, isCore, field count) distinguishes name-as-content Core types from primitives, so inferring the set would silently drift.

Non-goals honored

  • Body-content types (text, header, task, code-block, …) unchanged — empty content is correct ("start typing").
  • titleTemplate/custom types unchanged — content stays '' per schema-management.md.
  • Backend validation untouched (frontend default-content fix only).

Tests

Extended schema-authoring.test.ts (+2): the 5 name-as-content types each round-trip "Untitled {Type}"; text/header/task/code-block/invoice stay empty. Full frontend suite green (192 files / 4452 tests); eslint + svelte-check clean; pre-push gate passed.

🤖 Generated with Claude Code

mstomar125 and others added 2 commits August 10, 2026 11:59
…e types

project/skill (and collection/agent-guidance/tool, which share the constraint)
are Core types whose content field is the node's name — their NodeBehavior
rejects empty content. The sidebar "+New" path (createSchemaInstance) always
created with content:'' and so always failed validation for these types, leaving
them with no working creation path.

Seed "Untitled {DisplayName}" for that explicit set; body-content types
(text/header/task/…) and titleTemplate/custom types are unchanged — empty
content is correct for them. Kept as an explicit list since no frontend signal
distinguishes name-as-content Core types from primitives. Reuses the existing
humanizeSchemaId helper (now exported).

Closes #1995.

Co-Authored-By: Claude <noreply@anthropic.com>
Comment-only: note that including tool in the name-as-content set keeps the
content rule uniform but does not by itself make a bare tool creatable (its
validation also requires a non-empty handler).

Co-Authored-By: Claude <noreply@anthropic.com>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Pragmatic Code Review + /address-review

Verdict: APPROVE. Load-bearing check passed — the 5 NAME_AS_CONTENT_TYPES ids match the actual behavior.type_name() registry keys (project/skill/collection/agent-guidance/tool), and grepping every content.trim().is_empty() in behaviors/mod.rs confirms exactly these 5 gate creation on non-empty content — set is complete and not over-broad. humanizeSchemaId('agent-guidance') → Agent Guidance. Non-goals honored (primitives + titleTemplate/custom stay ''). 12/12 unit tests + full frontend suite green.

🟡 tool inclusion is slightly misleading — addressed: added a comment noting tool's validation also requires a non-empty handler, so this content default alone doesn't unblock bare-tool creation; it keeps the content rule uniform for a future tool-creation path. Kept in the set per the issue's explicit "for consistency" guidance (tool genuinely shares the non-empty-content constraint).

🟡 coupling (humanizeSchemaId in the heavier schema-plugin-loader) — evaluated and skipped with reasoning: no circular import (verified), zero runtime cost (backend-adapter is already a dep; plugin-registry is a lightweight singleton already loaded where "+New" lives). Moving one pure helper to a new single-purpose util is lateral churn, not a clear win, and the issue pointed at this exact helper; consolidating with the existing humanizeName is out of scope.

Re-Review Decision: NO RE-REVIEW NEEDED — only a clarifying comment was added.

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.

Default new node content to "Untitled {Type}" for name-as-content core types (project, skill)

1 participant