[Quality Management] Init values in the test if there are two or more promoted quality results#8255
Open
JakovljevicDusan wants to merge 1 commit into
Open
Conversation
| ToTestQltyIResultConditConf."Condition Description" := CopyStr(Condition, 1, MaxStrLen(ToTestQltyIResultConditConf."Condition Description")); | ||
| ToTestQltyIResultConditConf.Insert(); | ||
| end else | ||
| if AlwaysUpdateExistingCondition or (OnlyOverwriteIfADefaultCondition and (ToTestQltyIResultConditConf.Condition in [QltyInspectionResult."Default Boolean Condition", QltyInspectionResult."Default Number Condition", QltyInspectionResult."Default Text Condition"])) then begin |
Contributor
There was a problem hiding this comment.
Empty condition silently overwrites on upgrade
Adding '' to the in list means any existing record whose Condition field is blank will now be treated as a default and overwritten during configuration seeding — even if the blank value was intentionally left by a user or previous customization. This silent data mutation can occur on every upgrade run that calls this code path with OnlyOverwriteIfADefaultCondition = true.
Recommendation:
- Confirm whether a blank
Conditionshould truly be equated with the named default values. If so, document this assumption. If not, keep the guard to the three explicit default constants and handle blank conditions separately (e.g., only overwrite blank on fresh insert). At minimum, add a comment explaining why''is included alongside the named defaults.
Suggested change
| if AlwaysUpdateExistingCondition or (OnlyOverwriteIfADefaultCondition and (ToTestQltyIResultConditConf.Condition in [QltyInspectionResult."Default Boolean Condition", QltyInspectionResult."Default Number Condition", QltyInspectionResult."Default Text Condition"])) then begin | |
| if AlwaysUpdateExistingCondition or | |
| (OnlyOverwriteIfADefaultCondition and | |
| (ToTestQltyIResultConditConf.Condition in | |
| // '' treated as uninitialized; safe to overwrite just like named defaults | |
| ['', | |
| QltyInspectionResult."Default Boolean Condition", | |
| QltyInspectionResult."Default Number Condition", | |
| QltyInspectionResult."Default Text Condition"])) then begin |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
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.
What & why
Handle default condition in Test for blank value
Linked work
Fixes AB#622769