@@ -107,17 +107,14 @@ export const resolveDockerCommand = (): Effect.Effect<
107107 }
108108
109109 const dockerHostRaw = process . env [ "DOCKER_HOST" ] ?. trim ( ) ?? ""
110+ const accessDeniedMessage = renderDockerAccessDeniedMessage ( {
111+ directProbe,
112+ sudoProbe,
113+ apiBaseUrl : resolveConfiguredApiBaseUrl ( ) ,
114+ dockerHost : dockerHostRaw . length > 0 ? dockerHostRaw : null
115+ } )
110116 return yield * _ (
111- Effect . fail (
112- controllerBootstrapError (
113- renderDockerAccessDeniedMessage ( {
114- directProbe,
115- sudoProbe,
116- apiBaseUrl : resolveConfiguredApiBaseUrl ( ) ,
117- dockerHost : dockerHostRaw . length > 0 ? dockerHostRaw : null
118- } )
119- )
120- )
117+ Effect . fail ( controllerBootstrapError ( accessDeniedMessage ) )
121118 )
122119 } )
123120
@@ -256,7 +253,7 @@ const mapDockerCaptureError =
256253// QUOTE(ТЗ): "комментарии ребита надо было тоже поддержать"
257254// REF: CodeRabbit PR #344 review 4349265315
258255// SOURCE: n/a
259- // FORMAT THEOREM: includeOutput -> failure_with_output; !includeOutput -> base_failure
256+ // FORMAT THEOREM: shouldIncludeOutput -> failure_with_output; !shouldIncludeOutput -> base_failure
260257// PURITY: CORE
261258// EFFECT: n/a
262259// INVARIANT: both modes preserve headline, command and exit code
@@ -268,14 +265,14 @@ const mapDockerCaptureError =
268265 * @param invocation - Resolved Docker invocation.
269266 * @param exitCode - Process exit code.
270267 * @param output - Combined stdout/stderr from the process.
271- * @param includeOutput - Whether the message should include captured process output.
268+ * @param shouldIncludeOutput - Whether the message should include captured process output.
272269 * @returns Stable Docker failure message.
273270 *
274271 * @pure true
275272 * @effect n/a
276273 * @invariant Base diagnostics always include command and exit code.
277274 * @precondition `exitCode` is the observed process exit code.
278- * @postcondition Captured output appears only when `includeOutput ` is true and output is non-empty.
275+ * @postcondition Captured output appears only when `shouldIncludeOutput ` is true and output is non-empty.
279276 * @complexity O(n) where n = |output|.
280277 * @throws Never
281278 */
@@ -284,9 +281,9 @@ const formatDockerCaptureFailure = (
284281 invocation : DockerInvocation ,
285282 exitCode : number ,
286283 output : string ,
287- includeOutput : boolean
284+ shouldIncludeOutput : boolean
288285) : string =>
289- includeOutput
286+ shouldIncludeOutput
290287 ? formatDockerInvocationFailureWithOutput ( `${ label } failed.` , invocation , exitCode , output )
291288 : formatDockerInvocationFailure ( `${ label } failed.` , invocation , exitCode )
292289
@@ -305,7 +302,7 @@ const formatDockerCaptureFailure = (
305302 *
306303 * @param args - Docker CLI arguments after the executable.
307304 * @param label - Operation label used in diagnostics.
308- * @param includeOutput - Whether non-zero exit diagnostics include captured stdout/stderr.
305+ * @param shouldIncludeOutput - Whether non-zero exit diagnostics include captured stdout/stderr.
309306 * @returns Effect containing stdout on success.
310307 *
311308 * @pure false
@@ -319,7 +316,7 @@ const formatDockerCaptureFailure = (
319316const runDockerCaptureWithOutputMode = (
320317 args : ReadonlyArray < string > ,
321318 label : string ,
322- includeOutput : boolean
319+ shouldIncludeOutput : boolean
323320) : Effect . Effect < string , ControllerBootstrapError , ControllerRuntime > =>
324321 resolveDockerInvocation ( args ) . pipe (
325322 Effect . flatMap ( ( invocation ) =>
@@ -331,7 +328,7 @@ const runDockerCaptureWithOutputMode = (
331328 } ,
332329 [ 0 ] ,
333330 ( exitCode , output ) =>
334- controllerBootstrapError ( formatDockerCaptureFailure ( label , invocation , exitCode , output , includeOutput ) )
331+ controllerBootstrapError ( formatDockerCaptureFailure ( label , invocation , exitCode , output , shouldIncludeOutput ) )
335332 )
336333 ) ,
337334 Effect . mapError ( mapDockerCaptureError ( label ) )
@@ -379,10 +376,11 @@ export const runCompose = (
379376) : Effect . Effect < void , ControllerBootstrapError , ControllerRuntime > =>
380377 Effect . gen ( function * ( _ ) {
381378 const dockerCommand = yield * _ ( resolveDockerCommand ( ) )
379+ const composeFiles = yield * _ ( ControllerCompose . resolveControllerComposeFiles ( ) )
382380 const invocation = buildDockerInvocation ( dockerCommand , [
383381 "compose" ,
384382 ...ControllerCompose . controllerComposeProjectArgs ,
385- ...ControllerCompose . composeFilesToArgs ( yield * _ ( ControllerCompose . resolveControllerComposeFiles ( ) ) ) ,
383+ ...ControllerCompose . composeFilesToArgs ( composeFiles ) ,
386384 ...args
387385 ] )
388386 const exitCode = yield * _ (
@@ -402,12 +400,13 @@ export const runCompose = (
402400 return
403401 }
404402
403+ const failureMessage = formatDockerInvocationFailure (
404+ "Failed to start docker-git controller." ,
405+ invocation ,
406+ exitCode
407+ )
405408 return yield * _ (
406- Effect . fail (
407- controllerBootstrapError (
408- formatDockerInvocationFailure ( "Failed to start docker-git controller." , invocation , exitCode )
409- )
410- )
409+ Effect . fail ( controllerBootstrapError ( failureMessage ) )
411410 )
412411 } )
413412
0 commit comments