From ac0c8f1777f2d76a3fb9d6caeb3bc4e35be65ba3 Mon Sep 17 00:00:00 2001 From: Andrei Ciobanu Date: Mon, 16 Feb 2026 16:12:20 +0200 Subject: [PATCH] Ensure that the state locking is configured correctly This is necessary because calling the Meta.extendedFlagSet was having this side-effect to set the stateLock=true. Now that we move away from it but we still don't have a unified way to handle the default cases for the stateLocking attributes, we will do this for the moment and unify it later. Signed-off-by: Andrei Ciobanu --- internal/command/console.go | 7 +++++++ internal/command/console_interactive_test.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/internal/command/console.go b/internal/command/console.go index eed277a4e0..d086bd2ee8 100644 --- a/internal/command/console.go +++ b/internal/command/console.go @@ -65,6 +65,13 @@ func (c *ConsoleCommand) Run(rawArgs []string) int { // operation, but there is no clear path to pass this value down, so we // continue to mutate the Meta object state for now. c.Meta.input = args.ViewOptions.InputEnabled + + // TODO meta-refactor: when the stateLock and stateLockTimeout are extracted to be configured separately, remove + // these and use a common way to configure this + // The stateLock=true is here this way because this command used before meta.extendedFlagSet which did the same + // and left for the command to configure flags for this if needed. + c.Meta.stateLock = true + c.GatherVariables(args.Vars) configPath := c.WorkingDir.NormalizePath(c.WorkingDir.RootModuleDir()) diff --git a/internal/command/console_interactive_test.go b/internal/command/console_interactive_test.go index c0391d3726..afd0d860bd 100644 --- a/internal/command/console_interactive_test.go +++ b/internal/command/console_interactive_test.go @@ -115,6 +115,11 @@ func TestConsole_multiline_interactive(t *testing.T) { if diff := cmp.Diff(got, tc.expected); diff != "" { t.Fatalf("unexpected output. For input: %s\n%s", tc.input, diff) } + + // TODO meta-refactor: remove this assertion once the stateLock from Meta is removed + if !c.Meta.stateLock { + t.Errorf("stateLock should always be nil for this command") + } }) } }