Skip to content

Releases

v9.0.0

Choose a tag to compare

@github-actions github-actions released this 10 Aug 20:39
Immutable release. Only release title and notes can be modified.

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

Choose a tag to compare

@github-actions github-actions released this 28 Jun 17:57
168443f

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) and numbers.All(n => n > 0) become higher-order propositions.
  • Compose existing specs — reference a SpecBase directly inside the lambda and its assertions fold into the result.
  • The full builder chain — WhenTrue, WhenFalse, WhenTrueYield, WhenFalseYield all work after Spec.From(...), exactly as with Spec.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.

  • MOTIV0001 analyzer — an Info-level hint flagging raw boolean expressions (comparisons, &&/||/!, is/pattern checks) that could become Motiv propositions. It stays quiet inside existing Spec.Build(...) lambdas and SpecBase-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 on DEBUG, so it's stripped from Release builds).

⚠️ API changes & migration

  • IsSatisfiedBy(model) is now [Obsolete] in favor of Evaluate(model) (returns the rich BooleanResultBase). 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 trigger Tap callbacks. SpecBase<TModel> also exposes an implicit conversion to Func<TModel, bool> backed by Matches.
    - 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, and netstandard2.0.
  • Symbol packages + SourceLink — .snupkg symbols 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

v8.0.0-rc.1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 28 Jun 15:52
89ef0dd

What's Changed

Full Changelog: https://github.com/karlssberg/Motiv/commits/v8.0.0-rc.1