Skip to content

[ahma_mcp] fix: drop the hardcoded path separator in expand_home tests - #554

Merged
paulirotta merged 1 commit into
mainfrom
fix/expand-home-separator-assumption
Aug 7, 2026
Merged

[ahma_mcp] fix: drop the hardcoded path separator in expand_home tests#554
paulirotta merged 1 commit into
mainfrom
fix/expand-home-separator-assumption

Conversation

@paulirotta

Copy link
Copy Markdown
Owner

What

test_expand_home asserted expanded.ends_with("/test"). #542 routed this module's expand_home through ahma_common::config::expand_home, which joins with PathBuf::push instead of the previous replacen("~", home, 1).

On Windows that changed the result from C:\Users\x/test (mixed separators — the literal / survived from the input) to C:\Users\x\test, so the assertion failed.

Why fix the test, not the code

The new behaviour is the correct one: a canonical platform separator beats a mixed-separator path, which is the sort of thing that later trips Path::starts_with comparisons. The test carried the assumption AGENTS.md explicitly rules out:

Use MAIN_SEPARATOR/Path APIs, never string separator assumptions.

Both test_expand_home and its ~\ sibling now compare against std::path::MAIN_SEPARATOR.

Release impact

This was the only failure in the post-merge Windows matrix for 0.19.1 — 4352/4353 passed — and it cascaded through CI green to skip Publish Release. v0.19.1 was never published.

job-release-gate keys on whether tag v0.19.1 exists rather than on the version changing in the push, so landing this re-triggers the 0.19.1 build and publish with no further bump.

Verification

  • cargo fmt --all, cargo clippy --all-targets — clean
  • cargo nextest run — 4669/4669 passed
  • cargo nextest run --workspace --run-ignored all — 4680/4680 passed
  • cargo deny not run: no Cargo.toml/Cargo.lock change

Local runs are macOS, so they confirm no regression but cannot prove the Windows fix — the post-merge matrix is the real check.

`test_expand_home` asserted `expanded.ends_with("/test")`. #542 routed this
module's `expand_home` through `ahma_common::config::expand_home`, which joins
with `PathBuf::push` instead of the previous `replacen("~", home, 1)`. On
Windows that changed the result from `C:\Users\x/test` (mixed separators, the
literal `/` preserved from the input) to `C:\Users\x\test`, so the assertion
failed.

The new behaviour is the correct one — a canonical platform separator rather
than a mixed-separator path — so the test is what was wrong. It is exactly the
assumption AGENTS.md rules out: "Use `MAIN_SEPARATOR`/`Path` APIs, never string
separator assumptions." Both this test and its `~\` sibling now compare against
`std::path::MAIN_SEPARATOR`.

This was the sole failure in the post-merge Windows matrix for 0.19.1
(4352/4353 passed), and it cascaded through `CI green` to skip `Publish
Release`, so v0.19.1 was never published. The release gate keys on whether the
tag exists rather than on the version changing, so landing this re-triggers the
0.19.1 build and publish without a further bump.
@paulirotta
paulirotta enabled auto-merge (squash) August 7, 2026 11:26
@paulirotta
paulirotta merged commit 8b1802b into main Aug 7, 2026
4 checks passed
@paulirotta
paulirotta deleted the fix/expand-home-separator-assumption branch August 7, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant