Skip to content

Release v20.42.2

Choose a tag to compare

@github-actions github-actions released this 16 Jun 19:54
799ce6f

Summary

Command-scoped Chronicle read models represent current projection state. For commands that reference an event source whose projection has never been created, or one that has been removed, the correct resolved value can be "no read model". A key or event source id selects which projection instance Arc should resolve; it does not by itself prove that the projection instance exists. Before this change, that state was not expressible through command dependency injection: resolving the read model could crash while releasing a null instance, nullable validator constructors were rejected by ActivatorUtilities, and nullable read model parameters on Provide / Handle had the same null-resolution gap. That pushed missing-state checks into explicit IReadModels lookups and left non-nullable parameters with unclear DI failures.

Added

  • Added nullable-aware dependency resolution for command validators, Provide, and Handle so nullable read model parameters can receive null when the command-scoped read model does not exist.
  • Added ARC0006 analyzer guidance for non-nullable command-scoped read model parameters in validators, Provide, and Handle, including read models discovered through Chronicle IProjectionFor projections. The rule now frames this as an explicit design choice: nullable when the command handles absence, non-nullable when the projection is required.
  • Added documentation for Chronicle read model dependency semantics, validator existence checks, Provide / Handle consistency, and ARC0006.

Changed

  • Registered discoverable validators are still resolved from DI first, while unregistered validators are constructed through the shared nullable-aware parameter resolver.
  • Non-nullable command and validator dependencies now report that the dependency could not be resolved or resolved to null, with guidance to make read models nullable when absence is valid or keep them non-nullable when absence should fail as required state.

Fixed

  • Fixed missing Chronicle read models resolving through command scopes by returning null instead of trying to release a null read model.
  • Fixed nullable read model injection for CommandValidator, Provide, and Handle, which now supports validators and command methods that explicitly handle missing read model state without IReadModels lookups.
  • Fixed non-nullable command-scoped read model parameters failing with generic DI construction errors by throwing clear CannotResolveCommandDependency or CannotResolveValidatorDependency exceptions.