FlexiRule Docs
Stop: Architecture Reference
Internal implementation details and developer reference for the Stop action.
Stop: Architecture Reference#
Purpose#
The Stop action provides a clean exit point from the rule execution loop. It is designed to be minimal and leverage standard Frappe exception handling for its Error mode.
Class Structure#
StopHandler(ActionHandler)#
- Location:
flexirule/ruleflow/core/action_handlers/simple_actions.py - Responsibility: Terminates the execution flow.
- Methods:
execute(action, context, engine): Implementation of the terminal logic.
Execution Pipeline#
- Operation Check:
mode = (getattr(action, "operation", None) or "Success").strip() - Success Path: Returns
(None, None), which signals theRuleEngineto terminate the loop. - Error Path:
- Retrieves
value_template. - Builds a template context containing
doc,vars, andfrappe. - Calls
frappe.render_template. - Appends a
source_linkHTML snippet to the message for administrative traceability. - Calls
frappe.throw(message, title=_("Rule Error")).
- Retrieves
Context Mutation Model#
The Stop action is Read-Only. It never modifies the context. However, in Error mode, it causes a system-wide mutation by rolling back the current database transaction.
Dependencies#
frappe.throw: Used to raiseValidationErrorand stop the request.frappe.render_template: Used for generating dynamic error messages.
Source Files#
- Handler:
flexirule/ruleflow/core/action_handlers/simple_actions.py - Contract:
flexirule/ruleflow/core/contracts.py
Related Topics#
Was this page helpful?