You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depends on #78 (the DataStore key-shape migration — this issue adds a new piece of persisted state, better to land after that migration than alongside it).
Summary
Add stateful/sequential mocks: an operation can be configured to return a different response on successive calls (e.g. first call returns 202 Pending, second call returns 200 Success, further calls stay at 200 Success). This is a new capability — nothing in DevView supports it today.
Why this is useful
The most common manual-testing gap this fills: polling flows (order status, upload progress, async job completion) where the interesting behavior is the transition between states across repeated calls to the same endpoint, not any single response in isolation. Today, an operation's mock is static for the duration it's selected — there's no way to make "call it three times and watch the state progress" happen without manually flipping the selected mock between calls.
Verified: this doesn't exist anywhere today
NetworkMockState (devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/NetworkMockState.kt:68-72) holds only globalMockingEnabled, endpointStates, lastModified — no counter of any kind. EndpointMockState/OperationMockState (:204-262) is a two-variant sealed interface (Network/Mock) with no sequence concept. The plugin resolves a response once per request with no per-call state (NetworkMockPlugin.kt:223-293).
What to build
A new OperationMockState variant, e.g. Sequence(responses: List<Mock>, currentIndex: Int) (naming/shape to be finalized against whatever ✨ Add Renovate config #3's rename settles on), alongside Network and Mock.
A per-operation call counter, keyed by OperationKey, incremented each time the sequence variant is matched and served. This needs a persisted or at-least-session-scoped counter — decide whether it lives in DataStore (survives app restart, consistent with how the rest of NetworkMockState persists) or in-memory only (resets on process death) and document the choice; recommend DataStore for consistency with everything else in NetworkMockState.
Exhaustion behavior: decide what happens once the sequence is exhausted. Recommend stick on last (matches the "third call onward stays at 200 Success" example above) over looping back to the start or falling through to the real network — stick-on-last is the least surprising default and matches how most real async-completion flows behave (the terminal state is stable, not cyclic).
Reset interaction: the counter must reset alongside existing mock-state resets — MockStateRepository.resetKnownEndpointsToNetwork() (devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockStateRepository.kt:362-369) and NetworkMockState.resetAllToNetwork() (devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/NetworkMockState.kt:148-151) both need to clear any in-progress sequence position, not just revert to Network — otherwise a reset followed by re-selecting the same sequence resumes mid-sequence instead of restarting at index 0.
Part of #72
Depends on #78 (the DataStore key-shape migration — this issue adds a new piece of persisted state, better to land after that migration than alongside it).
Summary
Add stateful/sequential mocks: an operation can be configured to return a different response on successive calls (e.g. first call returns
202 Pending, second call returns200 Success, further calls stay at200 Success). This is a new capability — nothing in DevView supports it today.Why this is useful
The most common manual-testing gap this fills: polling flows (order status, upload progress, async job completion) where the interesting behavior is the transition between states across repeated calls to the same endpoint, not any single response in isolation. Today, an operation's mock is static for the duration it's selected — there's no way to make "call it three times and watch the state progress" happen without manually flipping the selected mock between calls.
Verified: this doesn't exist anywhere today
NetworkMockState(devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/NetworkMockState.kt:68-72) holds onlyglobalMockingEnabled,endpointStates,lastModified— no counter of any kind.EndpointMockState/OperationMockState(:204-262) is a two-variant sealed interface (Network/Mock) with no sequence concept. The plugin resolves a response once per request with no per-call state (NetworkMockPlugin.kt:223-293).What to build
OperationMockStatevariant, e.g.Sequence(responses: List<Mock>, currentIndex: Int)(naming/shape to be finalized against whatever ✨ Add Renovate config #3's rename settles on), alongsideNetworkandMock.OperationKey, incremented each time the sequence variant is matched and served. This needs a persisted or at-least-session-scoped counter — decide whether it lives in DataStore (survives app restart, consistent with how the rest ofNetworkMockStatepersists) or in-memory only (resets on process death) and document the choice; recommend DataStore for consistency with everything else inNetworkMockState.MockStateRepository.resetKnownEndpointsToNetwork()(devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockStateRepository.kt:362-369) andNetworkMockState.resetAllToNetwork()(devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/NetworkMockState.kt:148-151) both need to clear any in-progress sequence position, not just revert toNetwork— otherwise a reset followed by re-selecting the same sequence resumes mid-sequence instead of restarting at index 0.Acceptance criteria
Files likely touched
devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/NetworkMockState.ktdevview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockStateRepository.ktdevview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.ktdevview-networkmock/src/commonMain/kotlin/com/worldline/devview/networkmock/NetworkMockEndpointScreen.kt