Fix ResponseAsBool_HeadAsBoolean scenario coverage failing - #4981
Merged
Conversation
weidongxu-microsoft
marked this pull request as ready for review
July 21, 2026 02:49
weidongxu-microsoft
requested review from
bterlson,
iscai-msft,
jhendrixMSFT,
lmazuel,
m-nash,
markcowl,
srnagar and
timotheeguerin
as code owners
July 21, 2026 02:49
Contributor
|
All changed packages have been documented.
Show changes
|
commit: |
Contributor
|
You can try these changes here
|
Split the single HeadAsBoolean scenario into two (exists, notExists) so the intentional 404 response is validated with passOnCode(404) instead of passOnSuccess, which required all endpoints to be 2xx. Endpoint paths are unchanged to avoid downstream generated-code churn. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 192afd5d-4ac7-429d-a37b-c96478337db5
weidongxu-microsoft
force-pushed
the
weidxu/fix-head-as-boolean-scenario
branch
from
July 21, 2026 03:26
4de7634 to
40c1d21
Compare
msyyc
approved these changes
Jul 22, 2026
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.
Problem
The
Azure_ClientGenerator_Core_ResponseAsBool_HeadAsBooleanscenario fails coverage for all languages, even when the client behaves correctly (verified: JavaResponseAsBoolTestsassertions pass, but the Spector coverage file reports... _HeadAsBoolean => fail).Root cause
The mockapi used
passOnSuccessfor a two-endpoint scenario wherenotExistsintentionally returns 404 (to exercise the@responseAsBoolfalse path).passOnSuccesssetspassCondition: "response-success", which the coverage tracker evaluates ascheckAll(x => x.status >= 200 && x.status < 300)— so the 404 endpoint can never pass.passOnCodecan't help either, since it forces a single code for all endpoints while this scenario mixes 204 and 404.Secondary:
@route("/not-exists")was nested under the namespace's@route("/exists"), resolving to/exists/not-exists(the@scenarioDocclaimed/not-exists).Fix
Split into two scenarios:
..._HeadAsBoolean_exists→passOnSuccess(HEAD/exists-> 204 -> true)..._HeadAsBoolean_notExists→passOnCode(404)(HEAD/not-exists-> 404 -> false)Also corrects the
notExistsroute to/not-existsand regeneratesspec-summary.md.