Fix local storage caching issue#3219
Conversation
Greptile SummaryThis PR modifies a single guard condition in
Confidence Score: 1/5Not safe to merge — the change inverts the overwrite guard and will cause silent data-loss or incorrect skipping on every call to save_bytes where a file already exists. The single changed line removes the metaflow/plugins/datastores/local_storage.py — the only changed file; the one-character edit to the overwrite guard inverts its behavior completely. Important Files Changed
Reviews (1): Last reviewed commit: "Fix local storage caching issue" | Re-trigger Greptile |
| if overwrite and os.path.exists(full_path): | ||
| continue |
There was a problem hiding this comment.
The guard condition has been inverted, breaking the semantics of the
overwrite parameter entirely. With this change, when overwrite=True (caller explicitly wants to replace an existing file) the function now skips the write and does nothing. Conversely, when overwrite=False (the default, meaning "don't replace existing files") the continue is never reached and every existing file gets silently overwritten. The base-class docstring in datastore_storage.py is clear: overwrite=False must leave existing objects untouched. Removing the not reverses both cases simultaneously.
| if overwrite and os.path.exists(full_path): | |
| continue | |
| if not overwrite and os.path.exists(full_path): | |
| continue |
|
Can you show how your reprodcuded the bug and how you fixed this? |
Summary
Fixes an issue in LocalStorage where existing files could remain stale due to caching behavior when writing data to the local datastore.
Changes
Testing
Impact
This change improves reliability when using LocalStorage as a datastore backend and helps prevent stale cached data from being served.