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
This commit is contained in:
parent
ee4fb6e6d9
commit
2c46abd64f
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user