Skip to content

Add IgnoredQueryParameters support to SetDefaultMatcherOptions#26347

Open
Copilot wants to merge 4 commits intomainfrom
copilot/disable-api-version-check
Open

Add IgnoredQueryParameters support to SetDefaultMatcherOptions#26347
Copilot wants to merge 4 commits intomainfrom
copilot/disable-api-version-check

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

When ARM packages bump API versions, all recording tests fail on the api-version query parameter mismatch—even for APIs with no functional changes. This forces pointless re-recording. Mirrors .NET's CustomDefaultMatcher.IgnoredQueryParameters approach.

Changes

  • sdk/internal/recording/matchers.go: Add IgnoredQueryParameters []string to SetDefaultMatcherOptions, serialized as ignoredQueryParameters in the JSON body to the test proxy's CustomDefaultMatcher
  • sdk/internal/CHANGELOG.md: Add changelog entry for the new IgnoredQueryParameters field

Usage

Any consumer of the SetDefaultMatcher API can now specify query parameters to ignore:

recording.SetDefaultMatcher(nil, &recording.SetDefaultMatcherOptions{
    IgnoredQueryParameters: []string{"api-version"},
})

The sdk/resourcemanager/internal consumer changes (calling SetDefaultMatcher with api-version ignored in StartProxy) will be in a follow-up PR after this module change is released.

Original prompt

This section details on the original issue you should resolve

<issue_title>Disable API version check when playback recording test</issue_title>
<issue_description>Currently, when we release a new API version for ARM package, the recording tests need to be re-record because of the playback failure of changing the API version. However, the re-record for API that does not change in the new API version just changes the API version param in recording file. So, it's better to disable API version param check when playback to reduce such meaningless work.</issue_description>

<agent_instructions>Try follow my comment of how .NET do it to change our Go code under: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/internal/testutil/recording.go</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@tadelesh .NET related logic:

For URI-pattern-specific cases, SDKs use UriRegexSanitizer to replace the api-version value with a placeholder (e.g., Subscription management SDK does this for tagNames operations).

● Here are the GitHub links:


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…-version during playback

Add IgnoredQueryParameters field to SetDefaultMatcherOptions in the recording
package to support ignoring specific query parameters during playback matching.

Configure the resourcemanager test proxy to ignore the api-version query
parameter during playback, avoiding the need to re-record tests when only the
API version changes.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copilot AI changed the title [WIP] Disable API version check in playback recording tests Ignore api-version query parameter during playback matching for ARM packages Mar 20, 2026
Copilot AI requested a review from tadelesh March 20, 2026 03:30
Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

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

@copilot Separate the change of sdk/internal/recording into a new PR.

@tadelesh tadelesh marked this pull request as ready for review March 20, 2026 03:54
Copilot AI review requested due to automatic review settings March 20, 2026 03:54
…nternal changes for follow-up PR

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 20, 2026

@copilot Separate the change of sdk/internal/recording into a new PR.

Done in c98e7e5. This PR now only contains the sdk/internal/recording/matchers.go change (adding IgnoredQueryParameters to SetDefaultMatcherOptions). The sdk/resourcemanager/internal consumer changes have been reverted and can go in a follow-up PR after this module is released.

Copilot AI changed the title Ignore api-version query parameter during playback matching for ARM packages Add IgnoredQueryParameters support to SetDefaultMatcherOptions Mar 20, 2026
Copilot AI requested a review from tadelesh March 20, 2026 03:57
Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

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

@copilot Add changelog to sdk/internal. Open another PR for the follow up work based on current branch.

Copy link
Contributor

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 aims to reduce unnecessary re-recording of ARM package tests by allowing the recording playback matcher to ignore specific query parameters (notably api-version) when matching requests during playback.

Changes:

  • Adds IgnoredQueryParameters support to SetDefaultMatcherOptions and forwards it to the test-proxy CustomDefaultMatcher payload.
  • Updates ARM testutil.StartProxy to ignore api-version during playback matching.
  • Adds a replace directive in sdk/resourcemanager/internal to consume the local sdk/internal changes.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

File Description
sdk/internal/recording/matchers.go Extends default matcher options with ignored query parameters and serializes them to the proxy matcher config.
sdk/resourcemanager/internal/testutil/recording.go Configures the proxy matcher to ignore api-version to prevent playback mismatches after API version bumps.
sdk/resourcemanager/internal/go.mod Adds a local replace for sdk/internal to compile against the newly added matcher option.
sdk/resourcemanager/internal/go.sum Removes sums for sdk/internal consistent with using a local replace.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 20, 2026

@copilot Add changelog to sdk/internal. Open another PR for the follow up work based on current branch.

Changelog added in 690a29d. For the follow-up PR: I've prepared the sdk/resourcemanager/internal changes on branch copilot/disable-api-version-check-resourcemanager (based on this branch). However, I'm unable to create the PR from this environment — could you open it targeting copilot/disable-api-version-check as the base, or would you prefer I add those changes after this PR merges and sdk/internal is released?

Copilot AI requested a review from tadelesh March 20, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable API version check when playback recording test

4 participants