Repository navigation
fix(hottesting): let derived feeds observe mocked inputs (backport #3192) - #3210
Merged
Merged
Conversation
- in a mocking context, SourceContext.GetOrCreateSource asks the mocking layer which source to subscribe to; core only gains that hook (IMockingSourceResolver, registered by MockingService next to the activation probe), also used by FeedDependency for dynamic feeds - Uno.HotTesting.Reactive resolves each observed feed to one swap layer per state store, and SwapFeed/SwapListFeed swap it together with the state (a list feed under both its keys), so Select, Where, list operators and dynamic feeds see a mocked input - derivations observe the layer below the state's own updates, so a state edit stays local as in a live app; the resolver takes none of the store's locks - live (non-mocking) contexts never consult the resolver and keep the existing subscription path - tests: derived member computes over the mock and recomputes on re-swap, list Where computes over the mock, override still wins, state edits stay local, dynamic feed recomputes over a swapped list, a live context subscribes to its input directly Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 745fc87)
… derived feeds - spec 013 architecture, implementation and spec text now describe the resolver hook and the per-feed swap layer instead of the factory-cache wrap that was never built - history v16 records the fix, the drafts dropped in review, and the D6 row update Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 63f36cb)
… of the resolver - the state observes the layer of its feed like the feeds derived from it, so SwapFeed/SwapListFeed now point that one layer at the mock, through an UnroutedFeed; a list feed no longer needs a second key - a mock that is the member's own feed now restores the real feed instead of making the layer observe itself, and a replacement no longer gets a layer of its own on every SetMock - the resolver leaves every state as-is, list states included (IListState is not an IState<IImmutableList<T>>) - the resolver is registered before the activation probe; its contract and the mocking behaviour of GetOrCreateSource are documented - tests: a two-level scalar chain computes over the mock and recomputes on re-swap, the member's own feed restores the real input, the live-context guard now asserts the resolver is never consulted, and LongItems is classified optional Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 087c0c0)
…rivations observe - spec 013 now says SetMock is a typed swap of the member's layer, lists the resolver in the seams table, and records the accepted costs (no completion under mocking, one layer per observed feed) - the remaining "reflection over IHotSwapState" wording and the D6 row are aligned with the implementation Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 3255e7a)
- A member's state and the feeds derived from it already read the feed through one subscription of the context; the swap sat above it, in the state. - In a mocking context, that subscription now reads its feed through a HotSwapFeed, and SetMock swaps it: the state and every derivation see the mock. - A state input is still swapped as a state, and a state's UpdateFeed is never wrapped. - Replaces the source resolver, so core no longer calls into the mocking package. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 93a3b6c)
- The state and every derivation read one subscription per feed, which a mocking context can swap. - The source resolver moves to the dropped drafts in history v16. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit dc3a8a7)
Use the context shared FeedSubscription as the only source-replacement point for hot reload and mocking. Preserve state update handoff and alias replacement feed identities for incremental hot reload. (cherry picked from commit 2d162f2)
Remove the transitional dual-mode hot-swap path and keep subscription identity aliases behind StateStore shared cache insertion logic. Cover direct enumeration and replacement identity continuity at the FeedSubscription boundary. (cherry picked from commit eb70e36)
Name state replacement after the operation while keeping UpdateFeed subscriptions direct so state updates activate before the first subscriber. Add a focused guard test and document the invariant. (cherry picked from commit 8dc291c)
Wrap UpdateFeed subscriptions consistently for hot reload and mocking. Connect eager subscriptions through FeedSubscription and activate the final redirected state before applying updates without a subscriber. (cherry picked from commit 662dd22)
The SessionCurrentEnumerator GetSource wrapper only forwarded to the feed; fold it into GetEnumerator with a null-conditional call. (cherry picked from commit a16a8c0)
kazo0
approved these changes
Oct 7, 2026
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.
Refs unoplatform/studio.live#4074
PR Type
Current behavior
Generated MVUX mocks replace a state above the context-shared subscription. Derived feeds (
Select,Where,Combine, list operators,Messages(), and dynamic feeds) therefore continue to read the real input, which can reach null-injected services and fail.New behavior
FeedSubscriptionowns the optionalHotSwapFeedand is the single source-replacement point shared by states and operators.StateImplno longer owns a generic source hot-swap. Its narrowHotSwap(replacement)redirects future writes to the replacement state.HotSwapFeedalways enumerates its wrapped feed withGetSource; resolving it through the context would return the same subscription recursively.UpdateFeed, uses the same wrapper. Eager states and updates without a subscriber explicitly connect their subscription.StateStoreinsertion path as normal subscription creation.Verification
Review notes
Start with
FeedSubscription,HotSwapFeed,StateStore,StateImpl.HotSwap,MockingService, andBindableViewModelBase.HotReload.Given_FeedSubscriptioncovers direct enumeration, explicit eager activation, existing-subscriber replacement, and feed-identity aliasing.Given_StateImplcovers updates without subscribers, including redirected lazy states. Spec 013 records the selected architecture and self-resolution guard.This is an automatic backport of pull request #3192 done by [Mergify](https://mergify.com).