Skip to content

feat: lazy response loading, version tags and NetworkMock UI rework - #106

Merged
MaxMichel2 merged 4 commits into
mainfrom
feat/networkmock-lazy-ui
Sep 8, 2026
Merged

feat: lazy response loading, version tags and NetworkMock UI rework#106
MaxMichel2 merged 4 commits into
mainfrom
feat/networkmock-lazy-ui

Conversation

@MaxMichel2

Copy link
Copy Markdown
Collaborator

Summary

PR 2 of milestone 0.2.0 (epic #72), stacked on #104 (PR 1, feat/networkmock-openapi-format). This PR's base branch will auto-retarget to main once #104 merges.

  • perf: load response bodies lazily instead of eager whole-config discovery #98OperationDescriptor no longer carries availableResponses. The main operation list never read them (only name/method/path/current-state), yet NetworkMockViewModel.loadConfiguration() eagerly discovered and decoded every response body for every operation on app start, and the detail screen then loaded the same files again on open. Response variants are now only ever loaded by NetworkMockEndpointViewModel when a detail screen actually opens.
  • feat: API version tag with configurable path regex #77Operation.version: a display-only tag extracted from a /v{n}/ path segment via a hardcoded default regex (e.g. /api/v2/x"v2"). Purely a UI label — RequestMatcher still matches only on path, method, and query params.
  • feat: rework the NetworkMock UI for specs and versions #79 — NetworkMock UI: a version chip on each operation row, a per-tab version filter (chips: "All" + each distinct version present), and a search field (name/path/operationId). Both filters are plain client-side state in the composable, mirroring AnalyticsScreen's existing filter pattern — no ViewModel changes needed for this part. Tabs were already one-per-spec from PR 1.

Deviations from the linked issues (called out per each issue's ACs)

  • perf: load response bodies lazily instead of eager whole-config discovery #98: satisfied by deleting OperationDescriptor.availableResponses rather than adding a new lightweight descriptor type, since the main screen never read that field in the first place. Added a test that loads a synthetic 300-operation spec through a real MockConfigRepository/NetworkMockViewModel and asserts only the spec file itself is read.
  • feat: API version tag with configurable path regex #77: the configurable-Regex acceptance criterion was dropped. Threading a Regex parameter through NetworkMockNetworkMockInitializerMockConfigRepositoryOpenApiParser is four public signatures and two api.txt files for a feature with exactly one consumer (the UI chip). Follow-up issue needed for non-standard (header/query-versioned) APIs.

Test plan

  • :devview-networkmock-core:testAndroidHostTest — green, including new version-tag parse tests
  • :devview-networkmock:testAndroidHostTest — green, including the new lazy-loading regression test
  • :devview-networkmock:connectedAndroidDeviceTest — 42/42 green on a real device (search, version filter, version chip cases)
  • :konsist:test — green
  • detektFull — green
  • api.txt regenerated for devview-networkmock-core and devview-networkmock (devview-networkmock-ktor unaffected)
  • Manual check in the sample app: spec tabs unchanged, version chips on Sample API's v1/v2 profile operations, search/version filter narrow the list, detail screen still shows correct response content and delays

Closes #98, #77, #79

@MaxMichel2 MaxMichel2 self-assigned this Sep 8, 2026
@MaxMichel2 MaxMichel2 added the enhancement New feature or request label Sep 8, 2026
@MaxMichel2 MaxMichel2 added this to the 0.2.0 milestone Sep 8, 2026
Base automatically changed from feat/networkmock-openapi-format to main September 8, 2026 14:16
The main operation list only ever renders name, method, path, and current
state, but NetworkMockViewModel.loadConfiguration() eagerly discovered and
decoded every response variant for every operation on app start, then the
detail screen loaded the same files again on open. Deletes
OperationDescriptor.availableResponses and the eager discovery loop;
response variants are now only ever loaded by NetworkMockEndpointViewModel
when a detail screen actually opens.

Closes #98
Operation.version is extracted from a /v{n}/ path segment via a hardcoded
default regex, giving the UI something to show for the endpoint versioning
the OpenAPI migration replaced the environment-based endpointOverrides
trick with. Purely a display label — RequestMatcher still matches only on
path, method and query params, so /api/v1/x and /api/v2/x remain two
distinct operations exactly as before.

The pattern isn't configurable yet: threading a Regex parameter through
NetworkMock -> NetworkMockInitializer -> MockConfigRepository ->
OpenApiParser is four public signatures for a feature with one consumer.
Deferred to a follow-up issue for non-standard (header/query-versioned)
APIs.

Closes #77
EndpointCard now renders a version chip next to the method/path row when
Operation.version is set. NetworkMockScreen adds a search field (filters by
name, path, or operationId) and a per-tab version filter row of chips
("All" plus each distinct version present), both plain client-side filters
over already-loaded data - no ViewModel change needed. Tabs were already
one-per-spec from the OpenAPI migration.

Closes #79
…ch/filter

Regenerates api.txt for devview-networkmock-core and devview-networkmock
(devview-networkmock-ktor's surface is unaffected). Updates
docs/modules/networkmock-core.md, networkmock-ui.md, networkmock.md,
networkmock-workflows.md, both modules' CLAUDE.md, and CHANGELOG.md to
describe Operation.version, the metadata/content discovery split, and the
search/version-filter UI added by #98, #77, #79.
@MaxMichel2
MaxMichel2 force-pushed the feat/networkmock-lazy-ui branch from 91775da to c5ad2f3 Compare September 8, 2026 14:16
@MaxMichel2
MaxMichel2 merged commit 6024b9e into main Sep 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: load response bodies lazily instead of eager whole-config discovery

2 participants