Skip to content
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

"Detect Conflict At Sync" doesn't work (still) #4585

Closed
ralphcallaway opened this issue Dec 12, 2022 · 10 comments
Closed

"Detect Conflict At Sync" doesn't work (still) #4585

ralphcallaway opened this issue Dec 12, 2022 · 10 comments
Assignees

Comments

@ralphcallaway
Copy link

ralphcallaway commented Dec 12, 2022

Summary

Conflict detection is firing on every save. I've made a video showing an example of the issue. https://www.youtube.com/watch?v=NMbWeDj2BLQ

Let me know if I can help at all in documenting test steps.

Steps To Reproduce:

  1. Open SomeClass.cls
  2. Run the "SFDX: Retrieve this Source from Org" command
  3. Make a change to SomeClass.cls and save
  4. Make a second change and save

Expected result

Both saves should go through since the version of the class prior to the change is up to date.

Actual result

The first change after doing a retrieve goes through without throwing a conflict error. The second change throws a conflict error.

Additional information

VS Code Version: 1.74.0

Salesforce Extension Version in VS Code: Salesforce Extension Pack v56.5.1

SFDX CLI Version: sfdx-cli/7.178.0 darwin-x64 node-v18.12.0

OS and version: OS X 12.6.1

Problem Outline

The cache is storing the last modified date for a component at the start of the save instead of using the final remote last modified date of the component from the server. This leads to the local timestamp to always be earlier than the remote and subsequent saves always appear to have a conflict.

For example, imagine the following sequence of events

  1. VS Code: User Saves File
  2. VS Code: stores last modified date of file (e.g. 1:00:23) (or saves the file if using the file system last modified date)
  3. VS Code: makes a deploy (or other) call to sfdc server
  4. Salesforce: processes and saves the file
  5. Salesforce: updates last modified date of file (e.g. 1:00:24)

Because their are two timestamps stored marked at different points in the transaction they are almost always slightly out of sync preventing conflict detection from working effectively.

Solution

After any push/deploy operation assuming either no conflict detection or user chose to proceed after conflict, update the cache of the remote last modified date upon completion of the transaction after the sfdx call has completed. This should happen regardless of whether the operation succeeded.

After any successful retrieve/pull operation, update the cache/store of the remote last modified date of the component after the sfdx call has completed.

History

This bug has been logged and closed repeatedly, let's get it fixed this time

Other Related Stuff

@ralphcallaway
Copy link
Author

@AnanyaJha do make sure the engineering folks watch this video to fully understand how this issue is occuring and how to properly test a fix. I'm happy to test beta versions of fixes, this has a huge impact on our teams due to the ease of overwriting someone elses work. Something that has been ingrained with all prior IDEs (mavens mate, force.com ide) to work and now doesn't. I've advised folks to turn it off and to always refresh before making changes because the conflict detection is not correct

https://www.youtube.com/watch?v=NMbWeDj2BLQ

@ralphcallaway
Copy link
Author

@AnanyaJha and please can we not close this until it's been verified by someone outside the engineering team to have been fixed?

@ralphcallaway ralphcallaway changed the title "Detect Conflict At Sync" doesn't work "Detect Conflict At Sync" doesn't work (still) Dec 12, 2022
@PawelWozniak
Copy link
Contributor

I can do a beta test too if needed. I am getting the same issue over and over. Finally turned off conflict detection as it is useless in its current shape.

@AnanyaJha
Copy link
Collaborator

Hi @jefersonchaves thanks so much for opening up a new issue with more details. I'll flag this for our team to review and will definitely reach out for help with Beta testing @PawelWozniak - thank you!

@git2gus
Copy link

git2gus bot commented Jan 4, 2023

This issue has been linked to a new work item: W-12302680

@klewis-sfdc
Copy link
Contributor

Hi @ralphcallaway and @PawelWozniak,
Thanks for continuing to bring attention to this issue. I've posted a draft PR to fix it. I will work on getting some tests in place soon to complete this PR. In the mean time, if either of you would be willing to pull down this branch and do some testing to see if it fixes the issue for you, that would be super helpful.

You can build the extensions using these instructions, and provide any feedback you find. Thank you so much and let me know if you have any questions as you build/test.

@AnanyaJha AnanyaJha added the status:in review pr/issue is being reviewed label Jan 6, 2023
@PawelWozniak
Copy link
Contributor

@klewis-sfdc Is there any possibility to precompile it and release as alpha/beta?
I remember about this topic but don't have additional time to go through compile.

@klewis-sfdc
Copy link
Contributor

Hi @PawelWozniak,

You could download the compiled/built .vsix files from the bottom of the page here and then install them directly in VS Code using "Install from VSIX". I made a quick video to show how I was able to do it. Let me know if this process works for you. And thanks for helping us test this fix.

2023-01-19_14-27-52 (2)

@RanGroen
Copy link

I tried this build and it has solved the issue for me. Much appreciated @klewis-sfdc, hope you can get this live soon!

@klewis-sfdc
Copy link
Contributor

That's great. Thank you very much @RanGroen for testing the build. We'll get this fix into a release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants