Skip to content

Leave a leading tilde for the remote shell to expand - #54

Merged
titouanmathis merged 1 commit into
mainfrom
fix/tilde-in-mkdir
Sep 8, 2026
Merged

Leave a leading tilde for the remote shell to expand#54
titouanmathis merged 1 commit into
mainfrom
fix/tilde-in-mkdir

Conversation

@titouanmathis

Copy link
Copy Markdown
Contributor

0.1.40 created a sync destination's parent with mkdir -p, but quoted the whole path. The remote shell then read '~/www/app/web' literally, so mkdir made a directory actually named ~ and the transfer still failed on the path it was meant to have created:

$ ls -d ./~ && find ./~
./~
./~/www
./~/www/preview-462--alloayiti
./~/www/preview-462--alloayiti/web

Meanwhile the deploy reported the original error, unchanged. 0.1.40 fixed nothing in practice — the retried pipeline failed identically, which is how this surfaced.

Why the test missed it

The unit test asserted on /x/web:

expect(calls[0]!.args[index + 1]).toBe("mkdir -p '/x/web' && rsync");

An absolute path is the one shape where quoting the whole thing is harmless — and not the shape a deploy uses. Every real call passes ~/www/<project>/…, because that is what --projects-dir defaults to.

The fix

A leading ~ stays outside the quotes, so the shell expands it while the rest is still protected:

mkdir -p ~/'www/my-app/web' && rsync

~user/www and a~b are quoted whole: the first is a different expansion, the second is not one at all.

Tests

Both a unit test and an integration test now use a ~ path, and each was verified to fail without the fix, reproducing the same change_dir "/home/testuser/trafic-test-tilde/web" failed: No such file or directory. The integration test also asserts no ./~ is left behind. 121 unit tests, 15 integration.

0.1.40 created a sync destination's parent with `mkdir -p`, but quoted the
whole path. The remote shell then read '~/www/app/web' literally, so mkdir
made a directory actually named "~" and the transfer still failed on the path
it was meant to have created. The server grew a
./~/www/preview-462--alloayiti/web tree while the deploy reported the
original error — 0.1.40 fixed nothing in practice.

The unit test asserted on /x/web, an absolute path: the one shape where
quoting the whole thing is harmless, and not the shape a deploy uses. A unit
test and an integration test now both use a `~` path, and each was verified
to fail without the fix, reproducing the same "No such file or directory".

Co-authored-by: Claude <claude@anthropic.com>
Claude-Session: https://claude.ai/code/session_016xdQPh3UcnZfjM5HS36ABP
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.35%. Comparing base (b264db3) to head (d0b7181).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
+ Coverage   82.30%   82.35%   +0.04%     
==========================================
  Files          35       35              
  Lines        1481     1485       +4     
  Branches      375      377       +2     
==========================================
+ Hits         1219     1223       +4     
  Misses        219      219              
  Partials       43       43              
Flag Coverage Δ
integration 67.79% <75.00%> (+0.25%) ⬆️
unit 82.15% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@titouanmathis
titouanmathis merged commit 5625aa7 into main Sep 8, 2026
10 checks passed
@titouanmathis
titouanmathis deleted the fix/tilde-in-mkdir branch September 8, 2026 13:27
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