Repository navigation
fix(prefs): skip saved preferences the class does not declare - #172
Merged
Merged
Conversation
nansen.config.abstract.Preferences/fromStruct assigned every field of the saved struct onto the object. A preference file written by another version of NANSEN, with a renamed or removed preference, therefore made the constructor error, and NansenUserSession constructs the preferences at startup, so every entry point failed with "Unrecognized property". The loader now assigns only the saved names the class declares. The test writes a preference file with an unknown field for a throwaway profile and starts a session for it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ehennestad
added a commit
that referenced
this pull request
Nov 6, 2026
Conflicts: - .github/badges/tests.svg: dev's version. - Preferences.m: dev's fromStruct (#172). It skips saved preferences the class does not declare, as this branch's version did. NansenUserSession.m merges without a conflict, but the merge puts getUserDataDirectory and getDefaultUserDataDirectory after #127's confirmNewUserProfile, inside its methods (Static, Access = private) block. They are moved back to the public static block, because nansen.userdatadir, clear_tutorial_data, ProjectFixture and UserDataDirectoryTest call them from outside the class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
nansen.config.abstract.Preferencesloads its preference file in the constructor, andfromStructassigned every field of the saved struct onto the object. The file is written bytoStruct, which saves the public properties of whichever version of the subclass is running. A file written by a version with a renamed or removed preference therefore holds a field the running class does not declare, and the assignment errors with "Unrecognized property".NansenUserSessionconstructsnansen.internal.user.Preferencesat startup, so every entry point to NANSEN fails before anything is shown.This happens today when switching between
devand the branch of #126. That branch renamesUserdataDirectorytoUserDataDirectory, and one run of it rewritesNansenUserSession_Preferences.matwith the new name. Going back todevthen fails on startup until the file is edited by hand.fromStructnow assigns only the saved names that the class declares. A skipped value is dropped by the next save, which writes the declared preferences only. #126 carries the same hardening in its own version of this method, so mergingdevinto that branch will conflict on this block. Keeping dev's version resolves it.nansen.unittest.config.PreferencesTestwrites a preference file for a throwaway profile and starts a user session for it, once with declared preferences only and once with an extra unknown field.The second commit corrects the H1 line of
getActivePreferenceGroup, which named a different method.🤖 Generated with Claude Code