Optional technical reference. This material is for developers, integration specialists and platform administrators. For the consultant lesson, read the practical guide.
Preserved from source baseline
d4587c7c0e073e58c2d430342f65ac55dd701bf4; source/static examples retain their stated scope. They are not new runtime verification or required consultant setup steps.
Current model-key correction — 8 November 2026. The preserved examples below contain historical camelCase record-type/field keys. Do not copy those keys into the current editor or API: use record type leave_request and the lowercase field keys in the current model worksheet, including request_id, employee_id, manager_id, start_date, end_date, requested_days and decision_comment. Form, rule and case input names are separate declarations; map them explicitly rather than mechanically renaming every input. The preserved body remains historical source material, not a current executable model payload.
Rule Types Functional Specification
Choose the rule kind for its actual runtime
A rule kind selects a contract and execution boundary, not just an editor tab. Current user-authored basic kinds include CONSTANT, EXPRESSION, DECISION_TABLE and QUERY; specialized kinds have their own real contracts for generated record CRUD, AI tasks, Integrations and document generation. SCREEN is an internal published-interface handle. The later Validation/Routing/Calculation proposals remain target concepts rather than values accepted by the current closed enum.
Define inputs and output meaning first. A pure eligibility expression answers a question; a generated CRUD rule changes records through its native secured writer; an Integration rule invokes an exact published contract; an AI task requires the admitted gateway/disclosure path. Treating them as interchangeable expression text would bypass their intended lifecycle and failure behavior.
| Stage | What to review |
|---|---|
| Draft create | Actual ruleKey, name, kind, body text and input definitions. |
| Draft update | Current supported update contract; do not assume all rules use screen-style revision fields. |
| Validate/publish | Kind-specific body grammar, dependencies, caller/publication constraints and any specialized review path. |
| Execute | Declared input envelope and exact published semantics required by the chosen kind. |
| Expose API | Separate explicit exposure/registry/key policy, not automatic access from publication. |
| Diagnose | Kind-specific validation and safe execution history/receipt; unknown outcome is not proof of no effect. |
Use the following cases to distinguish contracts before copying a body. The JSON examples identify complete request versus inner-body fragments explicitly, and the existing detailed design sections remain available below.
Worked examples
Example DATA-RULE-01 — Publish a Constant policy without a fake expression body
Scenario and inputs. Nadia defines a simple maximum request quantity for the teaching application. A Constant body holds a value; it is not executable expression text. The outer HTTP create body also contains a string-valued body, so raw inner JSON and outer request JSON must not be confused.
Procedure. 1. Create the draft through POST /api/rules/drafts with the complete body below under the permitted rule-authoring context. 2. Retain the actual returned draft ID. 3. Review the constant type/value and publish through /api/rules/drafts/{draftId}/publish using the current exposure/publication policy. 4. Keep exposeAsApi false unless the separate machine-consumer design genuinely needs it. 5. Consume the published constant through the normal permitted resolver, and record the actual version/semantics needed by downstream rules.
{
"ruleKey": "leave-max-days",
"name": "Maximum leave days",
"kind": "CONSTANT",
"body": "{\"value\":12}",
"inputs": []
}
Expected result. The published rule supplies the configured numeric policy value 12. Creating or reading it does not deduct days, approve leave or grant another actor access to the policy. The selected kind determines constant parsing rather than expression evaluation.
Failure and recovery. If body text is invalid JSON or violates a specialized constant-reference contract, fix that value under the owning validator. Do not switch kinds to EXPRESSION simply to bypass a useful constant check, and do not expose an API to work around a denied internal dependency.
Sources. RuleKind.java, RuleDefinitionController.java.
Example DATA-RULE-02 — Create and call a typed Expression eligibility rule
Scenario and inputs. The application needs the Boolean leave-eligible rule for requested versus available days. Both values are required INTEGER inputs; availableDays comes from the application’s admitted balance source. The full create request below does not claim a runtime balance has been fetched or a task action has been accepted.
Procedure. 1. Send the complete create-draft body through /api/rules/drafts and retain its actual draft ID. 2. Validate and publish that reviewed draft through the current kind-specific path. 3. Execute the published rule through its supported /api/rules/{ruleKey}/execute contract using an inputs map and the actual version semantics required by the consumer. 4. Test 5/12,13/12, zero requested days, a missing value and an unknown supplied input. 5. Map the Boolean result into the workflow’s eligibility decision, preserving separate manager participation and mutation authorization.
{
"ruleKey": "leave-eligible",
"name": "Leave eligibility",
"kind": "EXPRESSION",
"body": "inputs:requestedDays > 0 and inputs:requestedDays <= inputs:availableDays",
"inputs": [
{
"name": "requestedDays",
"typeName": "INTEGER",
"required": true,
"multiple": false
},
{
"name": "availableDays",
"typeName": "INTEGER",
"required": true,
"multiple": false
}
]
}
Expected result. Valid 5/12 evaluates true and 13/12 false. Requiredness and type checks are part of the published input contract, so malformed input must not become an invented permissive Boolean answer.
Failure and recovery. A missing/unknown input, retired namespace separator or invalid expression should be corrected in the relevant contract/mapping. Do not add unsupported generic receipt fields or screen revision keys to the rule request, and do not treat true as proof that any downstream task completion or record update succeeded.
Sources. RuleKind.java, RuleDefinitionController.java.
Example DATA-RULE-03 — Read a decision table’s hit policy before adding rows
Scenario and inputs. Sara’s application needs a small deterministic recommendation table: requests beyond an admitted threshold need review, and the remaining cases receive the normal recommendation. Nadia chooses DECISION_TABLE rather than encoding a hidden effect in a condition. The following JSON is the inner table body, not a complete create request or automatic manager approval.
Procedure. 1. Declare the actual input contract, including the numeric requestedDays field. 2. Choose FIRST when row order is intentional; use the supported COLLECT policy only when the consumer accepts its different result shape. 3. Place specific conditions before an explicit final default row, and give outputs the agreed shape. 4. Validate the table body and expression syntax, then test a value matching the first row, one reaching the default and boundary values. 5. Publish the reviewed rule and let its actual consumer decide what to do with the returned recommendation.
{
"hitPolicy": "FIRST",
"rows": [
{
"when": "inputs:requestedDays > 10",
"output": {
"recommendation": "REVIEW"
}
},
{
"when": "",
"output": {
"recommendation": "STANDARD"
}
}
]
}
Expected result. Under FIRST, the first matching row supplies its declared result; a default row is an explicit authored choice. The output is a value/recommendation, and its spelling does not grant approval authority or advance a human task.
Failure and recovery. An empty row array, unsupported hit policy or invalid condition must fail the table contract. Fix the exact row/policy and retest precedence. Do not reorder rows casually after publication or change FIRST to COLLECT merely to suppress an unexpected overlap.
Sources. DecisionTableDefinition.java, RuleDefinitionController.java.
Example DATA-RULE-04 — Keep specialized and future kinds out of the wrong editor
Scenario and inputs. Nadia wants to generate a create-record form, invoke a published employee Integration and show a published interface. These are distinct native contracts. The enhancement specification also discusses Validation, Routing and Calculation concepts, but their presence in prose does not make them current enum values.
Procedure. 1. Use generated RECORD_CRUD rules only through the admitted model/publication generation path and their secured writer contract. 2. For an Integration-backed business operation, create the actual supported INTEGRATION rule binding to its exact immutable contract rather than pasting HTTP code into an expression. 3. Let the platform register SCREEN handles for published interfaces; they are not ordinary user-authored rule choices. 4. Consult the specialized AI/document guides for their independent admission, version and review requirements. 5. When an idea belongs only to the target sections below, mark it planned and keep it out of current create requests.
Expected result. The chosen rule kind preserves the owning service’s actual authorization, input/output validation and failure/reconciliation semantics. A pure expression cannot impersonate a native side-effect operation, and a roadmap term does not appear as a successful current API response.
Failure and recovery. If a client offers an unsupported kind or attempts to create an internal SCREEN directly, correct the UI/integration to use the actual native surface. Do not weaken the closed enum or publish a misleading sample kind to make a tutorial look complete.
Sources. RuleKind.java, RuleDefinitionController.java.
Detailed reference
Document status: Mixed current-state and target-model specification. The current enum also includes specialized generated and integration kinds, listed below.
VALIDATION,ROUTING, andCALCULATIONin this document are product targets, not a claim that those enum values ship today.
This document defines the focused rule model for the Inflow AI platform. The platform should avoid a large and confusing rule taxonomy. Instead, it should support a small set of strong rule types that cover the majority of workflow, form, Fabric, and service-task use cases.
The current Java implementation supports the enum below. This document retains a historical target taxonomy of four core rule types plus three optional good-to-have types; that target is not the current authoring menu.
Design Decision
The platform should standardize on these rule types:
| Priority | Rule Type | Purpose |
|---|---|---|
| Core | CONSTANT |
Return fixed configuration values, thresholds, lists, or objects. |
| Core | EXPRESSION |
Evaluate one InflowEL expression. |
| Core | DECISION_TABLE |
Match rows and return structured business outputs. |
| Core | QUERY |
Build and execute a governed business query over published data model records. See Query Builder Manual. |
| Good to have | VALIDATION |
Return field or business validation violations. |
| Good to have | ROUTING |
Select workflow/process routes in a user-friendly way. |
| Good to have | CALCULATION |
Execute named calculation steps and return a business value. |
Other concepts such as assignment, escalation, eligibility, policy, scoring, security, notification, transformation, enrichment, and temporal rules should not become separate rule kinds for now. They can be implemented using the seven rule types above:
- Assignment can use decision tables, query rules, and routing rules.
- Escalation can use expression rules, decision tables, and constants.
- Eligibility can use expression or validation rules.
- Policy can use decision tables with metadata.
- Scoring can use calculation rules.
- Security should remain in the identity/access layer, optionally using expression or query rules internally later.
- Notification should remain in the notification/service-task layer, optionally using decision tables.
- Temporal logic should be handled by InflowEL date/Hijri/calendar functions inside expression, decision table, validation, routing, or calculation rules.
This keeps the rule designer understandable while still making the platform powerful.
Current And Target RuleKind
Current implementation (platform-rule/.../rule/RuleKind.java):
CONSTANT,
EXPRESSION,
DECISION_TABLE,
QUERY,
SCREEN,
RECORD_CRUD,
AI_TASK,
INTEGRATION,
DOCUMENT_GENERATION
SCREEN is the internal handle for a published interface and is hidden from the
ordinary Rules catalog. RECORD_CRUD rules are generated for published record
types. AI_TASK, INTEGRATION and DOCUMENT_GENERATION use their specialized
governed runtimes; their bodies are not arbitrary pure expressions. See
AI Task Rules, Integration workflows
and the current rule catalog for their authoring and publication constraints.
Target focused implementation:
CONSTANT,
EXPRESSION,
DECISION_TABLE,
QUERY,
VALIDATION,
ROUTING,
CALCULATION
Common Rule Lifecycle
Every rule type follows the same lifecycle.
flowchart LR
Draft["Draft"]
Validate["Validate"]
Publish["Publish Version"]
Execute["Execute"]
Audit["Record Execution"]
Observe["Review History"]
Draft --> Validate
Validate --> Publish
Publish --> Execute
Execute --> Audit
Audit --> Observe
All rule types should support:
- Draft creation.
- Draft update.
- Validation before publish.
- Immutable published versions.
- Latest-version execution.
- Pinned-version execution.
- Optional exposure as a Web API.
- Execution through
service.rule.evaluate. - Execution audit recording.
- Clear validation and execution errors.
Review History (SCRUM-880): the rule builder's "Recent runs" section lists a published rule's recorded runs, newest
first, with the time, outcome (matched or no match), duration, version and the kind of caller (Web API key, process
step, form, ...), and loads older runs on request. It reads GET /api/rules/{ruleKey}/executions?cursor=&limit=
(25 per page by default, at most 100), which needs RULE_DEFINITION_VIEW and the Viewer role on the rule in the
current workspace; runs of an older version appear only when that version is visible to the reader as well. Records hold no inputs or outputs, and the caller's own identifiers (an API key id, a screen key)
are never returned. Only completed runs are recorded; a run that fails with an error is not listed, and runs from
before workspace attribution (migration 000027) have no workspace and are not listed.
Common Rule Metadata
The table below is design vocabulary, not an exhaustive current create/update DTO.
Current CreateDraftRequest accepts ruleKey, name, kind, body,
businessFunctionKey, ruleCategory and inputs. Publish/exposure uses its separate
request. Fields such as effectiveFrom/effectiveTo, owner, tags, inputSchema,
outputSchema and auditLevel below must not be sent as invented supported
properties merely because they appear in this broader design table.
| Field | Purpose |
|---|---|
ruleKey |
Stable machine key, such as invoice-routing. |
name |
Human-readable name. |
kind |
Rule type. |
description |
Business explanation. |
owner |
Business owner, team, or system owner. |
status |
Draft, published, retired, archived. |
version |
Published version number. |
effectiveFrom |
Optional start date/time. |
effectiveTo |
Optional end date/time. |
tags |
Search and catalog grouping. |
inputSchema |
Expected inputs. |
outputSchema |
Expected output shape. |
auditLevel |
None, summary, full. |
exposeAsApi |
Whether external callers can execute it through REST. |
Common Execution Envelope
Current published execution returns RuleExecutionResult, whose common fields
are ruleKey, version, matched, value and outputs. Nonempty diagnostics can be
present for applicable kinds. This is a response projection for the Boolean
eligibility example, with illustrative version3 rather than a claim that this
version was executed here:
{
"ruleKey": "leave-eligible",
"version": 3,
"matched": true,
"value": true,
"outputs": []
}
CONSTANT/EXPRESSION place their result in value. DECISION_TABLE uses outputs and the FIRST/COLLECT value contract. AI_TASK returns its checked text/object value and can expose separate diagnostics where its caller is admitted. Do not invent common kind, success, violations, explanation or auditId fields in a client merely from an aspirational execution model. Effects and their receipts retain their native specialized contracts. Source: RuleExecutionResult.
1. Constant Rule
The basic constant example is current inert JSON data. The later “Functional requirements” and “Designer experience” bullets include design objectives; effective dates and an arbitrary outputSchema are not current create-draft fields. A business configuration constant also does not edit registered canonical feature switches.
A constant rule returns a fixed value. It is the simplest rule type and is useful when business users need to manage configuration centrally without code changes.
Use cases:
- Maximum auto-approval amount.
- Default SLA duration.
- Standard tax/VAT rate.
- Feature flag.
- Allowed currency list.
- Standard branch/team mapping.
- Default AI model policy name.
Example body:
{
"value": {
"maxAutoApprovalAmount": 10000,
"defaultCurrency": "SAR",
"defaultSla": "P2D",
"allowedCurrencies": ["SAR", "USD", "EUR"]
}
}
Example input:
{}
Example output:
{
"matched": true,
"value": {
"maxAutoApprovalAmount": 10000,
"defaultCurrency": "SAR",
"defaultSla": "P2D",
"allowedCurrencies": ["SAR", "USD", "EUR"]
}
}
Functional requirements:
- Must not require process variables.
- Must validate that the configured value matches
outputSchemawhen one is present. - Should support effective dates.
- Should be cacheable.
- Should be callable from BPMN, forms, service tasks, and connectors.
Designer experience:
- Key/value editor.
- JSON object editor for advanced constants.
- Optional schema preview.
- Effective date section.
2. Expression Rule
An expression rule evaluates one InflowEL expression.
Use cases:
- Boolean gateway condition.
- Simple eligibility check.
- Calculating a discount.
- Calculating an SLA date.
- Checking Ramadan/Hijri/date logic.
- Returning a derived workflow variable.
Example body:
if inputs:tier = 'GOLD' then 15 else if inputs:tier = 'SILVER' then 5 else 0
Example input:
{
"tier": "GOLD"
}
Example output:
{
"matched": true,
"value": 15
}
More examples:
inputs:amount > 10000 and inputs:currency = 'SAR'
toHijri(date("2026-07-02"))
hijriMonth(today()) = 9
addHijriMonths(inputs:dueDate, 3)
Functional requirements:
- Must validate before publish.
- Must support boolean, number, text, date, object, and list results.
- Must return syntax errors with a business-readable message.
- Should be supported by AI assist for suggest/fix.
- Should be the default type for simple logic.
Designer experience:
- Formula editor.
- Variable picker.
- Function picker.
- AI suggest/fix.
- Test panel with sample inputs.
3. Decision Table Rule
A decision table evaluates rows. Each row has a condition and an output.
Use cases:
- Approval routing.
- SLA selection.
- Discount matrix.
- Risk band classification.
- Assignment matrix.
- Escalation action matrix.
- Notification channel selection.
Example body:
{
"hitPolicy": "FIRST",
"rows": [
{
"when": "inputs:amount > 10000 and inputs:currency = 'SAR'",
"output": {
"route": "manager-review",
"sla": "P2D"
}
},
{
"when": "inputs:amount <= 10000",
"output": {
"route": "auto-approve",
"sla": "PT4H"
}
},
{
"when": "",
"output": {
"route": "manual-review",
"sla": "P1D"
}
}
]
}
Example input:
{
"amount": 15000,
"currency": "SAR"
}
Example output:
{
"matched": true,
"value": {
"route": "manager-review",
"sla": "P2D"
},
"outputs": [
{
"route": "manager-review",
"sla": "P2D"
}
]
}
Functional requirements:
- Must support
FIRSThit policy. - Should support
COLLECThit policy. - Blank
whenmeans default row. - Every row condition must validate before publish.
- Row output must be an object.
- Should report unreachable/default-row problems as warnings.
Designer experience:
- Spreadsheet-style table.
- Condition column with expression assist.
- Output columns as structured fields.
- Hit policy selector.
- Row test preview.
4. Query Rule
A current QUERY rule reads governed published data-model records or a supported
published Fabric source. It is not a raw SQL/connector-dispatch envelope. An
approved connector query must be consumed through its actual admitted
Integration/Fabric/source contract; it cannot be enabled simply by naming a
queryRef in an arbitrary JSON object.
The executable body includes an InflowEL expression; the builder keeps a
supported guided-designer projection. This is an inner-body fragment with
illustrative coordinates, not a full HTTP create request or an imported app:
{
"expression": "queryMany('leaveRequest', select('requestId','status'), limit(25))",
"designer": {
"source": {
"recordType": "leaveRequest",
"modelId": "actual-model-id",
"sourceVersion": 1,
"recordTypeKey": "leaveRequest",
"publicationId": "actual-applied-publication-id"
},
"returnMode": "MANY",
"selectedFields": [
"requestId",
"status"
],
"filters": [],
"sorts": [],
"resultSize": {
"mode": "PAGE",
"pageNumber": 1,
"pageSize": 25,
"includeTotalCount": false
}
}
}
Select actual model/version/type/publication identities through the builder,
choose the required return shape and declare any filter inputs. Guided filters
use canonical references such as inputs:status; text literals remain quoted.
QUERY outputs can be one record, a collection, values, count, existence,
aggregate projection or an envelope according to the supported expression.
Their actual shape must match the consumer's contract.
For a full worked source/projection/version review, see
the current QUERY contract case
and the Query Builder manual. Supported runtime is defined
by QueryRuleRuntime
and publication validation by
DefaultRuleDefinitionService.
A missing expression is QUERY_EXPRESSION_MISSING; an incomplete declared
source coordinate set is not permission to fall back to an ambiguous label.
Keep these operational distinctions:
- A query narrows the business question; current native source/field/workspace authorization still applies before disclosure.
- Synchronized source reads use their admitted local/materialization policy; running a query is not an implicit connector refresh.
- Page length is not an authorized total. Use the actual scalar/envelope contract and supported paging/count capability.
- Reusable output metadata is not universal screen-adapter support. Required inputs, stable row identity, server paging and native control limits remain.
- Unsupported guided expression logic stays in Expression mode with its explicit reason; it must not be silently removed.
The following Validation/Routing/Calculation sections retain target concepts.
They are not additional values in the current RuleKind enum or supported
current create requests.
5. Validation Rule
A validation rule checks input data and returns violations. This is a good-to-have rule type because forms and service tasks need structured validation more than a raw true/false expression.
Use cases:
- Form validation.
- Required document validation.
- Cross-field validation.
- Connector payload validation.
- Data quality checks before process start.
Example body:
{
"checks": [
{
"code": "AMOUNT_REQUIRED",
"field": "amount",
"severity": "ERROR",
"message": "Amount is required.",
"when": "amount = null"
},
{
"code": "AMOUNT_POSITIVE",
"field": "amount",
"severity": "ERROR",
"message": "Amount must be greater than zero.",
"when": "amount <= 0"
},
{
"code": "CURRENCY_REQUIRED",
"field": "currency",
"severity": "ERROR",
"message": "Currency is required.",
"when": "currency = null or currency = ''"
}
],
"mode": "COLLECT_ALL"
}
Example input:
{
"amount": -10,
"currency": ""
}
Example output:
{
"matched": false,
"value": {
"valid": false
},
"violations": [
{
"code": "AMOUNT_POSITIVE",
"field": "amount",
"severity": "ERROR",
"message": "Amount must be greater than zero."
},
{
"code": "CURRENCY_REQUIRED",
"field": "currency",
"severity": "ERROR",
"message": "Currency is required."
}
]
}
Functional requirements:
- Must return structured violations.
- Must support field-level and global violations.
- Must support severity:
INFO,WARN,ERROR,BLOCKING. - Should support
COLLECT_ALLandSTOP_ON_FIRST_ERROR. - Should be usable by forms, service tasks, process start validation, and connector payload validation.
Designer experience:
- List of checks.
- Field picker.
- Severity selector.
- Expression condition editor.
- Live validation test panel.
6. Routing Rule
A routing rule selects a workflow route. It is technically close to a decision table, but it deserves a user-facing type because business users think in routes, not row outputs.
Use cases:
- BPMN gateway path selection.
- Approval route selection.
- Department routing.
- Case triage.
- Auto-review vs manager-review vs compliance-review.
Example body:
{
"hitPolicy": "FIRST",
"routes": [
{
"when": "amount > 10000",
"route": "manager-review",
"reason": "Large amount"
},
{
"when": "riskBand = 'HIGH'",
"route": "compliance-review",
"reason": "High risk"
},
{
"when": "",
"route": "auto-review",
"reason": "Default route"
}
]
}
Example input:
{
"amount": 5000,
"riskBand": "LOW"
}
Example output:
{
"matched": true,
"value": {
"route": "auto-review",
"reason": "Default route"
}
}
Functional requirements:
- Must return a route key.
- Must support a default route.
- Must validate route keys against known process routes when used inside a specific BPMN model.
- Should support
FIRSThit policy. - Should optionally warn when multiple routes match.
- Should merge safely into workflow variables for gateway routing.
Designer experience:
- Route list.
- Route picker from BPMN model.
- Condition editor with AI assist.
- Default route selector.
- Simulation with sample process variables.
7. Calculation Rule
A calculation rule executes named calculation steps and returns a final value. It is good to have because raw expression rules can become hard to debug when calculations involve multiple intermediate values.
Use cases:
- Invoice totals.
- Tax/VAT.
- Commission.
- Discount.
- SLA deadline.
- Weighted priority.
- Currency-converted amount.
Example body:
{
"steps": [
{
"name": "subtotal",
"expression": "sum(items, item.amount)"
},
{
"name": "vat",
"expression": "round(subtotal * 0.15, 2)"
},
{
"name": "total",
"expression": "subtotal + vat"
}
],
"return": "total"
}
Example input:
{
"items": [
{
"amount": 100
},
{
"amount": 200
}
]
}
Example output:
{
"matched": true,
"value": 345,
"outputs": [
{
"subtotal": 300,
"vat": 45,
"total": 345
}
]
}
Functional requirements:
- Must validate every step expression before publish.
- Later steps may reference earlier step names.
- Must detect circular references.
- Must expose intermediate values for debugging.
- Should support rounding policies.
- Should support decimal precision rules.
Designer experience:
- Step-by-step calculation editor.
- Variable picker.
- Function picker.
- Intermediate result preview.
- Final return selector.
Why We Are Not Adding More Rule Kinds Now
The following concepts are important, but should not become first-class rule kinds yet:
| Concept | Recommended Implementation |
|---|---|
| Assignment | Decision table or query rule used by the task assignment service. |
| Escalation | Decision table/expression/constants used by escalation service. |
| Eligibility | Expression or validation rule. |
| Policy | Decision table plus governance metadata. |
| Scoring | Calculation rule. |
| Security | Identity/access service, optionally backed by expression/query rules later. |
| Notification | Notification service task plus decision table for channel/template selection. |
| Transformation | Service task or connector mapping, not rule engine core. |
| Enrichment | Query rule plus service task output mapping. |
| Temporal | InflowEL date/Hijri functions inside expression/table/routing/calculation rules. |
| Decision tree | Designer view over decision table/routing logic later, not a separate runtime kind. |
This decision protects the platform from rule-type sprawl.
Execution From BPMN
All supported rule types should be callable through:
service.rule.evaluate
Configuration example:
{
"ruleKey": "invoice-routing",
"version": 2,
"resultVariable": "routingDecision"
}
The service task should:
- Load the published rule version.
- Execute it with process variables.
- Record execution audit.
- Return the configured result variable.
- Merge safe top-level outputs when useful for gateway routing.
- Fail clearly when the rule is missing, invalid, blocked, or its query is not approved.
Governance Requirements
Rule governance should include:
- Draft/published lifecycle.
- Version history.
- Effective dates.
- Owner.
- Reviewer/approver.
- Change reason.
- Test cases.
- Execution audit.
- Impact analysis for processes, forms, tasks, connectors, Fabric datasets, and service tasks using the rule.
- Rollback to previous version.
- Deprecation and retirement.
Testing Requirements
Each rule type should have tests for:
- Valid body validation.
- Invalid body rejection.
- Publish lifecycle.
- Latest version execution.
- Pinned version execution.
- Audit recording.
- Web API execution when exposed.
- Web API rejection when not exposed.
- BPMN service task execution.
- Missing variable behavior.
- Empty/default behavior.
- Error message quality.
Specific required tests:
CONSTANT: no-input execution, object/list/scalar values, effective date behavior.EXPRESSION: boolean result, numeric result, date/Hijri functions, syntax failure.DECISION_TABLE: first hit, collect hits, default row, invalid row expression.QUERY: approved Fabric query, missing parameter, unapproved query blocked, empty result.VALIDATION: collect all violations, stop on first error, field-level severity.ROUTING: default route, route key validation, multiple match warning.CALCULATION: step references, intermediate values, circular reference rejection.