-
Notifications
You must be signed in to change notification settings - Fork 224
Fix shopify theme dev --theme-editor-sync so it doesn’t delete files when a race condition happens
#6784
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
Conversation
…s when they’re updated by AI agents
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success3671 tests passing in 1430 suites. Report generated by 🧪jest coverage report action from b78c639 |
EvilGenius13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩 went well. This could also be caused by manually changing a file too many times in quick succession without AI. I can no longer replicate it either way. Thank you for the fix @karreiro!
graygilmore
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it!
Small note: this isn't caused specifically by LLMs if you want to change the title.
shopify theme dev --theme-editor-sync so it doesn’t delete files when they’re updated by AI agentsshopify theme dev --theme-editor-sync so it doesn’t delete files when a race condition happens
|
👋 Hey @Shopify/app-inner-loop, could you please take a look at this when you have a moment? |
WHY are these changes introduced?
The issue came from inconsistent state during the polling flow. The poll would filter
previousChecksums, then make an async call to fetchlatestChecksums, and filter those afterward.If a file was saved locally while the network request was happening, its key could be added to
unsyncedFileKeysmid-poll. That meantpreviousChecksumswas filtered with one view ofunsyncedFileKeys, whilelatestChecksumswas filtered with a newer view. The comparison could then incorrectly treat the file as deleted on the remote and delete the local copy.WHAT is this pull request doing?
This PR fixes the issue by adopting a snapshot of
unsyncedFileKeysat the start of the poll and reuse it for both filters, so filtering stays consistent across the async boundary.How to test your changes?
shopify theme initto clone the skeleton themeshopify theme dev --theme-editor-synctemplates/index.jsonfile with this contentPost-release steps
N/A
Measuring impact
How do we know this change was effective? Please choose one:
Checklist