scolladon / sfdx-git-delta

Generate the sfdx content in source format from two git commits
Other
445 stars 114 forks source link

Git Delta Issue - Admin Profile Changes Not Being Generated in Salesforce #946

Closed adityasfdev closed 1 week ago

adityasfdev commented 2 weeks ago

We are facing an issue where our Git delta deployment process for Salesforce is not generating changes related to the Admin Profile. This issue has led to discrepancies between our environments during deployments. The expected behavior is that any modifications to the Admin Profile (such as changes to field-level security, object permissions, etc.) should be picked up and included in the delta package created by git delta plugin. However, this is not occurring.

Here are the specifics of the issue:

[ ] The delta generation process has consistently worked for other profiles and metadata types but seems to ignore or fail to capture changes made specifically to the Admin Profile. [ ] This issue surfaced without any recent changes to our delta generation logic or configuration

Troubleshooting Steps Taken:

scolladon commented 2 weeks ago

Hi @adityasfdev!

Thanks for raising this issue and thanks for contributing in making this project better!

Could you help me reproduce the issue locally ? You can either describe what commit content I should create inside a repository, or you could also fork the reproduction playground, create a branch, write the necessary commit to reproduce and share that branch here. And give me the commands to run with sgd to reproduce the issue.

adityasfdev commented 2 weeks ago

Reproduction Steps for Git Delta Issue with Admin Profile Changes:

Create or add the Admin Profile to your repository. Make some changes to the Admin Profile (e.g., adjust field-level security, object permissions, etc.). Commit these changes to your repository. Use the Git delta command to generate changes between the HEAD of the branch and the newly committed commit ID. Verify the changes captured in the delta folder.

Expected Behavior: The modified Admin Profile metadata should be included as part of the delta changes in the delta folder.

Actual Behavior: Surprisingly, all other profile changes are being captured correctly, but changes to the Admin Profile are not being included in the delta output.

scolladon commented 2 weeks ago

I have created a branch on the playground where I have added the Admin profile and made a change to it.

I ran sgd on both those commits and the output was ok (both in the package.xml and in the incremental folder)

Does the Admin profile in your repository is deployable ? I'm wondering if its xml content is correct ? Maybe there is an issue coming from a merge conflict resolution or a manual changes done directly in the file.

adityasfdev commented 2 weeks ago

Hi it seems you tried with the source format type but in our pipeline we are using the metadata format type where the extension for profile ends ".profile". So, i was wondering does this differ in the way the git delta generate the changed files. Also, there is no conflict issue and our developers can't able to directly add their changes into the build branch because we are using branch protection rules so there is no manual changes as well.

scolladon commented 2 weeks ago

I tried using the metadata format and pushed inside the branch and it works on my machine.

Could you share the content of the Admin profile ?

adityasfdev commented 2 weeks ago

We can't share our content of the code due to our security policy and what you are saying is the git delta is getting the files in delta process even for admin profile without any issue in the metadata format right? and if that's the case let me replace the admin code with newly retrieved one from our sandbox and try generating the git delta hopefully it generate if not will get back to you.

scolladon commented 2 weeks ago

Yes, exactly, sgd works with source format and metadata format (even if it is designed for source format and is not tested with metadata format).

adityasfdev commented 2 weeks ago

Hi, so i have retrieved the admin profile from our sandbox and trying to deploy it not doing manual changes a new profile directly retrieved from salesforce added into our pipeline and while running the git delta having this warning message -> ""src/profiles/Admin.profile: Cannot read properties of undefined (reading 'addChild')", can you help me understand of this error message.

scolladon commented 2 weeks ago

Hi, so i have retrieved the admin profile from our sandbox and trying to deploy it not doing manual changes a new profile directly retrieved from salesforce added into our pipeline and while running the git delta having this warning message -> ""src/profiles/Admin.profile: Cannot read properties of undefined (reading 'addChild')", can you help me understand of this error message.

I'm afraid I will not be able to move forward easily without reproducing the issue on my local machine and debug what is happening.

Could you isolate the issue and give me the minimal content of the profile reproducing the issue ?

adityasfdev commented 1 week ago

Hi, thanks for your help we resolved this issue on our own it seems like our some of the profile metadata code is in invalid format

scolladon commented 1 week ago

Thanks for your message

Happy incremental deployment