Repository navigation
GH-992..995: event model definitions — app model name, discovery manifest, ForAggregate, spec links - #996
Merged
Conversation
…efault aggregates and spec links - GH-992: EventModelDefinition.Name defaults to null, meaning the application's model (EventModelDiscovery.ApplicationModelName: JasperFxOptions.ServiceName, else the entry assembly). Per-chapter definitions now merge with the code-derived model; Origin still names each definition class. - GH-993: JasperFx.SourceGenerator's EventModelDiscoveryGenerator emits a per-assembly JasperFx.Generated.DiscoveredEventModels manifest (constructors rooted with DynamicDependency). New AddDiscoveredEventModels(assembly) reads it with no type scan; AddEventModelsFromAssembly prefers it too, falling back to the reflective scan. - GH-994: EventModelBuilder.ForAggregate<T>() / ForAggregate(string) default for following command slices; NoAggregate() and DeciderModel<T>() on a slice. Slices carry AggregateDeclaration { Default, Explicit, None, DeciderModel } and DeciderModel. - GH-995: typed LinksToSpecification<TSpec>(scenario) via SpecificationIdentity (Bobcat's naming rule); SpecificationBindingDescriptor contract and EventModelSpecifications.Link join by command type (+ domain / namespace, or explicit slice); new EventModelProvenance.Specified rung (wire 3, ranked between Declared and Derived via Rank/Outranks) and HotspotOrigin.UnresolvedSpecification for ambiguous joins. - Viewer types and docs updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8KxC18Q51z5w4u6YARwe4
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #992, closes #993, closes #994, closes #995.
#992 Definitions join the application's model by default
EventModelDefinition.Nameis nowstring?and defaults tonull, meaning the application's model. Overrides that return astringstill compile.EventModelDiscovery.ApplicationModelName(services)is public, so other sources can reuse the rule. It resolves to:JasperFxOptions.ServiceName, which Wolverine keeps in step withWolverineOptions.ServiceName, and which Marten already uses;"EventModel".Originstill names its own definition class (event-model://{ClassName}). For an instance with no name,Subjectuses the class name too.#993 AOT-safe discovery of definitions
EventModelDiscoveryGeneratorin JasperFx.SourceGenerator.EventModelDefinitionsubclass that has a public constructor; definitions nested inside public types are included.JasperFx.Generated.DiscoveredEventModels.DefinitionTypesmanifest.[DynamicDependency(PublicConstructors)]keeps each listed constructor through trimming.EventModelDefinition, so "generator ran, found nothing" is distinguishable from "generator never ran".AddDiscoveredEventModels(assembly): reads the manifest and enumerates no types. Without a manifest it falls back to the reflective scan (the trim warning is suppressed, with a justification, asCommandFactorydoes).AddEventModelsFromAssemblyalso prefers the manifest now.#994
ForAggregate/NoAggregate/DeciderModelForAggregate:ForAggregate<T>()/ForAggregate(string)set a default aggregate.Aggregate<T>()is unchanged.NoAggregate()andDeciderModel<T>()on a slice override the default. CallingNoAggregate()together withAgainst/StartsStreamthrows.EventModelSliceDescriptor.AggregateDeclaration { Default, Explicit, None, DeciderModel }andDeciderModel.EventModelRole, so they take part in the merge.#995 Specification links without strings
LinksToSpecification<TSpec>(nameof(TSpec.scenario)).SpecificationIdentity, a twin of Bobcat's currentMarkerSpecNamingrule.[BobcatFeature]is matched by attribute name, throughCustomAttributeData.apply_to_volunteer→apply to volunteer/volunteer application submitted.SpecificationBindingDescriptorcarries the spec identity,CommandType, and optionallyDomain,Namespace, an explicitSliceName, andResolvedTypes.EventModelSpecifications.Link(model, manifest)is a pure function over an assembled model.HotspotOrigin.UnresolvedSpecificationhotspot instead of guessing.EventModelProvenance.Specified:3, but it ranks between Declared and Derived.Mergenow compares rungs throughRank()/Outranks(), not the raw enum value.SourceDisagreementhotspot.--specsoption are follow-ups.Wire / downstream
Specified,UnresolvedSpecification,AggregateDeclaration, and theEventModelRoleadditions.event-model-vuetypes and enum pins are updated; type-check is clean and all 225 tests pass.SpecifiedandUnresolvedSpecification.JasperFx.SourceGenerator.Testsnow references JasperFx.Events.Tests
ApplicationModelNameTests,DiscoveredEventModelsTests(a stand-inAssemblywhose type enumeration throws),ForAggregateTestsandSpecificationLinkTests, plus a wire round-trip extended to the new members.🤖 Generated with Claude Code
https://claude.ai/code/session_01J8KxC18Q51z5w4u6YARwe4