mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-21 23:56:39 +00:00
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:
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { PreflightContext, PreflightFinding, PreflightSeverity, NodePortBinding } from './types';
|
||||
import type { EffService, EffPortSpec } from './effectiveModel';
|
||||
import type { ExposureIntent } from '../network/types';
|
||||
import { isLoopback } from '../network/normalize';
|
||||
import { isLoopback, runtimeResourceName } from '../network/normalize';
|
||||
|
||||
/** Higher number = more severe. Used to derive a run's overall status. */
|
||||
export const SEVERITY_RANK: Record<PreflightSeverity, number> = { info: 0, warning: 1, high: 2, blocker: 3 };
|
||||
@@ -52,11 +52,6 @@ function hasUidGidSignal(svc: EffService): boolean {
|
||||
return svc.user !== undefined || svc.envKeys.some(k => UID_GID_KEYS.has(k));
|
||||
}
|
||||
|
||||
/** Resolved runtime name of a top-level network/volume (compose prefixes the project). */
|
||||
function runtimeResourceName(projectName: string, key: string, declaredName: string): string {
|
||||
return declaredName !== key ? declaredName : `${projectName}_${key}`;
|
||||
}
|
||||
|
||||
// ----- rules ----------------------------------------------------------------
|
||||
|
||||
const renderFailed: PreflightRule = {
|
||||
|
||||
Reference in New Issue
Block a user