fix(drift): resolve explicit network names that equal compose keys (#1588)

Compare runtimeResourceName against the project-prefixed default instead
of the compose key so networks like tailscale: { name: tailscale } are
not mis-resolved as network_tailscale in Drift, Fleet summary, and preflight.

Fixes #1581
This commit is contained in:
Anso
2026-07-07 14:41:18 -04:00
committed by GitHub
parent e12602091a
commit 4123793e68
5 changed files with 77 additions and 11 deletions
+3 -2
View File
@@ -36,8 +36,9 @@ export function isHostNetwork(mode: string | undefined): boolean {
* by its real name (the key, or a `name:` override), so prefixing it would invent
* a `<project>_<key>` that no runtime resource matches and read as foreign drift. */
export function runtimeResourceName(projectName: string, key: string, declaredName: string | undefined, external = false): string {
if (declaredName && declaredName !== key) return declaredName;
return external ? key : `${projectName}_${key}`;
const defaultName = external ? key : `${projectName}_${key}`;
if (declaredName && declaredName !== defaultName) return declaredName;
return defaultName;
}
/** Extract host port numbers referenced by free-text access URLs, for the