You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test-TypedValue (Private/Test-TypedValue.ps1) — via WithOutPropertyDefinition param set: throws exceptions
When Test-Condition calls Test-TypedValue via the WithPropertyDefinition set, it delegates back to Validate() and discards the return value. Three code paths, two behaviors, one answer dropped.
Files
Gatekeeper/Classes/Property.ps1:62-94
Gatekeeper/Private/Test-TypedValue.ps1
Gatekeeper/Public/Test-Condition.ps1:93
Recommended Approach
Decide on one canonical contract and route everything through it:
PropertyDefinition.Validate($Value) becomes the single validation function, returns a result object (or throws, per the chosen contract)
Test-TypedValue either delegates entirely to PropertyDefinition.Validate or is removed
Summary
Integer min/max and string length/pattern validation logic exists in two places with two different behavioral contracts:
PropertyDefinition.Validate()(Classes/Property.ps1:62) — writesWrite-Warning, returns$falseTest-TypedValue(Private/Test-TypedValue.ps1) — viaWithOutPropertyDefinitionparam set: throws exceptionsWhen
Test-ConditioncallsTest-TypedValuevia theWithPropertyDefinitionset, it delegates back toValidate()and discards the return value. Three code paths, two behaviors, one answer dropped.Files
Gatekeeper/Classes/Property.ps1:62-94Gatekeeper/Private/Test-TypedValue.ps1Gatekeeper/Public/Test-Condition.ps1:93Recommended Approach
Decide on one canonical contract and route everything through it:
PropertyDefinition.Validate($Value)becomes the single validation function, returns a result object (or throws, per the chosen contract)Test-TypedValueeither delegates entirely toPropertyDefinition.Validateor is removedTest-Conditioncaptures the result and fails the rule on validation failure (see Issue security: path traversal in FeatureFlagTransformAttribute and ConditionGroupTransformAttribute #18)This is related to Issue #18 (validation result discarded) and should be addressed in the same PR.
Notes