fix: support nested folders for all kind of handlers#1239
Merged
Conversation
ContainedDecomposedHandler._setholderFolder() used pathAfterType[0] to find the PermissionSet directory, assuming it was immediately after the type directory. This fails for nested folders like permissionsets/marketing/Admin/fieldPermissions/... where the intermediate folder name was used instead of the actual PS name. Fix: compute the PS directory position from the file path's end using named offset constants, supporting arbitrary nesting depth.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1239 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 58 58
Lines 1574 1603 +29
Branches 204 213 +9
=========================================
+ Hits 1574 1603 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
268b809 to
9f1295d
Compare
Add tiered resolution strategy to handle intermediate organizational folders between type directories and components (e.g., permissionsets/marketing/Admin/...). The resolver now: (1) returns fromPath directly for flat paths, (2) skips scanning for empty-suffix types, (3) extracts component names from depth-2 file names without git I/O, and (4) bounds deeper scans to the type directory level. Also fixes BotHandler to use parentFolder instead of pathAfterType[0] for correct nested folder support.
Return fromPath directly when pathAfterType.length === 2: folder always matches the component at this depth, so scanning via git ls-tree is unnecessary.
Use pathExists (git cat-file -t) to probe for meta files directly instead of listing directories (git ls-tree) and searching for matches. Checks both inside and beside component directory placements.
This reverts commit 3e51bba.
This reverts commit 06b43c4.
those are catched at push
…taBoundaryResolver Use getFilesPath (git ls-tree -r) with hierarchical cache instead of walking up directories one level at a time with listDirAtRevision. This reduces subprocess calls from ~N per component to 1 per type directory, bringing E2E from ~26.6s to ~24.3s.
|
Published under $ sf plugins install sfdx-git-delta@dev-1239 |
|
Shipped in release $ sf plugins install sfdx-git-delta@latest-rc
# Or
$ sf plugins install sfdx-git-delta@v6.33.1💡 Enjoying sfdx-git-delta? |
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.
Explain your changes
Problem
ContainedDecomposedHandler._setholderFolder()usedpathAfterType[0]to find the PermissionSet directory, assuming it was immediately after the type directory (permissionsets/). This fails for nested folders likepermissionsets/marketing/Admin/fieldPermissions/...where the intermediate folder name (marketing) was used instead of the actual PS name (Admin).MetadataBoundaryResolver.scanAndCreateElement()walked UP directory by directory callinglistDirAtRevision(onegit ls-treesubprocess per level) with no caching in GitAdapter. For ~25 depth-3+ files across ~4 type directories, this generated ~20-40 subprocess calls, adding ~2.7s overhead.Fix
ContainedDecomposedHandler: Compute the PS directory position from the file path's end using named offset constants (
PS_DIR_OFFSET_IN_SUBDIR = 3,PS_DIR_OFFSET_FLAT = 2), supporting arbitrary nesting depth. UsescomponentName === parentFolderto distinguish flat files from files in child type subdirectories.MetadataBoundaryResolver: Replace directory walk-up loop with
getFilesPath(typeDir, revision)which usesgit ls-tree -r(recursive) with GitAdapter's hierarchical cache. ONE git call per type directory instead of N per component. Removed redundantMAX_HIERARCHY_DEPTHguard (loop already terminates at'.'). E2E time reduced from ~26.6s to ~24.3s.Does this close any currently open issues?
Any particular element that can be tested locally
Test with a decomposed PermissionSet project where the PermissionSet directory is nested inside intermediate folders:
Verify that
package.xmlcontainsPermissionSet: Admin(notPermissionSet: marketing).Any other comments
findComponentName/metadataRepo.get()limitation