Skip to content

Property support wrapped values#135

Merged
superstar54 merged 1 commit intomainfrom
update_property_validation
Jan 6, 2026
Merged

Property support wrapped values#135
superstar54 merged 1 commit intomainfrom
update_property_validation

Conversation

@superstar54
Copy link
Collaborator

@superstar54 superstar54 commented Jan 6, 2026

Each property type declares allowed_types and values are validated when assigned.

In some runtimes, users may store values using wrapper objects (for example an ORM data node that exposes a Python value via .value).
To support this without hardcoding third-party dependencies, TaskProperty.validate accepts a value if any of these match allowed_types:

  • the value itself
  • value.__wrapped__ (if present)
  • value.value (if present)
  • values returned by any registered validation adapters

External packages (e.g. an engine) can register adapters globally:

   from node_graph.property import TaskProperty

   def unwrap_custom(value):
       if hasattr(value, "get_list") and callable(value.get_list):
           return value.get_list()
       return TaskProperty.NOT_ADAPTED

   TaskProperty.register_validation_adapter(unwrap_custom)

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 86.72199% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.47%. Comparing base (a88d2fd) to head (980d686).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/node_graph/utils/json_utils.py 65.78% 13 Missing ⚠️
src/node_graph/property.py 81.81% 6 Missing ⚠️
src/node_graph/knowledge/visualization.py 92.53% 5 Missing ⚠️
src/node_graph/knowledge/graph.py 91.66% 4 Missing ⚠️
src/node_graph/properties/builtins.py 87.50% 2 Missing ⚠️
src/node_graph/semantics.py 50.00% 1 Missing ⚠️
tests/test_property_validation.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #135      +/-   ##
==========================================
- Coverage   90.65%   90.47%   -0.18%     
==========================================
  Files          74       78       +4     
  Lines        7713     7825     +112     
==========================================
+ Hits         6992     7080      +88     
- Misses        721      745      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@superstar54 superstar54 merged commit 026e11a into main Jan 6, 2026
11 of 13 checks passed
@superstar54 superstar54 deleted the update_property_validation branch January 6, 2026 12:21
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.

1 participant