Skip to content

v3.0.8

Latest

Choose a tag to compare

@github-actions github-actions released this 05 Jul 22:13
47191c6
Cli cross os local tests and windows fixes (#945)

<!-- greptile_comment -->

<h3>Greptile Summary</h3>

This PR replaces the Unix-only `which`-based `command_exists`
implementation with a portable PATH/PATHEXT walker, and adds a
fake-docker test fixture so local runtime CLI commands (`status`,
`logs`, `stop`, `prune`, `delete`) can be smoke-tested on any OS without
a running Docker daemon.

- **`utils.rs`**: New `command_exists_in_path` + `is_executable` pair
handles Windows PATHEXT extension probing and Unix permission-bit
checking, with inline unit tests for both paths.
- **`tests/support/mod.rs`**: `CliFixture` now writes a
platform-appropriate fake `docker` script into an isolated `bin/`
directory and prepends it to the subprocess PATH, replacing any real
Docker in the test environment.
- **`tests/e2e_cli.rs`**: New
`local_runtime_commands_have_cross_platform_no_daemon_smoke_coverage`
test exercises the full lifecycle of a local dev environment including
an expected-failure path for cloud-only instances.

<details><summary><h3>Important Files Changed</h3></summary>

| Filename | Overview |
|----------|----------|
| helix-cli/src/utils.rs | Replaces Unix-only `which`-based command
detection with a cross-platform implementation using PATH/PATHEXT; minor
double-syscall in the Unix `is_executable` path. |
| helix-cli/tests/support/mod.rs | Adds fake-docker installation and
PATH prepending to the CliFixture, enabling local runtime tests without
a real Docker daemon on both Unix and Windows. |
| helix-cli/tests/e2e_cli.rs | Adds a no-daemon smoke test covering
status/logs/stop/prune/start/restart/delete across platforms using the
new fake docker; assertions look correct for the expected CLI output. |
| helix-cli/Cargo.toml | Bumps version from 3.0.6 to 3.0.8; no other
changes. |

</details>

<details><summary><h3>Sequence Diagram</h3></summary>

<a href="#gh-light-mode-only">

```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Test as e2e_cli.rs
    participant Fixture as CliFixture
    participant Helix as helix binary
    participant Utils as utils::command_exists
    participant FakeDocker as fake docker script

    Test->>Fixture: CliFixture::new()
    Fixture->>FakeDocker: install_fake_docker(bin/)
    Fixture-->>Test: fixture with PATH prepended

    Test->>Helix: "helix status dev"
    Helix->>Utils: command_exists("docker")
    Utils->>Utils: split PATH, probe PATHEXT extensions
    Utils->>FakeDocker: is_executable bin/docker
    Utils-->>Helix: true
    Helix->>FakeDocker: "docker ps"
    FakeDocker-->>Helix: exit 0, no output
    Helix-->>Test: "not created"

    Test->>Helix: "helix logs dev"
    Helix->>FakeDocker: "docker logs container"
    FakeDocker-->>Helix: "fake logs" exit 0
    Helix-->>Test: stdout contains "fake logs"

    Test->>Helix: "helix start production"
    Helix-->>Test: stderr not-a-local-instance error, exit 1
```

</a>
<a href="#gh-dark-mode-only">

```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Test as e2e_cli.rs
    participant Fixture as CliFixture
    participant Helix as helix binary
    participant Utils as utils::command_exists
    participant FakeDocker as fake docker script

    Test->>Fixture: CliFixture::new()
    Fixture->>FakeDocker: install_fake_docker(bin/)
    Fixture-->>Test: fixture with PATH prepended

    Test->>Helix: "helix status dev"
    Helix->>Utils: command_exists("docker")
    Utils->>Utils: split PATH, probe PATHEXT extensions
    Utils->>FakeDocker: is_executable bin/docker
    Utils-->>Helix: true
    Helix->>FakeDocker: "docker ps"
    FakeDocker-->>Helix: exit 0, no output
    Helix-->>Test: "not created"

    Test->>Helix: "helix logs dev"
    Helix->>FakeDocker: "docker logs container"
    FakeDocker-->>Helix: "fake logs" exit 0
    Helix-->>Test: stdout contains "fake logs"

    Test->>Helix: "helix start production"
    Helix-->>Test: stderr not-a-local-instance error, exit 1
```

</a>
</details>

<sub>Reviews (1): Last reviewed commit: ["Expand cross-platform CLI
command
covera..."](https://github.com/helixdb/helix-db/commit/107b4b21b8dc0f841e1de69be749d74d1a78ed06)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41952238)</sub>

> Greptile also left **1 inline comment** on this PR.

<!-- /greptile_comment -->