Repository navigation
fix(ipa): correct parent-resource check in resourceBelongsToSingleParent - #1449
Merged
Merged
Conversation
Drop one path segment instead of two when normalizing an instance path, export the function, and add unit tests. No change to rule output. JIRA: CLOUDP-438303
DatMitro
requested review from
andmatei,
andreaangiolillo,
drinkbird,
lovisaberggren,
saisundar,
wtrocki and
yelizhenden-mdb
August 24, 2026 16:41
lovisaberggren
approved these changes
Aug 25, 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.
Proposed changes
resourceBelongsToSingleParentnormalizes an instance path down to its collection path before checking whether the segment preceding the resource name is a path parameter, but the slice removed two segments instead of one. That left the array still ending in a path parameter and put a plain resource name in thelength - 2slot, so the function returnedfalsefor every instance path:/groups/{groupId}/clusters/{clusterId}falsetrue/groups/{g}/clusters/{c}/processes/{p}falsetrue/groups/{groupId}TypeError: Cannot read properties of undefined (reading 'startsWith')falseThe throw happened because the slice emptied the array, so
resourcePathSections[length - 2]wasundefinedandisPathParamcalled.startsWithon it.Changes:
pop()instead of two.isRootLevelResourceandlongRunningOperations.No change to rule output. The only caller is
isSingletonResource, which always passes a resource collection identifier — a path that by definition does not end in a path parameter — so the affected branch was never taken. This is a latent-correctness fix; the fulltools/spectral/ipasuite passes unchanged (127 suites, 811 tests).Jira ticket: CLOUDP-438303
Checklist
Changes to Spectral