Repository: cylc/cylc-uiserver (language: python)

Issue:
🤖 Bump dev version
I have attempted to guess the next dev version.
If it is not correct, please push to this branch.



Discussion / hints:

Fix patch:
diff --git a/CHANGES.md b/CHANGES.md
index 51a03b4a..b4962abe 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,6 +12,12 @@ $ towncrier create <PR-number>.<break|feat|fix>.md --content "Short description"
 
 <!-- towncrier release notes start -->
 
+## cylc-uiserver-1.4.3 (Released 2023-12-05)
+
+### 🔧 Fixes
+
+[#533](https://github.com/cylc/cylc-uiserver/pull/533) - Fixed bug introduced in 1.4.2 where playing a workflow would fail if using a Cylc environment whose name does not match `cylc-8.X.Y` exactly.
+
 ## cylc-uiserver-1.4.2 (Released 2023-11-29)
 
 [Updated cylc-ui to 2.3.0](https://github.com/cylc/cylc-ui/blob/master/CHANGES.md)
diff --git a/cylc/uiserver/resolvers.py b/cylc/uiserver/resolvers.py
index 9194b615..db3e357f 100644
--- a/cylc/uiserver/resolvers.py
+++ b/cylc/uiserver/resolvers.py
@@ -300,8 +300,8 @@ async def play(
                 log.info(f'$ {cmd_repr}')
 
                 env = os.environ.copy()
-                env.pop('CYLC_ENV_NAME', None)
                 if cylc_version:
+                    env.pop('CYLC_ENV_NAME', None)
                     env['CYLC_VERSION'] = cylc_version
 
                 # run cylc play


Test patch:
diff --git a/cylc/uiserver/tests/test_resolvers.py b/cylc/uiserver/tests/test_resolvers.py
index 6f313c6b..0ed28726 100644
--- a/cylc/uiserver/tests/test_resolvers.py
+++ b/cylc/uiserver/tests/test_resolvers.py
@@ -78,6 +78,14 @@ def test_Services_anciliary_methods(func, message, expect):
             {'CYLC_VERSION': 'top'},
             id="cylc version overrides env"
         ),
+        pytest.param(
+            [Tokens('wflow1')],
+            {},
+            {'CYLC_VERSION': 'charm', 'CYLC_ENV_NAME': 'quark'},
+            [True, "Workflow(s) started"],
+            {'CYLC_VERSION': 'charm', 'CYLC_ENV_NAME': 'quark'},
+            id="cylc env not overriden if no version specified"
+        ),
     ]
 )
 async def test_play(
@@ -97,6 +105,9 @@ async def test_play(
         expected_ret: expected return value
         expected_env: any expected environment variables
     """
+    monkeypatch.delenv('CYLC_ENV_NAME', raising=False)
+    expected_env = {**os.environ, **expected_env}
+
     for k, v in env.items():
         monkeypatch.setenv(k, v)
     monkeypatch.setattr('cylc.uiserver.resolvers.getuser', lambda: 'murray')
@@ -118,9 +129,6 @@ async def test_play(
 
     assert ret == expected_ret
 
-    expected_env = {**os.environ, **expected_env}
-    expected_env.pop('CYLC_ENV_NAME', None)
-
     for i, call_args in enumerate(mock_popen.call_args_list):
         cmd_str = ' '.join(call_args.args[0])
         assert cmd_str.startswith('cylc play')