Sfdx-git-delta: Sharing rule diff not detected

Created on 12 Jun 2020  Â·  13Comments  Â·  Source: scolladon/sfdx-git-delta

Hello @scolladon,

Repro step:
Make a diff in AccountSharingRules meta file

Result:
sgd didn't ouput any change

Expected Result:
package.xml contains XXXsharingrules meta file and output force-app folder too

SGD version 3.1.0

SGD output:

alex@ubuntu:~/Documents/dentmaster$ sgd -d -t HEAD -f b96acca834a80540c108d9d2f19b9cc2de84380d -r . -o output
check output
alex@ubuntu:~/Documents/dentmaster$ cat output/package/package.xml 

<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <version>48.0</version>

Git ouput:

alex@ubuntu:~/Documents/dentmaster$ git diff HEAD..b96acca834a80540c108d9d2f19b9cc2de84380d
diff --git a/force-app/main/default/sharingRules/Account.sharingRules-meta.xml b/force-app/main/default/sharingRules/Account.sharingRules-meta.xml
index 9234e879..b3dca45f 100644
--- a/force-app/main/default/sharingRules/Account.sharingRules-meta.xml
+++ b/force-app/main/default/sharingRules/Account.sharingRules-meta.xml
@@ -1,4 +1,5 @@
-
+
+
     
         DWIN2_AccountRH_Edit
         Edit
@@ -14,7 +15,7 @@
         
             RecordTypeId
             equals
-            RH
+            RH (Obsolète),RH
         
     
     
@@ -33,7 +34,7 @@
         
             RecordTypeId
             notEqual
-            RH
+            RH (Obsolète),RH
         
     
     
@@ -52,7 +53,7 @@
         
             RecordTypeId
             notEqual
-            RH,PARTICULIER
+            RH (Obsolète),RH,PARTICULIER
         
     
     
@@ -71,7 +72,7 @@
         
             RecordTypeId
             equals
-            RH
+            RH (Obsolète),RH
         
     
     
@@ -89,7 +90,25 @@
         
             RecordTypeId
             notEqual
-            RH
+            RH (Obsolète),RH
+        
+    
+    
+        DWIN2_Account_Client_ReadCommunityEmployee
+        Read
+        
+            None
+            Read
+            None
+        
+        
+        
+            DWIN2_PartnerCommunity_ROAD
+        
+        
+            RecordTypeId
+            notEqual
+            RH (Obsolète),RH
         
     
     
@@ -109,7 +128,7 @@
         
             RecordTypeId
             notEqual
-            RH
+            RH (Obsolète),RH
         
     
     
alex@ubuntu:~/Documents/dentmaster$ git diff HEAD..b96acca834a80540c108d9d2f19b9cc2de84380d --stat
 force-app/main/default/sharingRules/Account.sharingRules-meta.xml | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

All 13 comments

Hi @alex9138 thanks for raising this issue !

Could you send the full content of the Account.sharingRules file ?
It seems there are changes not in the xml right ?

Seb

@scolladon that's the xml interpretation on the post ;)

<?xml version="1.0" encoding="utf-8"?><SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
    <sharingCriteriaRules>
        <fullName>DWIN2_AccountRH_Edit</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>Read</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>Read</opportunityAccessLevel>
        </accountSettings>
        <label>DWIN2_AccountRH_Edit</label>
        <sharedTo>
            <roleAndSubordinatesInternal>DWIN2_RH_Rsp</roleAndSubordinatesInternal>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>equals</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_ADV_Edit</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>Read</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>Read</opportunityAccessLevel>
        </accountSettings>
        <description>ADV and SC can edit all customer account</description>
        <label>DWIN2_Account_ADV_Edit</label>
        <sharedTo>
            <group>DWIN2_ADV</group>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_Client_Read</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>Read</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>Read</opportunityAccessLevel>
        </accountSettings>
        <description>Tous les comptes clients sont visible par la branche commerciale</description>
        <label>DWIN2_Account_Client_Read</label>
        <sharedTo>
            <roleAndSubordinatesInternal>DWIN2_Direction</roleAndSubordinatesInternal>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH,PARTICULIER</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_RH_Read</fullName>
        <accessLevel>Read</accessLevel>
        <accountSettings>
            <caseAccessLevel>None</caseAccessLevel>
            <contactAccessLevel>Read</contactAccessLevel>
            <opportunityAccessLevel>None</opportunityAccessLevel>
        </accountSettings>
        <description>Can view collaborator</description>
        <label>DWIN2_Account_RH_Read</label>
        <sharedTo>
            <role>DWIN2_Direction</role>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>equals</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_SC_Edit</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>None</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>None</opportunityAccessLevel>
        </accountSettings>
        <label>DWIN2_Account_SC_Edit</label>
        <sharedTo>
            <group>DWIN2_ServiceClientGroup</group>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_SR_Account_Contact_Create</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>None</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>None</opportunityAccessLevel>
        </accountSettings>
        <description>Can create contact commercial</description>
        <label>DWIN2_SR_Account_Contact_Create</label>
        <sharedTo>
            <group>DWIN2_PartnerCommunity_ROAD</group>
        </sharedTo>
        <booleanFilter>1</booleanFilter>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_SR_Account_PersonAccount_Create</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>None</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>None</opportunityAccessLevel>
        </accountSettings>
        <description>Partner user can create person account</description>
        <label>DWIN2_SR_Account_PersonAccount_Create</label>
        <sharedTo>
            <group>DWIN2_PartnerCommunity_ROAD</group>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>equals</operation>
            <value>PARTICULIER</value>
        </criteriaItems>
    </sharingCriteriaRules>
</SharingRules>

Could you share also the diff without xml formatting ?

Was not able to find a way to kick markdown interpreter... anything to
share? ^^

Le ven. 12 juin 2020 à 16:01, Sebastien notifications@github.com a écrit :

Could you share also the diff without xml formatting ?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/scolladon/sfdx-git-delta/issues/29#issuecomment-643286090,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADJBRJKERB4ETQZ4I6LXMHTRWIYK3ANCNFSM4N4KWBFA
.

Even if you use code block ?

Alright:

@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
+<?xml version="1.0" encoding="UTF-8"?>
+<SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
     <sharingCriteriaRules>
         <fullName>DWIN2_AccountRH_Edit</fullName>
         <accessLevel>Edit</accessLevel>
@@ -14,7 +15,7 @@
         <criteriaItems>
             <field>RecordTypeId</field>
             <operation>equals</operation>
-            <value>RH</value>
+            <value>RH (Obsolète),RH</value>
         </criteriaItems>
     </sharingCriteriaRules>
     <sharingCriteriaRules>
@@ -33,7 +34,7 @@
         <criteriaItems>
             <field>RecordTypeId</field>
             <operation>notEqual</operation>
-            <value>RH</value>
+            <value>RH (Obsolète),RH</value>
         </criteriaItems>
     </sharingCriteriaRules>
     <sharingCriteriaRules>
@@ -52,7 +53,7 @@
         <criteriaItems>
             <field>RecordTypeId</field>
             <operation>notEqual</operation>
-            <value>RH,PARTICULIER</value>
+            <value>RH (Obsolète),RH,PARTICULIER</value>
         </criteriaItems>
     </sharingCriteriaRules>
     <sharingCriteriaRules>
@@ -71,7 +72,7 @@
         <criteriaItems>
             <field>RecordTypeId</field>
             <operation>equals</operation>
-            <value>RH</value>
+            <value>RH (Obsolète),RH</value>
         </criteriaItems>
     </sharingCriteriaRules>
     <sharingCriteriaRules>
@@ -89,7 +90,25 @@
         <criteriaItems>
             <field>RecordTypeId</field>
             <operation>notEqual</operation>
-            <value>RH</value>
+            <value>RH (Obsolète),RH</value>
+        </criteriaItems>
+    </sharingCriteriaRules>
+    <sharingCriteriaRules>
+        <fullName>DWIN2_Account_Client_ReadCommunityEmployee</fullName>
+        <accessLevel>Read</accessLevel>
+        <accountSettings>
+            <caseAccessLevel>None</caseAccessLevel>
+            <contactAccessLevel>Read</contactAccessLevel>
+            <opportunityAccessLevel>None</opportunityAccessLevel>
+        </accountSettings>
+        <label>DWIN2_Account_Client_ReadCommunityEmployee</label>
+        <sharedTo>
+            <group>DWIN2_PartnerCommunity_ROAD</group>
+        </sharedTo>
+        <criteriaItems>
+            <field>RecordTypeId</field>
+            <operation>notEqual</operation>
+            <value>RH (Obsolète),RH</value>
         </criteriaItems>
     </sharingCriteriaRules>
     <sharingCriteriaRules>
@@ -109,7 +128,7 @@
         <criteriaItems>
             <field>RecordTypeId</field>
             <operation>notEqual</operation>
-            <value>RH</value>
+            <value>RH (Obsolète),RH</value>
         </criteriaItems>
     </sharingCriteriaRules>
     <sharingCriteriaRules>

@scolladon I've also updated the full file as it was interpreted so there was missing lines at the top

Thanks @alex9138 I am able to reproduce locally

@alex9138 could you beta test the #30 branch please ?
It works locally for me and the PR is submitted but I would like your test result also :)

Hello @scolladon that's a big pull request! I'm trying to review it by the way..

On my side I have no package.xml in package/ directory (and no package directory at all) so it can be a problem for those who are using manifest to deploy.

But force-app/.... contains the AccountSharing...xml so that's part is okay for me.

Below my full trace :

alex@ubuntu:~/Documents/sgd$ git clean -xdf .
Removing node_modules/
alex@ubuntu:~/Documents/sgd$ git branch
  feature/experience-bundle
* fix/inFile-delta-generation
  master
alex@ubuntu:~/Documents/sgd$ git reset --hard origin/fix/inFile-delta-generation
HEAD is now at 93aa864 Huge commit to fix inFile and asynchronize code
alex@ubuntu:~/Documents/sgd$ npm install

> [email protected] install /home/alex/Documents/sgd/node_modules/husky
> node husky install

husky > Setting up git hooks
husky > Done

> [email protected] postinstall /home/alex/Documents/sgd/node_modules/core-js
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> [email protected] postinstall /home/alex/Documents/sgd/node_modules/fast-xml-parser
> node tasks/postinstall.js || exit 0

Love fast-xml-parser? Check https://amitkumargupta.work for more projects and contribution.


> [email protected] postinstall /home/alex/Documents/sgd/node_modules/husky
> opencollective-postinstall || true

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 920 packages from 494 contributors and audited 921 packages in 18.074s

15 packages are looking for funding
  run `npm fund` for details

found 6 vulnerabilities (4 low, 2 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details


   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │      New patch version of npm available! 6.14.4 → 6.14.5       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.14.5   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

alex@ubuntu:~/Documents/sgd$ cd ../dentmaster/
alex@ubuntu:~/Documents/dentmaster$ git clean -xdf .
Removing output/
alex@ubuntu:~/Documents/dentmaster$ git reset --hard HEAD
HEAD is now at f5446dc0 Merged PR 81: #129 remove old record type RH
alex@ubuntu:~/Documents/dentmaster$ mkdir output
alex@ubuntu:~/Documents/dentmaster$ ../sgd/bin/cli -d -t HEAD -f b96acca834a80540c108d9d2f19b9cc2de84380d -r . -o output
bash: ../sgd/bin/cli: Permission denied                     
alex@ubuntu:~/Documents/dentmaster$ chmod +x ../sgd/bin/cli 
alex@ubuntu:~/Documents/dentmaster$ ../sgd/bin/cli -d -t HEAD -f b96acca834a80540c108d9d2f19b9cc2de84380d -r . -o output
check output
alex@ubuntu:~/Documents/dentmaster$ ls -la  output/
total 16
drwxrwxr-x  4 alex alex 4096 juin  17 10:30 .
drwxrwxr-x 10 alex alex 4096 juin  17 10:30 ..
drwxrwxr-x  2 alex alex 4096 juin  17 10:30 destructiveChanges
drwxrwxr-x  3 alex alex 4096 juin  17 10:30 force-app
alex@ubuntu:~/Documents/dentmaster$ ls -la  output/force-app/main/default/
total 12
drwxrwxr-x 3 alex alex 4096 juin  17 10:30 .
drwxrwxr-x 3 alex alex 4096 juin  17 10:30 ..
drwxrwxr-x 2 alex alex 4096 juin  17 10:30 sharingRules
alex@ubuntu:~/Documents/dentmaster$ ls -la  output/force-app/main/default/sharingRules/
total 16
drwxrwxr-x 2 alex alex 4096 juin  17 10:30 .
drwxrwxr-x 3 alex alex 4096 juin  17 10:30 ..
-rw-rw-r-- 1 alex alex 4581 juin  17 10:30 Account.sharingRules-meta.xml
alex@ubuntu:~/Documents/dentmaster$ cat  output/force-app/main/default/sharingRules/Account.sharingRules-meta.xml 
<?xml version="1.0" encoding="utf-8"?>
<SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
    <sharingCriteriaRules>
        <fullName>DWIN2_AccountRH_Edit</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>Read</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>Read</opportunityAccessLevel>
        </accountSettings>
        <label>DWIN2_AccountRH_Edit</label>
        <sharedTo>
            <roleAndSubordinatesInternal>DWIN2_RH_Rsp</roleAndSubordinatesInternal>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>equals</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_ADV_Edit</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>Read</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>Read</opportunityAccessLevel>
        </accountSettings>
        <description>ADV and SC can edit all customer account</description>
        <label>DWIN2_Account_ADV_Edit</label>
        <sharedTo>
            <group>DWIN2_ADV</group>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_Client_Read</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>Read</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>Read</opportunityAccessLevel>
        </accountSettings>
        <description>Tous les comptes clients sont visible par la branche commerciale</description>
        <label>DWIN2_Account_Client_Read</label>
        <sharedTo>
            <roleAndSubordinatesInternal>DWIN2_Direction</roleAndSubordinatesInternal>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH,PARTICULIER</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_RH_Read</fullName>
        <accessLevel>Read</accessLevel>
        <accountSettings>
            <caseAccessLevel>None</caseAccessLevel>
            <contactAccessLevel>Read</contactAccessLevel>
            <opportunityAccessLevel>None</opportunityAccessLevel>
        </accountSettings>
        <description>Can view collaborator</description>
        <label>DWIN2_Account_RH_Read</label>
        <sharedTo>
            <role>DWIN2_Direction</role>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>equals</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_Account_SC_Edit</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>None</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>None</opportunityAccessLevel>
        </accountSettings>
        <label>DWIN2_Account_SC_Edit</label>
        <sharedTo>
            <group>DWIN2_ServiceClientGroup</group>
        </sharedTo>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
    <sharingCriteriaRules>
        <fullName>DWIN2_SR_Account_Contact_Create</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>None</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>None</opportunityAccessLevel>
        </accountSettings>
        <description>Can create contact commercial</description>
        <label>DWIN2_SR_Account_Contact_Create</label>
        <sharedTo>
            <group>DWIN2_PartnerCommunity_ROAD</group>
        </sharedTo>
        <booleanFilter>1</booleanFilter>
        <criteriaItems>
            <field>RecordTypeId</field>
            <operation>notEqual</operation>
            <value>RH</value>
        </criteriaItems>
    </sharingCriteriaRules>
</SharingRules>
alex@ubuntu:~/Documents/dentmaster$ cat output/destructiveChanges/package.xml 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>48.0</version>
</Package>

Good catch @alex9138 !
It seems to be a linter artefact.
Last commit should fix that.
Could you retest it and tell the result please ?

@scolladon alright here !

alex@ubuntu:~/Documents/dentmaster$ ls -la output/
total 20
drwxrwxr-x  5 alex alex 4096 juin  17 11:28 .
drwxrwxr-x 10 alex alex 4096 juin  17 11:28 ..
drwxrwxr-x  2 alex alex 4096 juin  17 11:28 destructiveChanges
drwxrwxr-x  3 alex alex 4096 juin  17 11:28 force-app
drwxrwxr-x  2 alex alex 4096 juin  17 11:28 package
alex@ubuntu:~/Documents/dentmaster$ ls -la output/package/
total 12
drwxrwxr-x 2 alex alex 4096 juin  17 11:28 .
drwxrwxr-x 5 alex alex 4096 juin  17 11:28 ..
-rw-rw-r-- 1 alex alex  557 juin  17 11:28 package.xml
alex@ubuntu:~/Documents/dentmaster$ cat output/package/package.xml 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account.DWIN2_AccountRH_Edit</members>
        <members>Account.DWIN2_Account_ADV_Edit</members>
        <members>Account.DWIN2_Account_Client_Read</members>
        <members>Account.DWIN2_Account_RH_Read</members>
        <members>Account.DWIN2_Account_SC_Edit</members>
        <members>Account.DWIN2_SR_Account_Contact_Create</members>
        <name>SharingCriteriaRule</name>
    </types>
    <version>48.0</version>
</Package>

Fix with new version 3.1.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arafesthain picture arafesthain  Â·  9Comments

struthe picture struthe  Â·  3Comments

afzal-tag picture afzal-tag  Â·  4Comments

alexmodis picture alexmodis  Â·  8Comments

Dhanielk picture Dhanielk  Â·  6Comments