feat: reload networkmock config without restarting the app - #124
Open
MaxMichel2 wants to merge 1 commit into
Open
MaxMichel2 wants to merge 1 commit into
MaxMichel2 wants to merge 1 commit into
Conversation
MockConfigRepository caches the parsed OpenAPI config forever after the first successful load, with no way to invalidate it - a developer editing a spec file had to restart the app to see the change. - MockConfigRepository.invalidate(): clears the cached config and response index, forcing the next loadConfiguration() to re-read and re-parse every spec from scratch. - NetworkMockViewModel.reloadConfiguration(): invalidates then reloads, re-registering the (possibly changed) set of operations. - A new 'Reload Config' toolbar action in NetworkMock, wired the same way as the existing 'Reset to Network' action (SharedFlow -> LaunchedEffect -> ViewModel call). Operations added, removed, or renamed in the spec appear immediately after reloading; persisted per-operation mock selections are untouched. Closes #90. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 22, 2026
MaxMichel2
added this pull request to stack #130
September 22, 2026 12:07
This was referenced Sep 23, 2026
This branch has not been deployed
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.
Summary
Closes #90.
Stacked on #123 (both touch
MockConfigRepository/NetworkMockPlugin's logging) — this PR's own diff is the last 12 files; merge #123 first.MockConfigRepositorycaches its parsed OpenAPI configuration forever after the first successful load, with no way to invalidate it. A developer editing a spec file on disk had no way to see the change without restarting the app — a meaningfully worse dev-loop than most of what this tool exists to speed up.What changed
MockConfigRepository.invalidate(): clears the cached config and response index, forcing the nextloadConfiguration()(or anything that calls it internally, likefindMatchingMock) to re-read and re-parse every configured spec from scratch.NetworkMockViewModel.reloadConfiguration(): invalidates then reloads, re-registering the (possibly changed) set of operations so write-side helpers stay in sync.NetworkMock, wired the same way as the existing "Reset to Network" action — a capacity-1MutableSharedFlow, collected in aLaunchedEffectinNetworkMockScreen.Public API
New public members —
api.txtregenerated viametalavaGenerateSignature:devview-networkmock-core:MockConfigRepository.invalidate()devview-networkmock:NetworkMockViewModel.reloadConfiguration(), andNetworkMockScreengained a new requiredreloadConfigSharedFlowparameter (no other call sites existed outsideNetworkMock.kt, which is updated).Docs updated:
networkmock-core.md(new "Caching & Reload" section),networkmock-ui.md(Screens),networkmock-workflows.md(new "Reloading a spec after editing it" section).Tests
MockConfigRepositoryTest: invalidate forces a re-read (call-count assertion), and invalidate + reload picks up a changed spec file (operation list assertion via a newMutableResourceLoaderfixture).NetworkMockViewModelTest:reloadConfiguration()invalidates then reloads, verified viacoVerifyOrder.Verification
All green.
🤖 Generated with Claude Code