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

Workspaceops rework read folder #7107

Merged
merged 26 commits into from
May 22, 2024
Merged

Conversation

touilleMan
Copy link
Member

@touilleMan touilleMan commented Apr 19, 2024

  • API change
  • Fuse changes
  • WinFSP changes

Closes #5820
Closes #6491
Closes #6914

@touilleMan touilleMan requested review from a team as code owners April 19, 2024 10:00
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch 4 times, most recently from 417d805 to c796879 Compare April 19, 2024 10:50
@touilleMan touilleMan requested a review from a team as a code owner April 19, 2024 10:50
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch 2 times, most recently from 3baf1dc to d02717a Compare April 19, 2024 13:11
@touilleMan touilleMan marked this pull request as draft April 21, 2024 18:52
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch 2 times, most recently from c614c82 to d02717a Compare April 23, 2024 12:32
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch from d02717a to 2499622 Compare May 17, 2024 17:15
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch from 2499622 to d02717a Compare May 18, 2024 10:37
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch from 410d1e0 to 4fb51fe Compare May 20, 2024 21:38
@touilleMan touilleMan marked this pull request as ready for review May 20, 2024 21:38
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch from 4fb51fe to ac26c38 Compare May 20, 2024 21:57
@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch 3 times, most recently from be48743 to 2578c32 Compare May 21, 2024 01:04
// 4) Merge data and ensure the sync is still needed

// Destruct local and remote manifests to ensure this code with fail to compile
// whenever a new field is introduced.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite get why you would want that ? Is it to have a real human person check that the new field does not interact with the merging process, or to adapt the merging process ?

Maybe annotating LocalFileManifest with non_exhaustive could do the trick

Copy link
Member Author

Choose a reason for hiding this comment

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

Consider the following:

struct Data {
  updated: DateTime,
}

fn merge(local: Data, remote: Data) -> Data {
   remote.updated = max(local.updated, remote.updated);
   remote
}

Then we introduce a new created field

struct Data {
  created: DateTime,
  updated: DateTime,
}

The code will compile fine event if we haven't updated merge (typically we should have added a line like remote.created = min(local.created, remote.created)).

This is an issue given this merge function is easy to forget to update:

  • it is in a different file
  • its tests will most likely just ignore the new field

On the other hand, if the merge function is implemented with exhaustive de-structuring, it will fail to compile any time a new field is added. Hence forcing the developer to have a look at this part of the code.

This is a pattern we also use in the CRC code of the testbed. Nobody knows about this piece of code and nobody cares... but if a structure changes and the CRC starts being wrong, we will have very hard time understanding why the tests start becoming randomly wrong (as client and testbed server code may end up with different data with the same CRC...)

Regarding non_exhaustive, its point is to forbid exhausting destructuring, which is the opposite of what we want here ;-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, so we could put that behind a debug_assert to make sure that it won't be present during runtime ?

@touilleMan touilleMan force-pushed the workspaceops-rework-read-folder branch from e77090b to e96906a Compare May 21, 2024 15:41
@touilleMan touilleMan added this pull request to the merge queue May 22, 2024
Merged via the queue into master with commit 8dc048e May 22, 2024
16 checks passed
@touilleMan touilleMan deleted the workspaceops-rework-read-folder branch May 22, 2024 13:04
@touilleMan touilleMan linked an issue May 22, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants