From f3d215aa4229c4303a9941abe079f29ed74b8bd2 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 13 Jan 2026 10:12:31 +0100 Subject: [PATCH] fix: modified value without layer --- src/rougail/output_display/display.py | 10 ++++++++-- tests/errors7-results/display.gitlab.md | 2 +- tests/errors7-results/display.md | 2 +- tests/errors7-results/display.sh | 2 +- tests/errors7-results/display_warnings.gitlab.md | 2 +- tests/errors7-results/display_warnings.md | 2 +- tests/errors7-results/display_warnings.sh | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/rougail/output_display/display.py b/src/rougail/output_display/display.py index 49da3528..5ea62706 100644 --- a/src/rougail/output_display/display.py +++ b/src/rougail/output_display/display.py @@ -278,7 +278,12 @@ class Node: is_default = option.owner.isdefault() option_path = option.path() default_owner = owners.default - true_default = is_default and meta_option.owner.get() == default_owner + if self.root_config == meta_config: + added = True + true_default = is_default + else: + true_default = is_default and meta_option.owner.get() == default_owner + added = not is_default or true_default while True: if values and true_default and value in [None, []]: break @@ -290,7 +295,7 @@ class Node: loaded_from = None else: loaded_from = meta_option.information.get(loaded_from_key, None) - if true_default or loaded_from or force_store_value: + if added or force_store_value: values.append( { "value": value, @@ -325,6 +330,7 @@ class Node: except Exception as err: break true_default = is_default and meta_option.owner.get() == default_owner + added = True meta_config = new_meta_config if leader_index is not None: if len(value) > leader_index: diff --git a/tests/errors7-results/display.gitlab.md b/tests/errors7-results/display.gitlab.md index 62630f1b..6104297a 100644 --- a/tests/errors7-results/display.gitlab.md +++ b/tests/errors7-results/display.gitlab.md @@ -1,4 +1,4 @@ > [!CAUTION] > > - family1 -> - this variable is in fact a family: :stop_sign: [- is a family so we cannot set the value "value", it has been loading from fake user data -] +> - this variable is in fact a family: :stop_sign: [- it's a family so we cannot set the value "value", it has been loading from fake user data -] diff --git a/tests/errors7-results/display.md b/tests/errors7-results/display.md index 4edd5593..f15a3d66 100644 --- a/tests/errors7-results/display.md +++ b/tests/errors7-results/display.md @@ -1,4 +1,4 @@ > [!CAUTION] > > - family1 -> - this variable is in fact a family: :stop_sign: is a family so we cannot set the value "value", it has been loading from fake user data +> - this variable is in fact a family: :stop_sign: it's a family so we cannot set the value "value", it has been loading from fake user data diff --git a/tests/errors7-results/display.sh b/tests/errors7-results/display.sh index 90b1459d..ce74d37d 100644 --- a/tests/errors7-results/display.sh +++ b/tests/errors7-results/display.sh @@ -1,3 +1,3 @@ 🛑 Caution ┗━━ family1 - ┗━━ this variable is in fact a family: 🛑 is a family so we cannot set the value "value", it has been loading from fake user data + ┗━━ this variable is in fact a family: 🛑 it's a family so we cannot set the value "value", it has been loading from fake user data diff --git a/tests/errors7-results/display_warnings.gitlab.md b/tests/errors7-results/display_warnings.gitlab.md index bb5e4e12..be654732 100644 --- a/tests/errors7-results/display_warnings.gitlab.md +++ b/tests/errors7-results/display_warnings.gitlab.md @@ -1,6 +1,6 @@ > [!CAUTION] > > - family1 -> - this variable is in fact a family: :bell: [- is a family so we cannot set the value "value", it will be ignored when loading from fake user data -] +> - this variable is in fact a family: :bell: [- it's a family so we cannot set the value "value", it will be ignored when loading from fake user data -] > - this variable is in fact a family > - a true variable: :stop_sign: [- mandatory variable but has no value -] diff --git a/tests/errors7-results/display_warnings.md b/tests/errors7-results/display_warnings.md index ec72805f..9aebbc31 100644 --- a/tests/errors7-results/display_warnings.md +++ b/tests/errors7-results/display_warnings.md @@ -1,6 +1,6 @@ > [!CAUTION] > > - family1 -> - this variable is in fact a family: :bell: is a family so we cannot set the value "value", it will be ignored when loading from fake user data +> - this variable is in fact a family: :bell: it's a family so we cannot set the value "value", it will be ignored when loading from fake user data > - this variable is in fact a family > - a true variable: :stop_sign: mandatory variable but has no value diff --git a/tests/errors7-results/display_warnings.sh b/tests/errors7-results/display_warnings.sh index 3c0022b6..5cc42cd2 100644 --- a/tests/errors7-results/display_warnings.sh +++ b/tests/errors7-results/display_warnings.sh @@ -1,5 +1,5 @@ 🛑 Caution ┗━━ family1 - ┣━━ this variable is in fact a family: 🔔 is a family so we cannot set the value "value", it will be ignored when loading from fake user data + ┣━━ this variable is in fact a family: 🔔 it's a family so we cannot set the value "value", it will be ignored when loading from fake user data  ┗━━ this variable is in fact a family   ┗━━ a true variable: 🛑 mandatory variable but has no value