fix(dependency-map): stop flagging env-var bind mounts as missing volumes (#1468)

* fix(dependency-map): stop flagging env-var bind mounts as missing volumes

The Fleet Map "Missing dependencies" anomaly fired false positives for
services whose volumes use env-var-interpolated bind sources such as
${BACKUPS_PATH}:/backups. The compose parser classified the source as a
named volume because the ${VAR} token contains no slash, then the runtime
presence check found no matching volume and flagged it.

A compose named-volume key can never contain $, so any source with an env
var is a bind path whose value is unresolvable at parse time. Exclude it
from named-volume classification.

Closes #1464

* docs(dependency-map): clarify the env-var volume guard comment

Note that the $ check also covers the $$ literal-dollar Compose escape, and
state the named-volume key charset that makes the guard safe. No behavior change.
This commit is contained in:
Anso
2026-06-26 14:59:35 -04:00
committed by GitHub
parent 26d557a701
commit 5e2194f4a3
2 changed files with 39 additions and 0 deletions
@@ -66,6 +66,9 @@ function collectKeys(value: unknown): string[] {
/** True when a volume source is a named volume (not a bind mount or anonymous). */
function isNamedVolumeSource(source: string): boolean {
if (!source) return false;
// A named-volume key is [a-zA-Z0-9._-]+, so any '$' marks an env-var bind path
// (or the '$$' literal-dollar escape) whose value is unresolvable at parse time.
if (source.includes('$')) return false;
if (source.includes('/')) return false; // bind mount path
if (source.startsWith('.') || source.startsWith('~')) return false;
if (/^[a-zA-Z]:[\\/]/.test(source)) return false; // Windows drive path