Releases
What's new in 2.0.0, and where to find the full changelog.
On this page
Releases
RuleBox follows Semantic Versioning. The full,
line-by-line history lives in
changelog.md
at the root of the repository. Highlights below.
2.0.0
A BoxLang-only rewrite of the module. The main additions:
- External rule sources - load rules from JSON, YAML or a database
with
loadRules(). See Externalized Rule Definitions. - Declared rulebooks - name your rulebooks in config or a folder of
files, then get them from
RuleBookRegistryor theruleBook()helper. See Externalized Rule Definitions. dryRun()- preview which rules would fire, without running anythen()consumers. See Auditing Rules.- Declared facts - declare the facts a rulebook takes, with types, defaults and descriptions, and optionally enforce them before any rule runs. See Declaring Facts.
- Descriptions - describe rulebooks and rules, or let a class's docblock do it. See Defining RuleBooks.
- Rule metrics and health - per-rule counts, timings, error rates and the last error across runs. See Auditing Rules.
active()time windows - limit a rule to a date range. See The RuleBook DSL.- Rule Visualizer - an admin UI, off by default. See Rule Visualizer.
- Breaking:
RULE_STATES.REGISTEREDreplacesNONE. See Migrating from 1.0.0.
Also in 2.0.0, with fixes and smaller changes:
- BoxLang only - the module now targets BoxLang exclusively.
- ColdBox 8+ integrations.
- Rule priority -
Rule.withPriority()lets a rule run earlier than others in the same chain, regardless ofaddRule()order. See The RuleBook DSL. RULE_STATES.FAILED- athen()consumer that throws is now recorded asFAILEDin the audit trail before the exception is re-thrown to the caller, instead of leaving a stale status behind. See Error Handling.RuleBox.RuleNotAttachedException- callingrun()on aRulethat was never added to aRuleBookviaaddRule()now throws this named exception instead of a cryptic null-reference error.- Audit trail reset on every
run()-RuleBook.run()resetsgetRuleStatusMap()/getRuleStatus()at the start of every run, so a rule that a chain didn't reach this time around no longer reports a stale status left over from a previous run. overwriteis honored - theoverwriteargument ongiven()/givenAll()was previously ignored (facts were always force-overwritten); it's now respected on bothRuleandRuleBook.- Thread-safety for singleton objects (like
Builder@rulebox). - Safe-navigation (
?.) used forRulechain traversal instead of manualisNull()guards.
Migrating from 1.0.0
What to change when you upgrade from 1.0.0:
- Run on BoxLang 1.18+. 2.0.0 no longer supports other engines.
- Replace
NONEwithREGISTERED. The state of a rule that was added but not reached is nowREGISTERED. Update any code that compares a rule status to"NONE". See Auditing Rules. - Do not rely on stale statuses.
getRuleStatusMap()is now reset at the start of everyrun(). - Check
overwriteongiven()/givenAll(). It used to be ignored. Nowoverwrite = falsekeeps existing facts. - Attach rules before calling
run(). Running aRulethat was never added to aRuleBooknow throwsRuleBox.RuleNotAttachedException.
The old docs are kept in the 1.0.0 archive.
1.0.0
The first iteration of this module, released 2018-OCT-29. Its docs are preserved under the 1.0.0 version of this site.