Skip to content

Implement ProjectNodeBehavior and the project core schema (#134) - #1753

Merged
mstomar125 merged 1 commit into
mainfrom
worktree-issue-134-project-node-behavior
Jul 27, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
worktree-issue-134-project-node-behavior

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Adds project as a core node type (Universal Graph model): a project SchemaNode in core_schemas.rs + a ProjectNodeBehavior registered in NodeBehaviorRegistry::new().

  • Schema: status (enum, Core, default planning, indexed, required), priority (enum, User, indexed, optional), start_date/end_date (date, User, optional). is_core: true. Mirrors the task schema.
  • Behavior: name is the node content; typed data under properties.project.*; children are has_child edges; ownership/membership are graph edges — no side table, no owner_id/team_members blob.
  • Validation split (as TaskNodeBehavior): the behavior TYPE-checks fields and enforces the cross-field start_date <= end_date rule (only when both parse as ISO YYYY-MM-DD); the schema system validates enum membership/values (not duplicated here). Empty name → MissingField; non-string status/priority/date → InvalidProperties.
  • can_have_children → true, supports_markdown → true, default_metadata seeds project.status = "planning". Projects are embeddable roots (name/description) — get_embeddable_content/get_parent_contribution return the content, unlike Task which returns None (intentional divergence, stated explicitly).

Tests

5 behavior tests + a doctest: valid full project, minimal (name only), empty-name rejection, non-string field rejection, inverted date range rejection (+ non-ISO dates skip the range check, equal dates allowed), and default_metadata shape. Updated the enumeration tests (test_registry_get_all_types 18→19, test_get_core_schemas_returns_all 17→18) and renamed a schema_test example from "Project"→"Campaign", since project is now a reserved core type a user schema can't shadow.

973 core lib tests pass; clippy clean; doctest passes; pre-push gate green.

Scope

Type only — no project UI/viewers, no status-transition workflows (#334), no on_delete (the trait has none). Per ADR corrections in the issue (Universal Graph; no projects table).

Closes #134.

Add `project` as a core node type: a `project` SchemaNode in
core_schemas.rs (status enum Core, default "planning", indexed; optional
priority enum + start_date/end_date) and a ProjectNodeBehavior registered
in NodeBehaviorRegistry::new().

Universal Graph model: the project name is the node `content`, typed data
lives under `properties.project.*`, and children / ownership are graph
edges — no side table, no owner_id/team_members blob. Validation splits as
TaskNodeBehavior does: the behavior type-checks fields and enforces
start_date <= end_date (ISO dates); the schema system validates enum
membership. Projects are embeddable roots (name/description), unlike Task.

Updates the type/schema enumeration tests (registry 18->19, core schemas
17->18) and renames a schema_test example from "Project" to "Campaign",
since `project` is now a reserved core type (a user schema can no longer
shadow it — verified by that test still creating successfully).

Closes #134.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE

Independent adversarial review — correct and complete for the core-only scope:

  • All acceptance criteria verified (schema shape mirrors task; behavior methods correct; registered; empty-name→MissingField; non-string→InvalidProperties; inverted ISO date range→InvalidProperties).
  • validate reads the properties.project namespace (not flat); is_iso_date + strict > compare is sound (len==10 guards the indexing; start==end allowed; non-ISO dates correctly skip the range check). No enum-value validation duplicated (left to the schema system). default_metadata consistent with validate.
  • Companion changes correct and necessary: enumeration counts (18→19, 17→18) and the schema_test "Project"→"Campaign" rename (a user schema can no longer shadow the reserved project id — the test still creates successfully). No other Rust enumeration site missed; NON_CONTENT_NODE_TYPES correctly does NOT list project (it's genuine content).

973 core lib tests pass, clippy clean, doctest passes, pre-push gate green.

Residual (out of scope, filed #1754): frontend first-class registration (CORE_NODE_TYPES/icon/sidenav) — projects humanize gracefully today, so not a defect. Merging.

@mstomar125
mstomar125 merged commit 624dd32 into main Jul 27, 2026
2 checks passed
@mstomar125
mstomar125 deleted the worktree-issue-134-project-node-behavior branch July 27, 2026 10:48
@mstomar125 mstomar125 mentioned this pull request Jul 27, 2026
12 tasks
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.

Implement ProjectNodeBehavior

1 participant