fix(timeplanning): seed missing settings keys so UpdateSettings doesn't NRE#1611
Merged
Conversation
…dEditingEnabled so settings save doesn't NRE Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses a runtime failure in the TimePlanning plugin settings flow by ensuring required PluginConfigurationValue rows exist for bound TimePlanningBaseSettings properties, preventing UpdateSettings from throwing when saving settings.
Changes:
- Adds seed rows for
TimePlanningBaseSettings:PauseIdSelfHealEnabledandTimePlanningBaseSettings:DaysBackInTimeAllowedEditingEnabled. - Adds NUnit tests asserting the presence of the new seed rows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn/Infrastructure/Data/Seed/Data/TimePlanningConfigurationSeedData.cs | Adds missing configuration seed entries for newly/previously unseeded settings keys. |
| eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn.Test/ConfigurationSeedDataTests.cs | Introduces tests to ensure the required seed rows exist. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+230
to
234
| new PluginConfigurationValue | ||
| { | ||
| Name = $"{TimePlanningBaseSettingsName}:DaysBackInTimeAllowedEditingEnabled", | ||
| Value = "0" | ||
| } |
Comment on lines
+22
to
+32
| [Test] | ||
| public void SeedData_Contains_DaysBackInTimeAllowedEditingEnabled() | ||
| { | ||
| var seedData = new TimePlanningConfigurationSeedData(); | ||
|
|
||
| Assert.That( | ||
| seedData.Data.Any(x => | ||
| x.Name == "TimePlanningBaseSettings:DaysBackInTimeAllowedEditingEnabled" | ||
| && x.Value == "0"), | ||
| Is.True); | ||
| } |
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.
Problem
PR #1609 added the
PauseIdSelfHealEnabledproperty to the plugin's boundTimePlanningBaseSettingsbut did not add a corresponding seed row. The eform settings framework looks up each bound property by itsPluginConfigurationValuerow whenUpdateSettingsruns; a missing row causes a NullReferenceException on save.The pre-existing
DaysBackInTimeAllowedEditingEnabledproperty (astring, written byTimeSettingService.UpdateSettings) had the same unseeded gap and fails the same way.Fix
Seed both keys in
TimePlanningConfigurationSeedData:TimePlanningBaseSettings:PauseIdSelfHealEnabled=true(bool? property, bool-parsed)TimePlanningBaseSettings:DaysBackInTimeAllowedEditingEnabled=0(string property, read as== "1"inTimeSettingServiceline ~91, so"0"is the disabled default)The startup seed is idempotent, so redeploy backfills the rows for existing tenants — no EF migration needed.
Tests in
ConfigurationSeedDataTestsassert both seed rows are present.Notes
stable).🤖 Generated with Claude Code