Repository navigation
fix(hottesting): let derived feeds observe mocked inputs - #3192
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]>
… 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]>
… 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]>
…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]>
- 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]>
- 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]>
|
Following a deeper pass through the history, I think this is a general hot-swap placement issue rather than a mocking-specific mechanism.
I think the consistent design is:
The current PR has most of the necessary subscription-level primitive, but keeping both the state-level and subscription-level hot-swap paths leaves two competing mechanisms. I am going to update the branch and spec around one subscription-owned mechanism, with coverage for derived feeds, hot reload, real state inputs, state-edit isolation, re-swap, and the self-resolution guard. |
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.
33cbb9d to
2d162f2
Compare
|
Note: pushed an updated implementation based on my research, but it yet validated. |
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.
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.
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.
The SessionCurrentEnumerator GetSource wrapper only forwarded to the feed; fold it into GetEnumerator with a null-conditional call.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
@dr1rrb Verified and reviewed your additional changes, the fix still works. So now we can remove the "set every derived member" rule from the agent mocking skill |
|
@Mergifyio backport servicing/7.4 |
✅ Backports have been createdDetails
|
…-3192 fix(hottesting): let derived feeds observe mocked inputs (backport #3192)
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.