Repository navigation
Conversation
| { | ||
| while (taken.Contains(name)) | ||
| { | ||
| name = "_" + name; |
Comment on lines
+479
to
+487
| foreach (var attr in model.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, ctorDep))) | ||
| { | ||
| if (attr.ConstructorArguments is { Length: 1 } args | ||
| && args[0].Value is string parameter | ||
| && attr.NamedArguments.Any(n => n.Key == "Eager" && n.Value.Value is true)) | ||
| { | ||
| yield return parameter; | ||
| } | ||
| } |
3 of 5 tasks
…n reads - Fixture ShelfModel builds a feed from a method group (Service.GetBooks) - Generator cases: a method-group feed, an eager [CtorDependency], parameters named like Create's own - A lambda feed keeps its null-injected service - Fails on main: Create(service, mock) does not exist and the method-group feed throws in Create Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n reads - The analysis counts a parameter read outside a lambda in a feed's body as eager: the view-model's constructor builds every feed, so a method group (ListFeed.Async(Service.GetItems)) reads its service then - A receiver that is the member a parameter feeds (a positional record's property, an assigned field) counts as that parameter - Create reads [CtorDependency(Eager = true)] on the metadata path and runs the analysis on the source path, and takes those parameters from its caller instead of null-injecting them - Create's own parameter and local are renamed when a forwarded parameter already uses the name; keyword names are escaped - The messenger keeps its stopgap Closes #3282 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion reads - testing.md and rules.md: say which parameters Create takes as arguments; the RecipeModel example uses a lambda, so Create(mock) holds - Spec 013: R1 built (architecture §2.1 and §2.2, implementation §3), history v20 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… more spellings - A receiver is seen through this., parentheses, ! and casts (this.Service.GetItems) - A feed set in a property initializer is analysed like one written as a getter - A field assigned in an expression-bodied constructor (=> _service = service) maps to its parameter - The source path also reads a hand-declared [CtorDependency(Eager = true)], the author's escape hatch - An Eager argument that is not a plain value is ignored instead of throwing - Create's parameter lists are built one way; CtorDependencyAttribute.Eager documents feed bodies Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- spec §8: Create takes the mock record plus any service construction dereferences - architecture §2.1: what the eager scan walks, and what a hand-declared attribute covers - history v20: the extra spellings, why no diagnostic is needed, the metadata path needs a rebuild - testing.md: the example lambda without async/await Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rajamatt
force-pushed
the
dev/mara/mock-create-eager-services
branch
from
November 13, 2026 15:35
39b8f95 to
4f860ed
Compare
- Line 33 of specs/026-mvux-hr-replaced-model-ctor-guard/spec.md starts with a tab, which fails markdownlint MD010 - The docs validation runs on pull requests that change doc/, so this fails them until main is fixed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rajamatt
marked this pull request as ready for review
November 13, 2026 17:06
|
Tick the box to add this pull request to the merge queue (same as
|
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.
GitHub Issue (If applicable): closes #3282
PR Type
What is the current behavior?
{Vm}Mock.Createnull-injects every constructor parameter except a messenger. A model that reads a service while its view model is built throwsNullReferenceExceptioninCreate, before any mock is applied:ListFeed.Async(Service.GetItems): the generated view-model constructor builds every feed, and binding the method group readsService;What is the new behavior?
Createtakes such a parameter from its caller:Create(service)andCreate(service, mock). This is spec 013's R1, which was planned but not built.this., parentheses,!and casts are seen through.[CtorDependency(Eager = true)], hand-declared ones included, and on the source path also runs the analysis.Create()andCreate(mock), emitted exactly as before.WeakReferenceMessenger.Reviewer's guide
FeedDependencyAnalysis.FindEagerCtorParametersandDereferencedName, thenFeedsMockGenerator.GenerateandIsTakenFromCaller.[CtorDependency(Eager = true)]for a parameter a feed body reads eagerly.62e716da0, adds tests only.Given_GeneratedMock.When_FeedIsAMethodGroup_Then_CreateTakesTheServiceAndInputFlows(fixtureShelfModel): onmainthe test project does not compile, becauseCreate(service, mock)does not exist.Given_FeedsMockGenerator: a method-group feed, an eager[CtorDependency], and parameters namedmock,vmandeventfail onmain. A lambda feed, whose service stays null-injected, passes on both.When_ModelCarriesNoMetadata_Then_MockIsGeneratedFromSourceexpects a different call: its feed,Service.Items, reads the service while the view model is built.424599cd2, with its tests. These are the other spellings (this.,!, a cast, a property initializer), a field assigned in an expression-bodied constructor, and a hand-declared attribute on the source path.963277482and4f860ed59:testing.md,rules.mdand spec 013 (spec §8, architecture, implementation, history v20).40e7e12aareplaces a hard tab in spec 026 that came frommain(fix(reactive): MVUX hot reload of a command's parameters crashes or loses list updates #3296), so the docs validation passes.PR Checklist
Uno.HotTesting.Reactive.Tests51 pass;Uno.Extensions.Reactive.Tests1654 pass, 19 skipped;Uno.Extensions.Core.Tests61 pass). UI and runtime tests were not run locally.Breaking change: a model whose view model reads a service while it is built loses
Create()andCreate(mock), which threw anyway, and getsCreate(service)andCreate(service, mock)instead. Callers pass a service, often a fake. The mocked feeds never call it. Because the change is breaking, it should not be backported torelease/stable/8.0.Other information
: this(...)) and the initializers of other members. A hand-declared[CtorDependency(Eager = true)]covers them.IMessengerargument.🤖 Generated with Claude Code