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

Correct validateStorageError in file_cache #449

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

foodprocessor
Copy link
Contributor

@foodprocessor foodprocessor commented Feb 13, 2025

What type of Pull Request is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Describe your changes in brief

validateStorageError() is meant to identify whether an ENOENT error returned by a cloud call is due to the file being in cache but not in cloud (case 2), and to clear the error in that case.
validateStorageError() was incorrectly clearing cloud ENOENT errors whenever createEmptyFile was true (without checking whether the local file exists).
To correct this, we could either not check the createEmptyFile flag at all, or we should require it be false before clearing cloud ENOENT errors. I chose the second option.

I also set recoverable to true in a RenameFile() call to validateStorageError() where it was mistakenly left set to false (after changing RenameFile() to support renaming open files).

Checklist

  • Tested locally
  • Added new dependencies
  • Updated documentation
  • Added tests

Related Issues

  • Related Issue #
  • Closes #

Copy link
Contributor

@jfantinhardesty jfantinhardesty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a unit test you could add to check for this?

@foodprocessor
Copy link
Contributor Author

foodprocessor commented Feb 14, 2025

Is there a unit test you could add to check for this?

UPDATE: I decided to add unit tests, and they revealed further bugs! Thanks for the suggestion!

Original response:
I feel like this bug is so obscure (since, for no discernible reason, it was only exposed when createEmptyFile is true), that creating a test for it would seem overly specific. Almost like checking that renaming a file still works as expected when it's 3pm.

We could, however, add tests to verify that ENOENT is returned properly by various functions when no object or file exists.

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

Successfully merging this pull request may close these issues.

2 participants