Check file changes based on content instead of the last_modified metadata
JupyterLab mechanism to detect a file changes is based on last_modified parameter set in the metadata: https://github.com/jupyterlab/jupyterlab/blob/b4db7f03d2ad0b91a9c8c252c56ae5e4a9408fbb/packages/docregistry/src/context.ts#L644-L649. If the file last_modified parameter was changed without changing the content then JupyterLab shows the following message

The issue happens when sync tools are used that updates files last modified timestamp.
Using content based check mechanism (e.g. hash) will prevent showing the dialog when the last modified timestamp changed without changing a file content
I think it makes sense to have both. Check last_modified time, and if that has changed, then check content. That way you are usually doing the cheaper check.
@jasongrout - are you suggesting the hash computation be performed by the client (lab)? That would prevent adding the hash value to the model and dealing with the impact to custom content managers and all that implies. So, would it look something like this (for those that want this form of checking):
- Lab fetches content (file or notebook) and stores last-modification and computes/stores checksum
- Upon save request, Lab fetches model (sans content) and checks last-modification against original. If different and content-based check is desired) Lab fetches content and computes/compares checksum against original and acts accordingly.
How does the fetch of the model - just prior to save - work today? I'm assuming the content is not included in that case. If that's not the case (and content is returned here as well), then we'd just need to conditionally recompute the checksum.
xref https://github.com/jupyterlab/jupyterlab/issues/9769