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
@@ -127,10 +127,16 @@ describe('assembleStackNetworkFacts', () => {
describe('runtimeResourceName', () => {
it('uses a name override, else the project prefix', () => {
expect(runtimeResourceName('myapp', 'backend', undefined)).toBe('myapp_backend');
expect(runtimeResourceName('myapp', 'backend', 'backend')).toBe('myapp_backend'); // name == key is not an override
expect(runtimeResourceName('myapp', 'backend', 'myapp_backend')).toBe('myapp_backend');
expect(runtimeResourceName('myapp', 'backend', 'backend')).toBe('backend');
expect(runtimeResourceName('myapp', 'shared', 'shared_net')).toBe('shared_net');
});
it('resolves explicit name equal to the compose key (regression: #1581)', () => {
expect(runtimeResourceName('network', 'tailscale', 'tailscale')).toBe('tailscale');
expect(runtimeResourceName('network', 'proxy', 'proxy')).toBe('proxy');
});
it('never project-prefixes an external resource (runtime name is the key, or a name override)', () => {
// Compose references an external network/volume by its real name and never
// prefixes the project, so an external resource with no name override keeps