Repository navigation
Description
Overview
Implement ProjectNode as a core node type: a project schema entry in core_schemas.rs plus a ProjectNodeBehavior (validation + computed display name). Projects are containers for tasks, milestones, and related work.
Rewritten to align with the Universal Graph model and the current
NodeBehaviortrait. Supersedes the original pre-Universal-Graph body, which referenced a "Projects Table", ametadatablob,default_metadatadefaults, and anon_delete/DeletionActionAPI — none of which exist in the current architecture.
Read first
components/node-behavior-system.md— Core (hardcoded) vs Extension (schema-driven) behavior architecturecomponents/schema-management.md— protection levels, namespace enforcement
Data model (Universal Graph)
ProjectNode is a node with node_type = 'project'; its data lives under properties (type-namespaced properties.project.*, per the Issue #397 pattern used by TaskNodeBehavior). There is no projects side table — indexed querying is handled by the schema field indexed: true flag, not a complementary table.
Children (tasks, milestones) are real graph nodes attached via has_child edges, not a team_members/array blob.
Core fields on the project schema
| Field | Type | Protection | Notes |
|---|---|---|---|
status |
enum | Core | planning / active / completed / archived / cancelled. Default planning. indexed: true. |
start_date |
date | User | Optional. |
end_date |
date | User | Optional. If both present, start_date <= end_date. |
priority |
enum | User | Optional. low / medium / high (mirror task.priority). indexed: true. |
Project name is the node's content (like Collection and Task), not a property. Ownership/membership are modeled as graph edges (e.g. a person member_of or an owns edge), not an owner_id/team_members property blob — do not re-introduce those.
Validation split (IMPORTANT — matches TaskNodeBehavior)
The behavior does type checks; the schema system validates enum membership and values. Do not duplicate enum-value validation in the behavior.
- Behavior
validate→Result<(), NodeValidationError>:content(project name) non-empty → elseNodeValidationError::MissingField.statusmust be a string if present (type check only) → elseNodeValidationError::InvalidProperties.start_date/end_date: if present, must be strings; if both present and both parse asYYYY-MM-DD, enforcestart <= end→ elseNodeValidationError::InvalidProperties. (String comparison is acceptable for ISO dates; chrono optional.)prioritymust be a string if present.
- Read project properties from the namespace:
node.properties.get("project").
Implementation Tasks
- Add a
projectSchemaNodetopackages/core/src/models/core_schemas.rswith the fields above. Mirror thetaskschema'sSchemaFieldshape (enumcore_valuesforstatus/priority,field_type: "date"for the dates,indexedflags).is_core: true. - Implement
ProjectNodeBehaviorimplementing the currentNodeBehaviortrait. Methods to implement:type_name→"project",validate(above),can_have_children→true,supports_markdown→true(rich descriptions),default_metadata→serde_json::json!({ "project": { "status": "planning", "start_date": null, "end_date": null, "priority": null } }). - Implement
get_embeddable_content(project name + any description content) andget_parent_contributionconsistent with the embeddings model — projects carry semantic content worth embedding, so unlike Task, return the name/description rather thanNone. Confirm againstnode-behavior-system.md. - Register it in
NodeBehaviorRegistry::new()(packages/core/src/behaviors/mod.rs~L2089) alongside the existingregistry.register(Arc::new(...))calls.
Acceptance Criteria
-
projectschema entry exists incore_schemas.rswithstatus(Core, defaultplanning, indexed) and optionalstart_date/end_date/priority. -
ProjectNodeBehaviorimplements allNodeBehaviortrait methods and is registered inNodeBehaviorRegistry::new(). - Empty project name (
content) rejected withMissingField. - Non-string
status/priority/date fields rejected withInvalidProperties. -
start_date > end_date(both present, both ISO) rejected withInvalidProperties. -
can_have_children()→true;supports_markdown()→true. - Unit tests cover: valid full project, minimal project (name only), empty-name rejection, non-string field rejection, invalid date range, and
default_metadatashape. - Passes
cargo clippy; no lint suppression; no#[allow(dead_code)].
Scope
In scope: ProjectNode the type — project schema + ProjectNodeBehavior + validation + tests.
NOT in scope:
- Project management UI / viewers.
- Status-transition workflows or automation (see [FUTURE] Implement Workflow/Automation System #334).
- A
projectsside table — does not exist (Universal Graph). on_delete/ cascade behavior — the trait has noon_deletemethod; deletion semantics are handled centrally, not per-behavior.
Architecture corrections vs. the original issue (for reviewers)
The pre-Universal-Graph body was inaccurate. Current reality:
- Trait method is
validate(&self, node: &Node) -> Result<(), NodeValidationError>(notValidationError); variants areMissingField/InvalidProperties/InvalidId. - No
on_delete/DeletionActionon theNodeBehaviortrait. - Data lives under type-namespaced
properties.project.*, not ametadatablob. - No
projectscomplementary table; noowner_id/team_members/budgetproperty blob. - Project name is
content, consistent with Task and Collection.
Activity
mstomar125 commentedon Jul 27, 2026
Resolved in #1753 (merged to
mainas624dd323).Implemented
projectas a core node type (Universal Graph model):core_schemas.rs):status(enum, Core, defaultplanning, indexed, required),priority(enum, User, indexed, optional),start_date/end_date(date, User, optional).is_core: true.ProjectNodeBehavior(registered inNodeBehaviorRegistry::new()): name is the nodecontent; typed data underproperties.project.*; no side table / owner_id / team_members blob. Behavior type-checks fields + enforcesstart_date <= end_date(ISO dates only); the schema system validates enum membership.can_have_children/supports_markdown→ true. Projects are embeddable roots (name/description), unlike Task.5 behavior tests + a doctest; enumeration tests updated (registry 18→19, core schemas 17→18); a
schema_testexample renamed "Project"→"Campaign" sinceprojectis now a reserved core id a user schema can't shadow. 973 core lib tests pass, clippy clean, gate green, independent review confirmed.Follow-up filed #1754: frontend first-class registration of
project(CORE_NODE_TYPES, icon registry, sidenav) + eventual project viewer. Out of this core-only scope; projects humanize gracefully today.Register project as a built-in frontend node type (closes #1754) (#1774)