Skip to content

Relocate Rule Trigger Condition to Entry Action Config (Release N)#270

Open
ruzaqiarkan-eng wants to merge 2 commits into
trigger-condition-deprecation-audit-11886580423312967736from
deprecate-trigger-condition-release-n-4521664746683897442
Open

Relocate Rule Trigger Condition to Entry Action Config (Release N)#270
ruzaqiarkan-eng wants to merge 2 commits into
trigger-condition-deprecation-audit-11886580423312967736from
deprecate-trigger-condition-release-n-4521664746683897442

Conversation

@ruzaqiarkan-eng

Copy link
Copy Markdown
Collaborator

This PR implements the Release N phase of relocating the Rule Trigger Condition from the root Rule DocType to the Entry Action child table configuration.

Changes:

  • Backend API: Added get_entry_action() and get_entry_condition() to Rule. resolve_entry_condition() implements the dual-read logic where data in the Entry Action config takes priority over the legacy trigger_condition field.
  • Architectural Purity: Updated compile_conditions, RuleCoordinator, SubRuleHandler, and compile_service to use the new encapsulated APIs instead of direct field reads.
  • Migration: Added an idempotent patch migrate_trigger_condition_to_entry_action.py that safely moves data to the Entry Action config for all existing rules, logging ambiguities to frappe.log_error.
  • Frontend: Modified useRuleStore.js to implement dual-write behavior. Changes to the Start Node condition are now persisted to both the legacy field and the child table config during the transition period.
  • Testing: Added test_migration.py covering case-by-case migration logic and idempotency. Verified all backend tests pass.

PR created automatically by Jules for task 4521664746683897442 started by @ruzaqiarkan-eng

- Implemented `get_entry_action` and `get_entry_condition` in `Rule` class.
- Added dual-read compatibility layer with priority: Entry Action config > trigger_condition.
- Updated `Rule.compile_conditions` and runtime components (`RuleCoordinator`, `SubRuleHandler`) to use encapsulated APIs.
- Implemented conservative migration patch for relocating legacy conditions.
- Updated Rule Builder frontend to support dual-writing Start Node conditions.
- Added unit tests for migration and validated all existing rule tests.
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant