Rule Cascade
Usage by language

Usage by language

Which runtime to use where, the versions each one supports, and the calls every runtime has in common.

Every runtime implements the same specification and passes the same conformance suite. Pick the one that runs where the decision is made.

One ruleset feeds six engines: TypeScript, Java, Go, Python, the rcas command and WebAssemblyruleset.yamlone rulesetTypeScriptJavaGoPythonrcasWasm
One ruleset, six runtimes, one answer.
RuntimeUse it inPage
TypeScriptBrowsers, Node.js, React, React Native, ElectronTypeScript
JavaSpring Boot and any JVMJava
GoGo servicesGo
PythonServices, jobs and tooling; the reference implementationPython
Command, WebAssembly moduleAny other language, CI scripts, sandboxesCommand and WebAssembly
Rule serverCallers that should not run an engine, over HTTPRule server

Supported versions

The minimums are declared by each package. CI tests the versions in the last column on every push. No maximum is declared: newer versions are expected to work, but only the tested ones are proven.

RuntimeDeclared minimumWhere it is declaredTested in CI
TypeScript, rule serverNode.js 22engines in the package.json of @rules-cascade/core and @rules-cascade/serverNode.js 22, 24 and 26 (Linux), 24 (Windows, macOS)
JavaJava 17maven.compiler.release in the POM of rules-cascade-coreJDK 17, 21, 25 and 27 (Linux), 21 (Windows, macOS)
GoGo 1.26go directive in the go.mod of rulescascade.com/goGo 1.26 (Linux), 1.27 (Linux, Windows, macOS)
PythonPython 3.11requires-python in the metadata of rule-cascade on PyPIPython 3.11 to 3.15 (Linux), 3.12 (Windows, macOS)
WebAssembly moduleA WASI preview 1 hostGOOS=wasip1 buildNode.js 24 and wasmtime (Python)

The same calls everywhere

StepTypeScriptJavaGoPython
Read a compiled bundleRuleSet.fromBundle(json)RuleSet.fromBundle(map)rulecascade.FromBundle(json)RuleSet.from_bundle(json)
Compile a source rulesetloadRuleSet(document, registry, options)RuleSet.load(document, registry, schemaLoader)rulecascade.Load(document, registry, loader)load(document, registry, loader)
Evaluaterules.evaluate(request, channel?, operators?)rules.evaluate(EvaluationRequest)rules.Evaluate(request, channel, operators)rules.evaluate(request, channel="server", operators=None)
Load errorLoadError (.problems, .codes)LoadException (problems(), codes())*rulecascade.LoadError (.Problems)LoadError (.problems, .codes)
Malformed requestRequestErrorIllegalArgumentException*rulecascade.RequestErrorValueError (RequestError)
Operators a manifest needsmissingOperators(manifest, operators)rules.requiredOperators(Channel.SERVER)operators of rules.Manifest("server")rules.manifest("server")["operators"]

Two kinds of failure are deliberately different:

  • A load error means the ruleset or bundle must not be served. Let it stop the process at start-up.
  • A rule that cannot be evaluated never throws. It produces a blocking finding with code RULE-EVALUATION-ERROR and the decision deny. See Incident: RULE-EVALUATION-ERROR spike.

Installing

Every library is on its language's registry; Install lists the package names. The rcas command and its WebAssembly module are also signed downloads: verify the checksum and the signature, then pin the version in your build. The command serves the engine protocol, so a language without a library evaluates rules through it.

On this page