Repository navigation
fix(dloc): write a data location model on load only when it changed - #207
Merged
Merged
Conversation
Constructing a DataLocationModel saved it unconditionally at the end of updateMetadataExtractorFunctionNames, and tempDevFix saved it again whenever a stored root path list was empty, because an empty list never gains the DiskType field. Every load rewrote a file that is meant to be kept under version control. The saves cannot simply be removed. Loading also generates missing uuids and converts older root path formats, and those values are referred to from other files, so they have to be stored once. The constructor now compares the content it would write with the file and writes only on a difference. fixDefaultDataLocation no longer has to report whether it changed anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…odel IsDirty was declared Dependent without a get method, so reading it raises MATLAB:class:noGetMethod. Nothing reads it. DataBackup, the private property it was meant to compare against, is never assigned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
DataLocationModelwrites its file whenever it is constructed.updateMetadataExtractorFunctionNamesends in an unconditional save, andtempDevFixsaves again when a stored root path list is empty, because an empty list never gains theDiskTypefield. The model is constructed on every project load, so a file meant to be kept under version control changes without any edit.What changes
StorableCataloggets a protectedsaveIfChanged, which builds the content a save would write, compares it with the file, and writes only on a difference. Json is compared after decoding, so formatting alone is not a difference. TheDataLocationModelconstructor calls it once, after loading and the two update steps. The save inupdateMetadataExtractorFunctionNamesand the dirty tracking intempDevFixare removed.The saves are replaced rather than deleted because they also store what loading generates.
addUuidIfMissingcreates uuids andupdateRootPathDataTypecreates root path keys, and metatables refer to both. Those values have to reach the file the first time they are generated.Other catalogs keep their existing save behaviour.
The second commit removes
IsDirtyandDataBackupfromDataLocationModel.IsDirtyis Dependent with no get method, so reading it raisesMATLAB:class:noGetMethod, andDataBackupis never assigned.Notes for review
A difference in field order alone does not trigger a write, because
isequalnignores it.tempDevFixreorders fields in memory on each load, so the order in the running model is the same either way.🤖 Generated with Claude Code