From 2c46abd64f4b20c2a30e940216781b578f3e6b06 Mon Sep 17 00:00:00 2001 From: joshp123 Date: Thu, 9 Apr 2026 17:04:13 +0200 Subject: [PATCH] fix(gateway-tests): tolerate workspaceDir in provider runtime patch The gateway postpatch script was matching an outdated exact text block in src/plugins/provider-runtime.ts. Upstream added workspaceDir between env and cacheBucket, so the transform stopped applying when testing newer upstream revisions like 65b781f. Teach the patch to accept both shapes so repin work does not fail on a stale string match. Tests: - sh -n nix/scripts/gateway-postpatch.sh - dry-run gateway-postpatch.sh against upstream provider-runtime.ts at 65b781f --- nix/scripts/gateway-postpatch.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nix/scripts/gateway-postpatch.sh b/nix/scripts/gateway-postpatch.sh index 2c60989..ebdd95a 100755 --- a/nix/scripts/gateway-postpatch.sh +++ b/nix/scripts/gateway-postpatch.sh @@ -96,9 +96,14 @@ text = text.replace(old, new, 1) old = """ const env = params.env ?? process.env;\n const cacheBucket = resolveHookProviderCacheBucket({\n""" new = """ const env = params.env ?? process.env;\n if (shouldSkipProviderRuntimeForTest(env)) {\n return [];\n }\n const cacheBucket = resolveHookProviderCacheBucket({\n""" -if old not in text: +old_with_workspace = """ const env = params.env ?? process.env;\n const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDirFromState();\n const cacheBucket = resolveHookProviderCacheBucket({\n""" +new_with_workspace = """ const env = params.env ?? process.env;\n if (shouldSkipProviderRuntimeForTest(env)) {\n return [];\n }\n const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDirFromState();\n const cacheBucket = resolveHookProviderCacheBucket({\n""" +if old in text: + text = text.replace(old, new, 1) +elif old_with_workspace in text: + text = text.replace(old_with_workspace, new_with_workspace, 1) +else: raise SystemExit("expected resolveProviderPluginsForHooks env block not found") -text = text.replace(old, new, 1) path.write_text(text) PY