From 72d5e13d599c13bbaac3cb0dd04c375866c4239b Mon Sep 17 00:00:00 2001 From: Marcus van Elst Date: Tue, 21 Apr 2026 09:38:56 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20compose=20=E2=80=94=20correct=20operator?= =?UTF-8?q?=20precedence=20in=20update=5Fenv=5Fvar=20apply=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The apply-side match condition was parsed as `(isinstance AND startswith) OR (entry == var_name)` which evaluated the equality branch for non-string entries, diverging from the preview-side detection logic just above. Adding parentheses around the two string-match clauses aligns apply with preview (M1). Co-Authored-By: Claude Sonnet 4.6 (1M context) --- src/mcp_synology_container/modules/compose.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mcp_synology_container/modules/compose.py b/src/mcp_synology_container/modules/compose.py index d627ce4..16c0449 100644 --- a/src/mcp_synology_container/modules/compose.py +++ b/src/mcp_synology_container/modules/compose.py @@ -272,7 +272,9 @@ def register_compose(mcp: FastMCP, config: AppConfig, client: DsmClient) -> None new_entry = f"{var_name}={var_value}" updated = False for i, entry in enumerate(env_list): - if isinstance(entry, str) and entry.startswith(f"{var_name}=") or entry == var_name: + if isinstance(entry, str) and ( + entry.startswith(f"{var_name}=") or entry == var_name + ): env_list[i] = new_entry updated = True break