Skip to content

Commit bb1f593

Browse files
committed
fix: resolve target-based AB test target name mismatch
The resolveTargetName() function had a false-positive in its startsWith check that prevented it from applying the project prefix. When the runtime name equals the project name (the default case), target names like "Foo-prod" already start with "Foo-" so the guard incorrectly assumed they were already prefixed and returned them unchanged. However, post-deploy-http-gateways.ts unconditionally creates targets as `${projectName}-${tgt.name}` (e.g., "Foo-Foo-prod"), so the AB test referenced a non-existent target and stayed in NOT_STARTED forever. The fix removes the startsWith heuristic and always applies the prefix, matching what post-deploy-http-gateways.ts does.
1 parent 804e041 commit bb1f593

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/cli/operations/deploy/post-deploy-ab-tests.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,14 +476,11 @@ function resolveConfigBundleVersion(
476476
}
477477

478478
/**
479-
* Resolve a variant target name, applying the project prefix if not already present.
480-
* This handles legacy configs that were created before the prefix requirement.
479+
* Resolve a variant target name by applying the project prefix unconditionally.
480+
* post-deploy-http-gateways.ts always creates targets as `${projectName}-${tgt.name}`,
481+
* so the AB test must reference the same prefixed name.
481482
*/
482483
function resolveTargetName(targetName: string, projectName: string): string {
483-
// If the target name already starts with the project prefix, use as-is to avoid double-prefixing
484-
if (targetName.startsWith(`${projectName}-`)) {
485-
return targetName;
486-
}
487484
return `${projectName}-${targetName}`;
488485
}
489486

0 commit comments

Comments
 (0)