Skip to content

fix(dloc): write a data location model on load only when it changed - #207

Merged
ehennestad merged 2 commits into
devfrom
stop-rewriting-data-location-model-on-load
Nov 8, 2026
Merged

ehennestad merged 2 commits into
devfrom
stop-rewriting-data-location-model-on-load

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

Why

DataLocationModel writes its file whenever it is constructed. updateMetadataExtractorFunctionNames ends in an unconditional save, and tempDevFix saves again when a stored root path list is empty, because an empty list never gains the DiskType field. The model is constructed on every project load, so a file meant to be kept under version control changes without any edit.

What changes

StorableCatalog gets a protected saveIfChanged, 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. The DataLocationModel constructor calls it once, after loading and the two update steps. The save in updateMetadataExtractorFunctionNames and the dirty tracking in tempDevFix are removed.

The saves are replaced rather than deleted because they also store what loading generates. addUuidIfMissing creates uuids and updateRootPathDataType creates 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 IsDirty and DataBackup from DataLocationModel. IsDirty is Dependent with no get method, so reading it raises MATLAB:class:noGetMethod, and DataBackup is never assigned.

Notes for review

A difference in field order alone does not trigger a write, because isequaln ignores it. tempDevFix reorders fields in memory on each load, so the order in the running model is the same either way.

🤖 Generated with Claude Code

ehennestad and others added 2 commits November 8, 2026 20:06
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>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Test Results

670 tests  +4   670 ✅ +4   1m 34s ⏱️ +33s
 54 suites +1     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 4e84326. ± Comparison against base commit c33735d.

@ehennestad
ehennestad merged commit f206931 into dev Nov 8, 2026
5 checks passed
@ehennestad
ehennestad deleted the stop-rewriting-data-location-model-on-load branch November 8, 2026 19:43
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.

1 participant