-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFDX Push error when metadata is moved #2035
Comments
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support. |
We need this as well! Working with multiple package directories is a pain because of this, especially declarative changes that are made in the scratch org and then needs to be pulled down. And worse, when these changes are merged to main, everyone else pulling from main into their local branches might get the same push errors (if moving existing files). Perhaps there could be a way of distinguishing moving (renames only including path and not filename) and no other changes with other types of changes? |
I think we have a path toward handling local file renames/moves, and that's the scope of this gh issue. "I renamed it in the org" is a much harder problem. |
Yeah, poorly written by me. I originally added some other thoughts about creating e.g. new custom fields, pulling them down, and sorting them into different package directories. Then this push error could occur as well. But forgot to remove everything. Fully agree with you on the scope of the issue. If this were to be solved it would resolve some headaches for us as well |
You also have a lot of problems with this as we try to organize metadata based on functionality in different folders (under the same project). This leads to a lot of unnecessary headaches for our developers. |
I was just going to submit this issue. |
Any updates on this @mshanemc? We have a pretty manual workaround for this currently, by updating the forceignore file every time we need to move files between directories. |
This is definitely something that needs sorting |
I'm closing this in favor of a higher-level discussion about how we want this to work. That's here. @jonny-harte @petter-eikeland @mwannamaker41 @chfosli @rhobkirkcertinia |
Summary
SFDX Push fails when metadata is moved locally despite no content within the file changing.
We often want to move metadata around within the repo (typically Apex classes) in order to decompose the "default/classes" directory and make the repository more understandable.
The issue is that when the file is moved, the SFDX CLI mistakenly attempts to delete the file from the org, presumably due to identifying it as a new file instead. This typically causes compilation failures since the class is in use in the org and cannot be deleted.
This occurs when moving files within the same package directory.
It would be useful if the CLI could also support moving files between package directories - although I'm happy if this needs to be bumped due to the extra complexity.
Steps To Reproduce:
Repository to reproduce: ebikes-lwc
ebikes/classes
in force-app, I.e.force-app/main/ebikes/classes/
force-app/main/default/classes/OrderController.cls
+OrderController.cls-meta.xml
intoforce-app/main/ebikes/classes/
Expected result
The SFDX CLI should not attempt to delete files that have no changes besides being moved.
For moved files:
There are likely more scenarios around this, but hopefully this covers the major ones.
Actual result
SFDX CLI errors on the push.
System Information
Additional Information
It's worth being aware that when a very simple project is used with no LWC referencing the class, I have seen the SFDX CLI successfully push the deletion of the moved class.
This is obviously incorrect, as the moved class still exists locally, but not in the org.
@W-7673793@
The text was updated successfully, but these errors were encountered: