From 14a454f6e46601b7647571e7162b823e710d3eff Mon Sep 17 00:00:00 2001 From: Sebastien Blot Date: Wed, 29 Jul 2026 10:19:21 +0200 Subject: [PATCH 1/2] macro expand: log at debug level if the variable was not found --- experimental/plugins/macro/macro.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimental/plugins/macro/macro.go b/experimental/plugins/macro/macro.go index 7f5c01cb1..7b74fe94b 100644 --- a/experimental/plugins/macro/macro.go +++ b/experimental/plugins/macro/macro.go @@ -83,7 +83,7 @@ func expandToken(tx plugintypes.TransactionState, token macroToken) string { } // If the variable is known (e.g. TX) but the key is not found, we return the original text - tx.DebugLogger().Warn().Str("variable", token.variable.Name()).Str("key", token.key).Msg("key not found in collection, returning the original text") + tx.DebugLogger().Debug().Str("variable", token.variable.Name()).Str("key", token.key).Msg("key not found in collection, returning the original text") return token.text } From 42be06a366eacc97b5ce57e4602fe264eb6c9fd9 Mon Sep 17 00:00:00 2001 From: Sebastien Blot Date: Wed, 29 Jul 2026 10:29:13 +0200 Subject: [PATCH 2/2] fix tests --- internal/actions/setvar_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/actions/setvar_test.go b/internal/actions/setvar_test.go index f16e4fc9a..ab9e6fddf 100644 --- a/internal/actions/setvar_test.go +++ b/internal/actions/setvar_test.go @@ -67,6 +67,7 @@ func TestSetvarEvaluate(t *testing.T) { init2 string expectInvalidSyntaxError bool expectNewVarValue string + logLevel debuglog.Level }{ { name: "Numerical operation + with existing variable", @@ -74,6 +75,7 @@ func TestSetvarEvaluate(t *testing.T) { init2: "TX.newvar=+%{tx.var}", expectInvalidSyntaxError: false, expectNewVarValue: "5", + logLevel: debuglog.LevelError, }, { name: "Numerical operation - with existing variable", @@ -81,6 +83,7 @@ func TestSetvarEvaluate(t *testing.T) { init2: "TX.newvar=-%{tx.var}", expectInvalidSyntaxError: false, expectNewVarValue: "-5", + logLevel: debuglog.LevelError, }, { name: "Numerical operation - with existing negative variable", @@ -88,35 +91,40 @@ func TestSetvarEvaluate(t *testing.T) { init2: "TX.newvar=+5", expectInvalidSyntaxError: false, expectNewVarValue: "0", + logLevel: debuglog.LevelError, }, { name: "Numerical operation + with missing (or non-numerical) variable", init: "TX.newvar=+%{tx.missingvar}", expectInvalidSyntaxError: true, + logLevel: debuglog.LevelDebug, }, { name: "Numerical operation - with missing (or non-numerical) variable", init: "TX.newvar=-%{tx.missingvar}", expectInvalidSyntaxError: true, + logLevel: debuglog.LevelDebug, }, { name: "Non Numerical Operation - If the value starts with -", init: "TX.newvar=----expected_value", expectInvalidSyntaxError: false, expectNewVarValue: "----expected_value", + logLevel: debuglog.LevelError, }, { name: "Non Numerical Operation - If the value starts with +", init: "TX.newvar=+++expected_value", expectInvalidSyntaxError: false, expectNewVarValue: "+++expected_value", + logLevel: debuglog.LevelError, }, } for _, tt := range tests { logsBuf := &bytes.Buffer{} - logger := debuglog.Default().WithLevel(debuglog.LevelWarn).WithOutput(logsBuf) + logger := debuglog.Default().WithLevel(tt.logLevel).WithOutput(logsBuf) t.Run(tt.name, func(t *testing.T) { defer logsBuf.Reset()