Skip to content

Implement vertical slices engine - #4

Open
woksin wants to merge 21 commits into
mainfrom
feat/engine
Open

Implement vertical slices engine#4
woksin wants to merge 21 commits into
mainfrom
feat/engine

Conversation

@woksin

@woksin woksin commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

…iceType, update ReadModel and EventPropertyMapping structures, and enhance code generation logic.
…eration; update VerticalSlice to include optional description and adjust feature hierarchy building logic.
- Removed obsolete integration tests for state view modules:
  - `with_from_every_context_mapping`
  - `with_multiple_read_models`
  - `with_one_read_model`
  - `with_set_from_context_mapping`
  - `with_subtract_mapping`
  - `with_internal_events`
  - `with_read_model`
  - `with_read_model_and_internal_event`
  - `with_translator_slice`
  - `with_only_read_model`
  - `with_read_model_and_command`

- Added new integration test for processing multiple independent modules:
  - `with_three_independent_modules`

- Updated `AutomationCodeGenerator` to ensure event type files are generated only when commands are present in the slice, clarifying the flow of consumed and produced events.
- Introduced RenderedArtifact record to encapsulate generated artifacts with logical paths and content.
- Updated IArtifactRenderer interface to return IEnumerable<RenderedArtifact> instead of IEnumerable<GeneratedFile>.
- Modified ModelBoundCommandRenderer, ModelBoundConceptRenderer, ModelBoundEventTypeRenderer, ModelBoundReadModelRenderer, and others to utilize RenderedArtifact.
- Adjusted AutomationCodeGenerator, StateChangeCodeGenerator, StateViewCodeGenerator, TranslatorCodeGenerator, and VerticalSliceCodeGenerator to return RenderedArtifact collections.
- Enhanced CollectedArtifacts to aggregate RenderedArtifact instead of GeneratedFile.
- Updated IVerticalSlicesEngine and VerticalSlicesEngine to support new artifact structure and options for code generation.
…oncept resolution

- Updated ModelBoundCommandRenderer to support auto-generated EventSourceId.
- Introduced EventSourceIdStrategy enum to define how EventSourceId is obtained.
- Enhanced concept resolution in renderers to include necessary using directives.
- Added SliceFileComposer to combine multiple rendered artifacts into a single file.
- Improved ModelBoundConceptRenderer to conditionally render validators based on presence of validation rules.
- Refactored ModelBoundReadModelRenderer to embed observable query methods.
- Introduced GivenWhenThen record for future specification support in event modeling.
- Updated VerticalSlice and Command records to include new properties for better slice management.
- Enhanced validation logic in SliceValidator to ensure commands have an EventSourceId.
- Updated DI configuration in Program.cs to streamline output handling.
- Updated CommandDescriptor.FromCommand to accept a ConceptScope parameter for filtering event source id properties.
- Modified EventTypeDescriptor.FromEventType to filter properties based on the provided ConceptScope.
- Refactored tests for CommandDescriptor and EventTypeDescriptor to accommodate the new ConceptScope parameter.
- Introduced IChronicleRegistrationResolver and ICodeOutputResolver interfaces to manage Chronicle registration and code output resolution.
- Implemented ChronicleRegistrationResolver and CodeOutputResolver classes to provide default no-operation behavior when no configuration is provided.
- Updated VerticalSlicesEngine to utilize the new resolvers for output and Chronicle registration.
- Adjusted various renderers and code generators to pass the ConceptScope during descriptor creation.
- Enhanced dependency injection in the web application to register the new resolvers.
…ds, and enhance the TranslatorCodeGenerator to handle command rendering
- Updated ModelBoundCommandRenderer to return tuples for auto-generated commands, providing a generated event source ID alongside the event.
- Changed ModelBoundReadModelRenderer to generate full record declarations instead of partial ones.
- Removed unnecessary attribute stubs writing in EngineFixture.
- Adjusted MultiModuleFixture to reflect new event and command names, ensuring consistency across tests.
- Enhanced tests to verify new naming conventions and tuple return types for commands.
- Updated StateChangeCodeGenerator to conditionally render events based on command presence, improving efficiency.empty
- Introduced DuplicateEventTypeNameRule to detect event types produced by multiple slices.
- Added DuplicatePropertyNameRule to identify duplicate property names within event types, commands, and read models.
- Implemented EventNamingConventionRule to enforce past-tense naming conventions for event types.
- Created EventPropertyMappingSourcePropertyNotFoundRule to check for missing source properties in read model mappings.
- Added EventSourceIdPropertyNotFoundRule to ensure commands using supplied event source IDs have corresponding properties.
- Introduced EventWithTooManyPropertiesRule to flag events exceeding a recommended number of properties.
- Implemented MissingSourcePropertyInMappingRule to detect mappings lacking required source property names.
- Created OrphanedEventRule to identify events not referenced by any read model mappings.
- Added PrimitivePropertyTypeRule to encourage the use of domain concepts over primitive types in properties.
- Implemented ProducedEventNotDefinedRule to ensure commands reference defined event types.
- Created ReadModelWithoutKeyMappingRule to check for key mappings in read models.
- Added StateViewWithCommandsRule to prevent commands in StateView slices.
- Implemented StateViewWithNoReadModelsRule to flag StateView slices without read models.
- Created UnmappedReadModelPropertyRule to identify properties without event mappings.
- Added UnresolvedEventReferenceRule to detect mappings referencing undefined event types.
- Introduced ISliceValidator interface for validating modules and slices before code generation.
- Implemented SliceValidator to collect and report validation errors using IEventModelAdvisor.
- Enhanced VerticalSlicesEngine to analyze modules and return advisory recommendations alongside generated artifacts.
- Added VerticalSlicesResult to encapsulate the outcome of engine operations, including advisory findings and generated artifacts.
- Registered services for vertical slices engine and related components using a fluent API in ServiceCollectionExtensions.
- Updated Program.cs to utilize the new service registration methods for cleaner configuration.
- Added new event model advisory rules to enforce best practices in slice definitions, including checks for commands and events in StateChange slices.
- Improved error handling and reporting for unresolved event references and missing event source IDs.
- Updated UnmappedReadModelPropertyRule to simplify evaluation logic and improve readability.
- Refactored UnresolvedEventReferenceRule to streamline event name collection and enhance clarity.
- Deleted GivenWhenThen, ISliceValidator, SliceValidationError, SliceValidationFailed, and SliceValidator classes as they are no longer needed.
- Enhanced IVerticalSlicesEngine interface to include new output and chronicle options.
- Introduced ModuleExtensions for flattening module and feature hierarchies, reducing code duplication.
- Updated VerticalSlice and VerticalSlices classes to remove obsolete specifications and streamline configuration handling.
- Added VerticalSlicesConfigStore for file-based persistence of vertical slices configuration.
- Modified VerticalSlicesEngine to improve output and chronicle registration handling.
- Adjusted Web application startup to utilize new configuration options for output handling.
@woksin woksin added the minor label Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant