chore(saves): remove conflict_mode and clock_skew_tolerance_sec#265
Merged
danielcopper merged 5 commits intomainfrom May 6, 2026
Merged
chore(saves): remove conflict_mode and clock_skew_tolerance_sec#265danielcopper merged 5 commits intomainfrom
danielcopper merged 5 commits intomainfrom
Conversation
The 0.16 newest-wins matrix sync rewrite removed the only meaningful consumer of conflict_mode (resolve_conflict_by_mode in domain/save_conflicts, deleted in #264). The remaining frontend gate kept the launch-time conflict check optional; that check should always run, so drop the setting end-to-end and let the interceptor block launches whenever a save conflict is pending.
The only consumer (resolve_conflict_by_mode in domain/save_conflicts) was deleted with the 0.16 newest-wins matrix sync rewrite (#264). Drop the setting from the dataclass, defaults, sanitiser, and frontend type.
load_state merges persisted settings via dict.update, so old state files keep removed keys (conflict_mode, clock_skew_tolerance_sec) forever. Pop them in _migrate_loaded_state so the next save_state writes a clean file.
- Drop the throwaway empty-dict fallback from the legacy settings strip in `_migrate_loaded_state`; missing/non-dict settings now cleanly fall through the `isinstance` guard. - Pin the defensive guard with two tests: missing `settings` key and non-dict `settings` value.
Extract the saves-block migration and the legacy-settings strip into private helpers (_migrate_saves_entries, _strip_legacy_settings). _migrate_loaded_state becomes a thin dispatcher. Cognitive complexity 22 -> below threshold (Sonar python:S3776).
|
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.



Summary
PR 2 of 2 for #258 (post-0.16 save sync polish). Removes the two legacy settings end-to-end:
conflict_modeandclock_skew_tolerance_sec. Both were leftovers from before the 0.16 newest-wins matrix sync rewrite; the wiki had already pre-announced their removal inSave-Sync.md, and the actualdomain/save_conflicts.resolve_conflict_by_modeconsumer was deleted in PR1 (#264).conflict_mode— removed from model, persistence, sanitize/allowlist, TS type, Settings UI dropdown, andlaunchInterceptor.ts. Behaviour change: the launch interceptor now always checks for conflicts and blocks launch when one is detected (previously only in"ask_me"mode). Users who had it set tonewest_wins/always_upload/always_downloadwill now see the conflict modal — but those modes never actually did anything in the matrix sync model post-0.16, so this catches the implementation up to the documented behaviour.clock_skew_tolerance_sec— removed from model, persistence, TS type. Pure cleanup: zero consumers after PR1._migrate_loaded_statenow silently strips both legacy keys from loaded state.load_statedoesdict.updateon the settings block, so orphan keys would otherwise survive forever. After the first load+save post-merge, on-disk state files are clean. Tests pin the strip behaviour and the defensiveisinstance(settings, dict)guard (covers missing-key and non-dict edge cases).Save-Sync.md"When saves conflict" section + screenshot caption updated;Save-File-Sync-Architecture.md"Legacy field migration" extended to document the new strips, "Settings fields not driving behaviour" paragraph removed.Closes #258.
Test plan
conflict_modesettingconflict_mode/clock_skew_tolerance_sec, trigger a save, confirm both keys are gone from the on-disk JSON