Repository navigation
Fix get_workflow_state property-key lookup to use namespaced keys - #2767
Conversation
get_workflow_state built property-changed lookup keys from bare schema field names (e.g. "status"), but a property_changed trigger's property_key is always stored type-namespaced (<node_type>.<field>, e.g. "task.status") since validate_play started rejecting the bare form. The bare lookup key could never match a real trigger's index entry, so a rule scoped to a specific property key was silently absent from get_workflow_state's response even when its condition was currently satisfied. Build the lookup key as "<node_type>.<field>" to match the shape trigger_keys_for_graph_event indexes under. Also updates an existing test whose trigger fixture relied on the same bare-key coincidence, and adds a regression test that fails against the bare-key lookup and passes against the namespaced one. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Review Type: Initial Review Requirements Check:
Code Review Findings:
Recommendation: APPROVE |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Address ReviewReviewed the pragmatic-code-review findings above (Initial Review, verdict: APPROVE, 0 🔴 Critical, 0 🟡 Important, 2 🟢 Suggestions). Recommendations addressed: 0/2
No code changes made in this pass; working tree is clean. Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The review returned APPROVE with zero Critical or Important findings, and both Suggestions were explicitly informational with no action requested. No code was changed as a result of this pass, so there is nothing new for a re-review to evaluate. The PR is ready for merge (pending any other approvals). |
Summary
get_workflow_statebuilt its property-changed-trigger candidate lookup keys from bare schema field names (e.g."status"). Since #2762 (#2753's save-time enforcement), aproperty_changedtrigger'sproperty_keyis always stored type-namespaced (<node_type>.<field>, e.g."task.status") — the only spellingvalidate_play'sUnnamespacedPropertyChangedKeycheck accepts, and the exact keytrigger_keys_for_graph_eventindexes it under.The bare lookup key could therefore never match a real trigger's index entry: a rule scoped to a specific property key was silently absent from
get_workflow_state's response even when its condition was currently satisfied. The wildcard (property_key: None) lookup path was unaffected.Fix
Build the candidate lookup key as
format!("{}.{}", node.node_type, field.name)instead of the barefield.name, matching the shape enforced at save time and indexed bytrigger_keys_for_graph_event.Verification
property_key: Some(...)lookup-key construction site inget_workflow_state/its helpers.namespaced_property_changed_trigger_is_returned_as_candidate) that registers a Play with a correctly namespacedproperty_changedtrigger, callsget_workflow_statefor a node whose state satisfies the rule's condition, and asserts the rule is returned. Verified this test fails against the pre-fix bare-key code (left: 0, right: 1) and passes after the fix.trigger_property_reference_reports_unresolvable) whose trigger fixture relied on the same bare-key coincidence (bare"status"in both trigger registration and the old buggy lookup) — now uses the correctly namespaced"wf_task3.status", and was confirmed to also fail against the pre-fix code for the same reason.get_workflow_stateand its helpers for sibling bare-key assumptions the A bare property_key on a property_changed trigger never matches a real event #2753 namespacing change might have broken — none found; the wildcard lookup path and all other logic are untouched.cargo test -p nodespace-core --lib playbook::workflow_state: 8/8 passed.test:all,cargo build --bin nodespaced,test:e2e, Tauri-seam integration tests): all green.Non-goals
Scoped narrowly per the issue — does not touch the stored property format or the namespaced event key shape.
Closes #2763
Co-Authored-By: Claude Sonnet 5 [email protected]