Repository navigation
Releases
v9.0.0
What's Changed
- chore: update package icon by @karlssberg in #59
- docs: fix stale ¬ negation notation and remove conflicting Pages workflow by @karlssberg in #60
- docs: refresh negation notation and fix dead Operations link by @karlssberg in #61
- docs: move release process from README to CONTRIBUTING by @karlssberg in #62
- docs: fix stale assertion notation in index.md by @karlssberg in #63
- docs: replace stale ¬ notation, fix dead link, remove conflicting Pages workflow by @karlssberg in #64
- feat: queryable expression composition by @karlssberg in #65
- feat!: named explanation specs adopt metadata semantics by @karlssberg in #66
- perf: eliminate per-evaluation Lazy and closure allocations across all proposition families by @karlssberg in #67
- perf: materialize cached metadata projections and stream collection filtering by @karlssberg in #68
- perf: eliminate closures and boxed enumerators on higher-order evaluation path by @karlssberg in #69
- perf: short-circuiting zero-allocation boolean-only Matches for higher-order propositions by @karlssberg in #70
- feat: async propositions (core) by @karlssberg in #71
- feat: production observability (OpenTelemetry) by @karlssberg in #72
- feat: rule externalization — Motiv.Serialization base package (Plan 1) by @karlssberg in #73
- feat: rule externalization — parameters, higher-order nodes, metadata loads (Plan 2) by @karlssberg in #74
- docs: reorder README query provider section after manual composition by @karlssberg in #76
- docs: README editorial pass by @karlssberg in #77
- feat: rules-engine frontend — backend + headless TS/React core + demo (full vertical slice) by @karlssberg in #75
- perf!: async specs/policies evaluate via ValueTask instead of Task by @karlssberg in #78
- feat: live rules — hot-swappable typed rule handles with async loading by @karlssberg in #79
- feat(builder): pointer-driven node insertion and a permanent DSL strip by @karlssberg in #80
- fix(builder): stop the DSL strip marking spans it cannot vouch for by @karlssberg in #81
- fix(builder): hold a row's text still, and place the caret where you click by @karlssberg in #82
- fix(sample): bind to $PORT when the environment assigns one by @karlssberg in #83
- feat(demo): merge the rule selector into the breadcrumb leaf by @karlssberg in #86
- fix(builder): settle the caret's meaning at the press, not the release by @karlssberg in #84
- test(e2e): never adopt a host the suite did not start by @karlssberg in #85
- feat(rules): async-aware /validate flag and surface invalid saves by @karlssberg in #87
- feat: runtime propositions — authored, namespaced, cascading by @karlssberg in #88
- feat(demo): a minimalist shell — icon toolbar, command palette, modal document viewer by @karlssberg in #89
- docs: settle the policy-preservation boundary, and pin Value as a selection by @karlssberg in #90
- fix: bound composition depth, so a wide document cannot kill the host by @karlssberg in #92
- fix: resolve authored propositions from /validate and /evaluate by @karlssberg in #93
- chore: rename the npm packages out of the @motiv scope by @karlssberg in #94
Full Changelog: v8.0.0...v9.0.0
v8.0.0
Motiv 8.0.0
Motiv 8.0.0 is a major release headlined by expression-tree propositions — write an ordinary boolean lambda and let Motiv decompose it into explainable, composable clauses — alongside new side-effect observers, a sharper evaluation API, and first-class IDE tooling that nudges you away from boolean blindness as you type.
✨ Highlights
Expression-tree propositions — Spec.From(...)
Build a proposition straight from a boolean expression. Motiv walks the expression tree and turns each sub-expression into its own clause, so a single lambda yields a full, de-noised explanation of why a result was true or false — no manual .And()/.Or() wiring required.
var canAccess = Spec
.From((User user) =>
user.Age >= 18 &
user.HasValidId &
(user.Country == "US" || user.HasInternationalPermit) &
!user.IsRestricted)
.Create("can access");
var result = canAccess.Evaluate(user);
result.Satisfied; // false
result.Assertions; // e.g. ["user.Age < 18", "user.HasValidId == false"]What you get inside a Spec.From(...) lambda:
- Automatic clause decomposition with auto-negated assertions for the unsatisfied branch.
- Inline
Any/All—numbers.Any(n => n % 2 == 0)andnumbers.All(n => n > 0)become higher-order propositions. - Compose existing specs — reference a
SpecBasedirectly inside the lambda and its assertions fold into the result. - The full builder chain —
WhenTrue,WhenFalse,WhenTrueYield,WhenFalseYieldall work afterSpec.From(...), exactly as withSpec.Build(...). Display.AsValue(...)— surface a sub-expression's runtime value in the assertion (e.g.user.Age = 15) instead of just the identifier.
A Expression<Func<TModel, bool>>.ToSpec() extension is also available for converting an already-materialized expression.
Side-effect observers — Tap, TapWhenTrue, TapWhenFalse
Attach callbacks (logging, metrics, auditing) to a proposition without changing how it evaluates or what it reports. Reason, Assertions, Justification, and Description pass through unchanged.
var observed = isEligible
.TapWhenTrue((customer, result) => logger.LogInformation("eligible: {Reason}", result.Reason))
.TapWhenFalse((customer, result) => logger.LogWarning("ineligible: {Reason}", result.Reason));Callbacks fire on Evaluate(...). The lightweight Matches(...) path intentionally does not invoke them.
🛠️ IDE tooling (ships in the box)
The Motiv.Analyzer and Motiv.CodeFix Roslyn components are bundled inside the Motiv package — no separate install. They activate automatically when you reference Motiv.
MOTIV0001analyzer — anInfo-level hint flagging raw boolean expressions (comparisons,&&/||/!,is/pattern checks) that could become Motiv propositions. It stays quiet inside existingSpec.Build(...)lambdas andSpecBase-derived types, so Motiv-aware code isn't nagged.- Code fix: "Convert to Motiv specification" — generates a
Spec.From(...)-based proposition from the flagged expression, with context-aware clause naming. Handles instance/static method calls,nameof(), pattern variables, and nested expressions, and supports Fix-All. - Code fix: "Convert to Motiv specification (with debug output)" — the same conversion wrapped with
.Tap()+Debug.WriteLine(conditional onDEBUG, so it's stripped from Release builds).
⚠️ API changes & migration
IsSatisfiedBy(model)is now[Obsolete]in favor ofEvaluate(model)(returns the richBooleanResultBase). The old method still compiles as a shim but emits a warning.- var result = spec.IsSatisfiedBy(model); + var result = spec.Evaluate(model);
Matches(model)is the new canonical boolean-only path — use it where you previously wrote.IsSatisfiedBy(model).Satisfied. It skips result-object allocation and does not triggerTapcallbacks.SpecBase<TModel>also exposes an implicit conversion toFunc<TModel, bool>backed byMatches.- if (spec.IsSatisfiedBy(model).Satisfied) { ... } + if (spec.Matches(model)) { ... }
These are the only changes 7.x consumers need to act on — and both old forms still work, so you can migrate at your own pace.
🚀 Platform & packaging
- .NET 10 support added — the package now targets
net8.0,net9.0,net10.0, andnetstandard2.0. - Symbol packages + SourceLink —
.snupkgsymbols ship alongside the package and SourceLink is enabled, so you can step straight into Motiv source while debugging. - Package icon now displays on nuget.org.
⚡ Performance
Result and description properties (Reason, Justification, Detailed, Statement, and the underlying result collections) are now lazily computed and cached, reducing work for evaluations that don't inspect every property.
🔧 Internal
- The source-generator attributes that produce the fluent builder overloads moved from a bundled package to the public Converj 2.0.0 dependency. This is a build-time change only — Motiv's public API is unchanged.
Full Changelog: https://github.com/karlssberg/Motiv/commits/v8.0.0
v8.0.0-rc.1
What's Changed
- Fix inital mess by @karlssberg in #1
- Merge project name changes to main by @karlssberg in #2
- Renamed nuget package to Motiv by @karlssberg in #4
- Develop by @karlssberg in #5
- Feature/add and also and or else operations by @karlssberg in #6
- Feature/resolve merge conflicts by @karlssberg in #8
- Feature/reset main by @karlssberg in #9
- Reconcile differences in histories by @karlssberg in #10
- Ensured reason uses assertion with explanation specs by @karlssberg in #11
- Added Serialize extension method (a wrapper for string.Join()) by @karlssberg in #12
- Feature/fix serialize missing content bug by @karlssberg in #13
- Improved higher order list pattern matching experience by @karlssberg in #14
- Feature/bump to 3.0.0 by @karlssberg in #15
- Release 3.0.0 by @karlssberg in #16
- Reworked Details serialization by @karlssberg in #17
- fixed typos in README.md by @karlssberg in #19
- Release v3.1.0 by @karlssberg in #18
- Feature/release v3.1.1 by @karlssberg in #20
- Release v3.1.1 by @karlssberg in #21
- Release 4.0.0 by @karlssberg in #22
- Added documentation headers by @karlssberg in #23
- Moved namespace by @karlssberg in #24
- Updated github actions to reflect namespace change by @karlssberg in #25
- Added badges to README.md. by @karlssberg in #26
- Added tests by @karlssberg in #27
- Update README.md by @karlssberg in #29
- Fix bug when generating Reason was being incorrectly populated by @karlssberg in #30
- Fixed exessive bracketing bug with the Reason property by @karlssberg in #33
- Update docfx.yml by @karlssberg in #34
- Create SECURITY.md by @karlssberg in #36
- Added missing WhenFalseYield() methods by @karlssberg in #38
- Removed unreachable Not() method by @karlssberg in #41
- Added extensions for collections of model results by @karlssberg in #42
- Introduced NOR, NAND to Expressions and Justifications by @karlssberg in #43
- Covered tests by @karlssberg in #44
- Improve the intro demo in README.md by @karlssberg in #45
- Feature/add negation of binary operators to reason by @karlssberg in #46
- prevent negation ambiguity with the ! symbol by @karlssberg in #48
- Added mermaid diagrams to docs by @karlssberg in #49
- Fixed typo in diagram by @karlssberg in #51
- Feature/restyle diagrams in docs by @karlssberg in #52
- Feature/allow operations between incompatible result types by @karlssberg in #53
- ensured all assertions yield correctly by @karlssberg in #54
- Facilitating nuget packages that extend Motiv's functionality by @karlssberg in #55
- support genericless pattern matching on boolean-operator interfaces by @karlssberg in #56
- Feature/expression trees support by @karlssberg in #57
Full Changelog: https://github.com/karlssberg/Motiv/commits/v8.0.0-rc.1