@@ -72,6 +72,32 @@ export function dockerEndpointSocketPath(endpoint: string): string | undefined {
7272 return undefined ;
7373}
7474
75+ /**
76+ * How the endpoint is named in {@link localDockerEngineLayer}'s decline line:
77+ * by its scheme alone.
78+ *
79+ * That is the whole reason the probe declined — `tcp`, `ssh` and `fd` are not
80+ * local sockets — and it is the one part of a `DOCKER_HOST` that cannot carry
81+ * a credential. The rest can: `ssh://user:secret@host` is a supported spelling,
82+ * and once a password holds an unencoded `@`, `/`, `?` or `#` there is no
83+ * telling it apart from an ordinary host and path, so none of it is printed.
84+ */
85+ function describeEndpoint ( endpoint : string | undefined ) : string {
86+ if ( endpoint === undefined ) {
87+ return "unresolved context" ;
88+ }
89+ // Anchored on `://`, so a value with no scheme cannot report its own first
90+ // segment as one — that segment is the username in `user:secret@host`.
91+ const scheme = / ^ [ a - z A - Z ] [ a - z A - Z 0 - 9 + . - ] * (? = : \/ \/ ) / . exec ( endpoint ) ;
92+ if ( scheme === null ) {
93+ return "no scheme" ;
94+ }
95+ const name = scheme [ 0 ] . toLowerCase ( ) ;
96+ // A socket scheme only reaches the decline branch with nothing after it, so
97+ // naming it alone would read as a contradiction.
98+ return name === "unix" || name === "npipe" ? `${ name } , no socket path` : name ;
99+ }
100+
75101/**
76102 * Socket-inactivity deadline: a connected-but-silent endpoint degrades to the
77103 * container-CLI fallback instead of parking the command (#6110's hang shape).
@@ -206,8 +232,9 @@ const inspectContainerOverSocket = (
206232 * `docker` CLI itself would (`DOCKER_HOST` -> context store -> platform
207233 * default), inside `Effect.suspend` so every execution sees the current
208234 * environment. With `DebugLogger` provided (the db families provide it), the
209- * probe's endpoint and fallback decisions surface under `--debug` — otherwise
210- * this is the one HTTP call the debug side channel cannot see.
235+ * probe's socket and fallback decisions surface under `--debug` — otherwise
236+ * this is the one HTTP call the debug side channel cannot see. An endpoint it
237+ * cannot address is named by {@link describeEndpoint}, never printed.
211238 */
212239export const localDockerEngineLayer : Layer . Layer < LocalDockerEngine > = Layer . effect (
213240 LocalDockerEngine ,
@@ -225,7 +252,7 @@ export const localDockerEngineLayer: Layer.Layer<LocalDockerEngine> = Layer.effe
225252 endpoint === undefined ? undefined : dockerEndpointSocketPath ( endpoint ) ;
226253 if ( socketPath === undefined ) {
227254 return debug (
228- `local db engine probe: endpoint not directly addressable (${ endpoint === undefined ? "unresolved context" : redactHttpUrl ( endpoint ) } ) — using the container CLI` ,
255+ `local db engine probe: endpoint not directly addressable (${ describeEndpoint ( endpoint ) } ) — using the container CLI` ,
229256 ) . pipe ( Effect . as ( Option . none ( ) ) ) ;
230257 }
231258 return httpLine ( `${ endpoint } /containers/${ containerId } /json` ) . pipe (
0 commit comments