feat: granular decomposed PermissionSet child handling#1238
feat: granular decomposed PermissionSet child handling#1238
Conversation
|
Published under $ sf plugins install sfdx-git-delta@dev-1238 |
|
Hi @Lintlinger ! Could you test on your laptop and help us validate this PR please ? Ensure the result produced is deployable please |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1238 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 58 58
Lines 1574 1566 -8
Branches 204 205 +1
=========================================
- Hits 1574 1566 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@scolladon |
For both |
Closing — granular approach is not viableManual testing on a scratch org revealed that decomposed PermissionSet child types are not independently deployable by the Salesforce CLI. The granular approach this PR implements (emitting Key findings
What's worth fixingThe existing |
Explain your changes
Generate granular
package.xmlentries for decomposed PermissionSet child types instead of copying the entire PermissionSet folder.<members>Admin</members><name>PermissionSet</name>+ copies entire folder<members>Admin.Account.MyField__c</members><name>FieldPermission</name>+ copies only the changed child fileSupports both decomposed formats:
decomposePermissionSetBeta): subdirectory layout (permissionsets/Admin/fieldPermissions/...)decomposePermissionSetBeta2): flat layout (permissionsets/Admin.Account.MyField__c.fieldPermission-meta.xml) and objectSettings groupingKey changes:
decomposition: 'containedDecomposed'discriminantPermissionSetChildHandler(extendsStandardHandler, overrides_getElementName()with segment-counting logic)TypeHandlerFactory.resolveHandler()ContainedDecomposedHandlerentirely — monolithic.permissionset-meta.xmlfalls toStandardHandlerSUB_OBJECT_TYPESfor rename detection dedupManual Testing Findings
Protocol
SGD_Test_PermSet(applicationVisibilities, objectPermissions, fieldPermissions, tabSettings, userPermissions)decomposePermissionSetBeta(folder-per-type) anddecomposePermissionSetBeta2(flat + objectSettings)Findings
Registry: 14/15 child types are in the SF CLI metadata registry. Only
ObjectSettingsis NOT.Manifest deploy (
--manifest): Child type entries (e.g.FieldPermission: PSName.Object.Field) result innumberComponentsDeployed: 0. The CLI accepts the type but silently deploys nothing — it cannot resolve child member names to source files. OnlyPermissionSet: PSNameworks.Source-dir deploy (
--source-dir): Always reconstructs the full PermissionSet from all decomposed files in the project, regardless of which single child file is specified. Not granular.Delta deploy (
-d): Without parent.permissionset-meta.xml, deploy fails. With parent added, deploy succeeds but is destructive — the CLI replaces the full PS with only the files present in delta (all missing children are erased).Conclusion
Child types are not independently deployable. Decomposition is purely a local source format. The only working deployment strategy is:
package.xml: usePermissionSet: PSName(not child types)-d): copy the entire PS directory (all decomposed files), not just changed childrenComparison with
mainbranch (ContainedDecomposedHandler)The old implementation on
mainalready produces the correct output:PermissionSet: PSNameinpackage.xml(deployable)destructiveChanges.xmlDoes this close any currently open issues?
closes #1221
Any particular element that can be tested locally
Test with a decomposed PermissionSet project (Beta or Beta2 preset) and verify that
package.xmlcontains granular child type entries (e.g.,FieldPermission,ObjectSettings) instead ofPermissionSet.Any other comments
Important: Manual testing revealed that granular child type entries in
package.xmlare NOT deployable by the Salesforce CLI. The oldContainedDecomposedHandleronmainalready produces the correct deployable output (PermissionSet: PSName+ full PS directory copy). The granular approach needs to be revised to emitPermissionSetinstead of child types while still supporting detection of individual child file changes.E2E expected files need updating to match output changes.