Skip to content

Fix cached URL Option A playback behavior in spring example#69

Merged
sloppylopez merged 22 commits intofeat/1.2-Parametrized_testsfrom
codex/fix-404-in-fullflowflexibleit-test
Mar 6, 2026
Merged

Fix cached URL Option A playback behavior in spring example#69
sloppylopez merged 22 commits intofeat/1.2-Parametrized_testsfrom
codex/fix-404-in-fullflowflexibleit-test

Conversation

@sloppylopez
Copy link
Owner

Motivation

  • Parameterized playback with Option A requires the test target URL to be resolved at request time so each invocation uses its per-invocation WireMock port.
  • The example previously cached the base URL at bean construction which reproduces the same failure mode seen in nh-api-bp FullFlowFlexibleIT (requests stuck on the class-level port and returning 404).

Description

  • Changed CachedBaseUrlClient to read app.postmanecho.url from Spring Environment at request time and to fail fast when the property is missing.
  • Reworked CachedUrlFailsWithOptionAIT into a validating playback test that asserts HTTP 200 and verifies the expected id is present in each parameterized response.
  • Updated UserController comment for /api/postmanecho/cached-users/{id} to clarify the endpoint covers a non-Feign, request-time URL resolution path.

Testing

  • Attempted to run the focused Gradle test ./gradlew :examples:spring-boot-example:test --tests "example.flow.CachedUrlFailsWithOptionAIT", but the Gradle wrapper download was blocked by a network/proxy error (HTTP/1.1 403 Forbidden).
  • Performed automated repository checks (git status, git diff) and file inspections to verify the intended code changes and committed the patch successfully.

Codex Task

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates StableMock’s Spring Boot example and core StableMock utilities to improve parameterized playback behavior (Option A) and make recorded artifacts/matching more robust.

Changes:

  • Update the Spring example client to resolve app.postmanecho.url at request time (instead of caching it at bean construction).
  • Extend StableMock core to support dropping response headers from recorded stubs and filtering out certain scoped-request identity/plan ignore patterns at load time.
  • Refresh example recorded fixtures and add focused unit tests for header-ignore, ignore-pattern filtering, and invocation-dir matching.

Reviewed changes

Copilot reviewed 207 out of 261 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/java/com/stablemock/core/storage/SingleAnnotationMappingStorageHeaderIgnoreTest.java Adds tests validating response-header removal behavior for recorded mappings.
src/test/java/com/stablemock/core/analysis/AnalysisResultStorageTest.java Adds test ensuring scoped-request identity/plan ignore patterns are filtered out at load time.
src/test/java/com/stablemock/StableMockExtensionTest.java Adds test for stricter parameterized invocation directory matching.
src/main/java/com/stablemock/core/storage/MappingStorage.java Extends mapping save API to pass through ignore-response-headers configuration.
src/main/java/com/stablemock/core/analysis/AnalysisResultStorage.java Adds overload + filtering logic for scoped-request identity/plan ignore patterns.
src/main/java/com/stablemock/U.java Expands @U annotation with ignoreResponseHeaders and paths options and updates documentation.
examples/spring-boot-example/src/main/java/example/CachedBaseUrlClient.java Resolves base URL from Environment per request to support Option A per-invocation ports.
examples/spring-boot-example/src/test/java/example/flow/ParameterizedStableKeyScenarioIT.java Updates class-level comment to clarify regression intent.
examples/spring-boot-example/src/test/resources/** Updates/refreshes recorded StableMock fixtures and analysis artifacts used by example tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sloppylopez sloppylopez requested a review from Copilot March 5, 2026 17:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@sloppylopez sloppylopez merged commit 1bc48d8 into feat/1.2-Parametrized_tests Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants