Feat v0.9.8 conditional routing SDK primitive
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / test-go-pg (pull_request) Successful in 2m55s
CI/CD / test-sqlite (pull_request) Successful in 3m17s
CI/CD / build-and-deploy (pull_request) Successful in 1m5s
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / test-go-pg (pull_request) Successful in 2m55s
CI/CD / test-sqlite (pull_request) Successful in 3m17s
CI/CD / build-and-deploy (pull_request) Successful in 1m5s
Promote workflow branch-rule evaluation to a generic Starlark routing.evaluate(rules, data) module available to all extensions. 10 operators, first-match-wins, no permission gate. 8 new tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,24 @@ Returns `True` if the user has the permission, `False` otherwise (including
|
||||
when the user is not found). Resolves the user's groups and merges granted
|
||||
permissions — works for both kernel and extension-declared permissions.
|
||||
|
||||
### routing
|
||||
|
||||
Generic rule-based decision engine. Evaluates an ordered list of conditions
|
||||
against a data dict, returning the first matching rule's target string.
|
||||
|
||||
```python
|
||||
result = routing.evaluate([
|
||||
{"field": "priority", "op": "eq", "value": "critical", "target": "escalation"},
|
||||
{"field": "amount", "op": "gt", "value": 10000, "target": "manager_review"},
|
||||
{"field": "region", "op": "in", "value": ["EU", "UK"], "target": "gdpr_flow"},
|
||||
], stage_data)
|
||||
# Returns "escalation", "manager_review", "gdpr_flow", or None
|
||||
```
|
||||
|
||||
Each rule is a dict with `field`, `op`, `value`, and `target`. Operators:
|
||||
`exists`, `not_exists`, `eq`, `neq`, `gt`, `lt`, `gte`, `lte`, `in`,
|
||||
`contains`. First-match-wins; returns `None` if no rule matches.
|
||||
|
||||
## Permission-gated modules
|
||||
|
||||
These modules are only available if the package has the corresponding
|
||||
|
||||
Reference in New Issue
Block a user