Fix 12 bugs in hand-written files, templates, and build scripts#156
Open
luke-hagar-sp wants to merge 1 commit intomainfrom
Open
Fix 12 bugs in hand-written files, templates, and build scripts#156luke-hagar-sp wants to merge 1 commit intomainfrom
luke-hagar-sp wants to merge 1 commit intomainfrom
Conversation
- Fix C-style // comment causing runtime error in api_client template
- Fix inverted anyOf match condition breaking all anyOf deserialization
- Fix Get-Config returning undefined local variable instead of Script scope
- Fix URL validation regex character class to proper protocol match
- Fix inability to set falsy values for Experimental, retry params
- Fix proxy being cleared unconditionally when not passed
- Fix same regex bug in configuration template
- Fix undefined Function variable in PaginateSearch error handler
- Add Function parameter to Invoke-PaginateSearch for non-V3 search APIs
- Fix Get-Accounts -> Get-BetaAccounts in Beta test block
- Remove trailing comma in JSON test fixture
- Replace broken fs.stat() check with fs.mkdir({ recursive: true })
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f2ef170 to
7500924
Compare
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
Cross-SDK audit identified 12 bugs in the PowerShell SDK across hand-written files, mustache templates, and build scripts. Template fixes will propagate to generated code on next
make build.Bug Fixes
Critical
PS1: C-style
//comment is invalid PowerShell — causes runtime error on array query paramssdk-resources/resources/api_client.mustacheL107:if ($Parameter.Value.Count -gt 1) { // array— PowerShell doesn't support//comments. This causes a parse error whenever an API call includes array-valued query parameters.//to#.PS2: Inverted anyOf match condition breaks all anyOf deserialization
sdk-resources/resources/model_anyof.mustacheL71:if ($match -ne 0)—$matchstarts at 0 and increments on match. The condition-ne 0is$falseon the first iteration, so the first anyOf type is never attempted, and no subsequent types can match either.if ($match -eq 0).PS3:
Get-Configreturns undefined local$Configurationinstead of script-scoped variablePSSailpoint/Configuration.ps1L324:return $Configurationreturns an undefined local variable. When neither env nor local config succeeds, this returns$null, causing a null reference on$Configuration.BaseUrl[-1]inGet-DefaultConfiguration.return $Script:Configuration.Medium
PS4: URL validation regex
'[http|https]'is a character class, not alternationPSSailpoint/Configuration.ps1L149:[http|https]matches individual charactersh,t,p,s,|— not the strings "http" or "https". This accepts URLs with schemes likeftp,ssh, etc.'^https?$'.PS5: Cannot set
$Experimentalto$false, or retry values to0PSSailpoint/Configuration.ps1L175, L179, L183:If ($Experimental),If ($MaximumRetryCount),If ($RetryIntervalSeconds)all skip falsy values ($false,0).If ($PSBoundParameters.ContainsKey('...')).PS6: Proxy cleared unconditionally when not passed to
Set-DefaultConfigurationPSSailpoint/Configuration.ps1L192-194: Theelsebranch of the proxy check sets$Script:Configuration['Proxy'] = $nulleven when the user didn't pass-Proxyat all, clearing any previously configured proxy.elsetoelseif ($PSBoundParameters.ContainsKey('Proxy')).PS7: Same regex bug as PS4 in generated configuration template
sdk-resources/resources/configuration.mustacheL135: Same'[http|https]'character class bug.'^https?$'.Low
PS8 + PS9: Hardcoded
Search-Postand undefined$FunctioninInvoke-PaginateSearchPSSailpoint/Pagination.ps1L104: The search function was hardcoded toSearch-Post, making it impossible to paginate Beta/V2024/V2025/V2026 search endpoints. The catch block also referenced$Functionwhich was undefined.$Functionparameter (default"Search-Post"for backward compatibility) and use& $Functionto invoke it dynamically. This also resolves the undefined$Functionin the error handler.PS10: Beta test calls V3
Get-Accountsinstead ofGet-BetaAccountsPSSailpoint/tests/Validation.Tests.ps1L49: The Beta describe block's "Get-BetaAccounts" test was actually calling the V3Get-Accountsfunction.Get-BetaAccounts.PS11: Trailing comma in JSON test fixture causes parse error
PSSailpoint/tests/Validation.Tests.ps1L25: Trailing comma after"query": "*"is invalid JSON and causesConvertFrom-JsonToSearchto fail.PS12: Broken
fs.stat()check inmoveFiles()in postscript.jssdk-resources/postscript.jsL70: Same issue as Go SDK —fs.stat()throws on missing path instead of returning falsy.await fs.mkdir(destPath, { recursive: true }).Verification
make buildTest plan
Import-Module ./PSSailpoint/PSSailpoint.psm1to verify module loadsInvoke-Pesterto verify test fixes (PS10, PS11)Set-DefaultConfiguration -Experimental $falseto verify PS5 fixSet-DefaultConfiguration -BaseUrl "ftp://evil"is rejected by PS4 fix🤖 Generated with Claude Code