From cbfa2b527f3b1d0f9eaf934f85316fa34e513a80 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Tue, 4 Nov 2025 12:23:07 +0100 Subject: [PATCH 1/2] Fix error handling in verify_run_task_caches We were hiding the actual error by causing a TypeError. --- src/taskgraph/util/verify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/taskgraph/util/verify.py b/src/taskgraph/util/verify.py index 594388019..357cc7d9a 100644 --- a/src/taskgraph/util/verify.py +++ b/src/taskgraph/util/verify.py @@ -351,14 +351,14 @@ def verify_run_task_caches(task, taskgraph, scratch_pad, graph_config, parameter if not run_task: raise Exception( - f"{task['label']} is using a cache ({cache}) reserved for run-task " + f"{task.label} is using a cache ({cache}) reserved for run-task " "change the task to use run-task or use a different " "cache name" ) if suffix not in cache: raise Exception( - f"{task['label']} is using a cache ({cache}) reserved for run-task " + f"{task.label} is using a cache ({cache}) reserved for run-task " "but the cache name is not dependent on the contents " "of run-task; change the cache name to conform to the " "naming requirements" From 83edc2fd70a30b6d58e7a44241453bca6b660a44 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Tue, 4 Nov 2025 12:29:37 +0100 Subject: [PATCH 2/2] Add tests for `verify_run_task_caches` --- test/test_util_verify.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/test_util_verify.py b/test/test_util_verify.py index 3218daf09..359afdf85 100644 --- a/test/test_util_verify.py +++ b/test/test_util_verify.py @@ -265,6 +265,43 @@ def make_task_treeherder(label, symbol, platform="linux/opt"): pytest.raises(Exception), id="dependencies over limit", ), + pytest.param( + "verify_run_task_caches", + make_graph( + make_task("task1", task_def={"payload": {"cache": {"foo": {}}}}) + ), + pytest.raises(Exception, match="not appropriate for its trust-domain"), + id="using cache with wrong trust-domain", + ), + pytest.param( + "verify_run_task_caches", + make_graph( + make_task( + "task1", + task_def={ + "payload": {"cache": {"test-domain-level-1-checkouts": {}}} + }, + ) + ), + pytest.raises(Exception, match="reserved for run-task"), + id="using reserved cache", + ), + pytest.param( + "verify_run_task_caches", + make_graph( + make_task( + "task1", + task_def={ + "payload": { + "cache": {"test-domain-level-1-checkouts": {}}, + "command": ["run-task"], + } + }, + ) + ), + pytest.raises(Exception, match="cache name is not dep"), + id="using run-task without cache suffix", + ), ), ) @pytest.mark.filterwarnings("error")