Skip to content

[Code Quality] Post-launch hook missing EnvironmentVariables / Stdout / Stderr / Timeout / Retry / IgnoreFailure — asymmetric with pre-launch #762

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Info
Files: src/Servy.Core/Domain/Service.cs, src/Servy.Core/DTOs/ServiceDto.cs, src/Servy.CLI/Options/InstallServiceOptions.cs, plus the GUI / Manager / CLI mappers and validators.

Description:

Pre-launch and post-launch hooks expose different surface areas:

Property Pre-Launch Post-Launch
ExecutablePath yes yes
StartupDirectory yes yes
Parameters yes yes
EnvironmentVariables yes no
StdoutPath yes no
StderrPath yes no
TimeoutSeconds yes no
RetryAttempts yes no
IgnoreFailure yes no

Grep confirms PostLaunchEnvironmentVariables does not exist anywhere in the codebase, while PreLaunchEnvironmentVariables is plumbed through the domain model, DTO, install options, mappers, validator, and XAML binding.

Why this matters:

  • A post-launch hook that needs environment-specific configuration (tokens, paths, custom PATH) cannot receive it; operators have to bake values into the exe or rely on machine-wide env.
  • Logging asymmetry: if the post-launch hook fails silently, there is no stdout/stderr file to inspect — pre-launch has this, post-launch does not.
  • No timeout or retry means a post-launch hook that hangs will never be reaped by Servy; it just leaks.
  • The XAML UI in src/Servy/Views/MainWindow.xaml also reflects this: a pre-launch Env Vars TextBox exists at line 812 with no post-launch counterpart.

Question for the maintainer:

Is this asymmetry intentional (post-launch is fire-and-forget by design and should not grow state-holding fields) or an oversight? If intentional, would be worth a comment in Service.cs Domain describing the design choice. If not, the fix is symmetric property expansion across Domain / DTO / InstallServiceOptions / both validators / both mappers / both XAML views / CLI options.

If symmetric plumbing is desired, the eventual fix is substantial and overlaps with the "validation logic triplicated" refactor already tracked in #404 — might be worth sequencing the two.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions