Fix build: initialize fadeIn properties in SuggestionSettingsModel.init#763
Merged
Merged
Conversation
The opacity-ramp change (FuJacob#749) added `fadeInSuggestions` and `fadeInDurationSeconds` and assigns them in `resetToDefaults`, but `init` never sets them, so the initializer is rejected ("return from initializer without initializing all stored properties") and `main` does not compile. Initialize both from `data` in `init`, mirroring `resetToDefaults`.
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
SuggestionSettingsModel.initdoesn't initializefadeInSuggestions/fadeInDurationSeconds— the two@Publishedproperties added by the opacity-ramp change (#749). They're assigned inresetToDefaultsbut not ininit, so Swift rejects the initializer ("return from initializer without initializing all stored properties") andmaincurrently fails to compile (thexcodebuild (macOS)CI check is red). This adds the two missing assignments ininit, mirroringresetToDefaults.Validation
The same fix on a feature branch also passes the full suite:
xcodebuild test … CODE_SIGNING_ALLOWED=NO→** TEST SUCCEEDED **, 1652 tests, 0 failures.Linked issues
None.
Risk / rollout notes
Two-line change, no behavior difference — these values were already assigned everywhere except
init. Restores a green build onmain.Greptile Summary
This PR restores a broken build on
mainby adding the two missing property initializations (fadeInSuggestionsandfadeInDurationSeconds) introduced by PR #749 toSuggestionSettingsModel.init. Swift's definite initialization rules require every stored property to be set before the initializer returns, so the omission caused a compile error.fadeInSuggestions = data.fadeInSuggestionsandfadeInDurationSeconds = data.fadeInDurationSecondstoinit, mirroring their existing assignments inresetToDefaults.initassignment list and theresetToDefaultsassignment list stay in sync, which is enforced by a dedicated unit test.Confidence Score: 5/5
Safe to merge — two-line addition that unblocks the build with no behavioral change.
The change adds two property assignments that were clearly supposed to be in
initall along — they exist inresetToDefaultsand are read everywhere the overlay renderer touches fade settings. The values flow from the samestore.loadcall that populates every other property, so there is no new logic to reason about and no risk of wrong defaults. Theinit/resetToDefaultsparity is tested, meaning the test suite will catch any future drift.No files require special attention.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Caller participant SuggestionSettingsModel participant SuggestionSettingsStore participant SuggestionSettingsData Caller->>SuggestionSettingsModel: init(configuration:userDefaults:) SuggestionSettingsModel->>SuggestionSettingsStore: load(configuration:) SuggestionSettingsStore-->>SuggestionSettingsModel: SuggestionSettingsData Note over SuggestionSettingsModel: Assign all @Published properties from data Note over SuggestionSettingsModel: (including fadeInSuggestions + fadeInDurationSeconds — added by this PR) SuggestionSettingsModel-->>Caller: fully initialized instance Caller->>SuggestionSettingsModel: resetToDefaults() SuggestionSettingsModel->>SuggestionSettingsStore: resetToDefaults(configuration:) SuggestionSettingsStore-->>SuggestionSettingsModel: SuggestionSettingsData (defaults) Note over SuggestionSettingsModel: Re-fans all @Published properties (mirrors init) SuggestionSettingsModel-->>Caller: settings reset%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Caller participant SuggestionSettingsModel participant SuggestionSettingsStore participant SuggestionSettingsData Caller->>SuggestionSettingsModel: init(configuration:userDefaults:) SuggestionSettingsModel->>SuggestionSettingsStore: load(configuration:) SuggestionSettingsStore-->>SuggestionSettingsModel: SuggestionSettingsData Note over SuggestionSettingsModel: Assign all @Published properties from data Note over SuggestionSettingsModel: (including fadeInSuggestions + fadeInDurationSeconds — added by this PR) SuggestionSettingsModel-->>Caller: fully initialized instance Caller->>SuggestionSettingsModel: resetToDefaults() SuggestionSettingsModel->>SuggestionSettingsStore: resetToDefaults(configuration:) SuggestionSettingsStore-->>SuggestionSettingsModel: SuggestionSettingsData (defaults) Note over SuggestionSettingsModel: Re-fans all @Published properties (mirrors init) SuggestionSettingsModel-->>Caller: settings resetReviews (1): Last reviewed commit: "Fix build: initialize fadeIn properties ..." | Re-trigger Greptile