Skip to content

Replace hardcoded behavior validation with schema-driven validation #392

Closed

Description

@malibio

Problem

The NodeBehavior system (packages/core/src/behaviors/mod.rs) has hardcoded validation that conflicts with the schema system introduced in #106.

Example: TaskNodeBehavior hardcodes valid status values instead of reading from the task schema definition.

Current State

Desired State

Validation should read from schema definitions:

// CURRENT (hardcoded)
let valid_statuses = ["OPEN", "IN_PROGRESS", "DONE", "BLOCKED"];

// DESIRED (schema-driven)
let schema = schema_service.get_schema("task").await?;
let status_field = schema.fields.iter().find(|f| f.name == "status")?;
let valid_statuses = status_field.get_all_values(); // core_values + user_values

Benefits

  • ✅ Single source of truth (schema definition)
  • ✅ Supports user-extensible enums (users can add custom status values)
  • ✅ Eliminates sync issues between schema and validation
  • ✅ Enables runtime schema changes without code updates

Implementation Notes

  • Behavior system needs access to SchemaService
  • Consider dependency injection or global schema registry
  • May need async validation support in NodeBehavior trait
  • Update all behaviors (Task, Date, etc.) to use schema validation

Related Issues

Priority

Medium - Current workaround is functional but not ideal long-term

Activity

  1. self-assigned this
    on Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions