Skip to content

fix(server): make call_rule_set and $data work, release 0.9.0 - #201

Merged
Pama-Lee merged 1 commit into
mainfrom
fix/server-ruleset-call-and-data-53njaz
Oct 14, 2026
Merged

Pama-Lee merged 1 commit into
mainfrom
fix/server-ruleset-call-and-data-53njaz

Conversation

@Pama-Lee

@Pama-Lee Pama-Lee commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Before: on ordo-server, a rule that calls another ruleset (call_rule_set) always failed with "CallRuleSet requires a resolver to be configured". A rule that reads external data (amount >= $data.limits.vip_min) never saw the value, so the condition was silently false. With multi-tenancy, external data was lost on restart.

After: both work on HTTP execute, batch, pipeline, gRPC (single and batch), the decision gateway and debug execute. Calls resolve within the caller's tenant, and a changed callee is picked up on the next request. ordo exec --data works too. The docs describe both again (en and zh). Versions are bumped to 0.9.0 so the release also ships #198.

How:

  • core: a $name path falls back to an input field of the same name when no variable matches. The server and CLI already inject external data as the input field $data; the expression lookup just never read it.
  • core: RuleExecutor::execute_with_resolver takes a resolver per run, so the one shared executor serves every tenant. RuleSet::called_rulesets lists direct callees. A call with input_mapping keeps $data.
  • server: RuleStore::exec_target_for_tenant reads the ruleset, the tenant's data and a snapshot of every ruleset reachable through calls in one lock hold. A ruleset that calls nothing gets no snapshot. All execute paths use it, which also gives batch and gRPC $data, which they never had.
  • server: multi-tenant data was written to tenants/<id>/data but loaded from tenants/tenants/<id>/data.
  • Tests: core (path fallback, per-run resolver with mapped input and $data), store (tenant isolation, nested and self calls, data round trip after restart), HTTP integration (single, batch, pipeline, missing callee), gRPC.

Checked with cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings and cargo test --all-features --workspace, plus a local server run against a rules folder with data/limits.json.

Not covered: the CLI (ordo exec, ordo test) and compiled .ordo files still cannot run call_rule_set; the docs say so.

ordo-server ran every ruleset with an executor that had no resolver, so a
call_rule_set action always failed with "CallRuleSet requires a resolver".
External data was injected as an input field named "$data", but rules read
"$data.x" as a variable lookup, so the value was always missing and
conditions on it were silently false.

- core: `$name` paths fall back to an input field of the same name when no
  variable matches, so `$data.<name>.<path>` reads injected data (server and
  `ordo exec --data`).
- core: `execute_with_resolver` passes a resolver per run, so one shared
  executor can serve every tenant. A call with `input_mapping` keeps `$data`.
- server: one store read gives the ruleset, the tenant's data and a snapshot
  of every ruleset it can reach through calls. Used by execute, batch,
  pipeline, gRPC (single and batch), the decision gateway and debug execute.
  Batch and gRPC now also get `$data`.
- server: with multi-tenancy, external data was saved under
  tenants/<id>/data but loaded from tenants/tenants/<id>/data, so it was
  lost on restart.
- docs (en, zh): call_rule_set, external data, data endpoints.
- bump crates and npm wrapper to 0.9.0 (also ships #198).
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ordo_docs Ready Ready Preview Oct 14, 2026 9:11am UTC

@Pama-Lee
Pama-Lee merged commit 322f674 into main Oct 14, 2026
15 checks passed

This branch was successfully deployed

1 active deployment
Preview – ordo_docs — aaee1acf Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant