Fix PsrpOperator constructor validation to use provision checks inste… - #70656
Open
bujjibabukatta wants to merge 3 commits into
Open
Fix PsrpOperator constructor validation to use provision checks inste…#70656bujjibabukatta wants to merge 3 commits into
bujjibabukatta wants to merge 3 commits into
Conversation
bujjibabukatta
requested review from
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
jason810496,
jscheffl and
potiuk
as code owners
July 29, 2026 02:22
bujjibabukatta
force-pushed
the
fix/#70296
branch
from
July 29, 2026 05:43
801c96f to
9e429c9
Compare
Contributor
|
Please note that it's a competitor PR of #70347 (you may keep this open, but I might end up merging the other - depending which provides the best match first) |
eladkal
reviewed
Jul 29, 2026
Contributor
There was a problem hiding this comment.
Why was this file modified?
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
Part of the burn-down tracked in #70296.
PsrpOperator.__init__validatedcommand/powershell/cmdlet/arguments/parametersusing truthiness checks instead of
is not Nonechecks. Per the guidance in #70296,"was this provided" checks are allowed to stay in
__init__, but must useis not Nonepolarity rather than truthiness — so this is a fix in place, not a move to
execute().What was wrong
command/powershell/cmdletwere collected into asetbefore being passed toexactly_one(). If two of them happened to render to the same string, the set wouldcollapse them and validation would incorrectly pass.
if arguments and ...,if parameters and ...,if cmdlet:treated an explicitlyprovided empty list/dict/string as "not provided", silently skipping validation.
Fix
Replaced truthiness checks with
is not Nonechecks, and pass fields toexactly_one()directly instead of via a
set.__init__is now limited to this provision check plusplain
self.field = fieldassignments.Testing
Added three regression tests in
test_psrp.pycovering: two duplicate field values,an empty
argumentslist, and an emptyparametersdict — all now correctly raiseValueError.Related: #70296
Was generative AI tooling used to co-author this PR?
Generated-by: Claude following the guidelines