Create a sync destination's parent, and retry a lost create-script - #53
Merged
Conversation
Two bugs found by a real first deploy, neither covered by the tests. rsync makes the destination directory itself but never its parent, so a single file whose parent is missing fails with "No such file or directory". Whether a deploy worked therefore depended on the order of --sync: a project listing web/index.php before the web/wp that would have created web/ never got past the first file. The parent is now created by --rsync-path, which runs in the remote shell, rather than --mkpath, which needs rsync 3.2.3 at both ends and would fail on the option itself on an older runner. That failure exposed the second bug. The create-script was keyed on the project directory being absent, so the failed deploy — which had already cloned — left every later deploy treating it as an existing project and skipping the create-script. The environment stayed unseeded for good, with no recovery but to destroy it; here it left a project whose .env was never written and never would be. It is now keyed on a marker written only after the script succeeds, so a create-script that fails runs again next time. An environment created before this release carries no marker and is assumed to have been seeded: re-running a seed against a database that has been live since is worse than skipping a step that was probably already done. A .trafic-cloned marker separates that case from a first deploy of this version that failed before its create-script. Co-authored-by: Claude <claude@anthropic.com> Claude-Session: https://claude.ai/code/session_016xdQPh3UcnZfjM5HS36ABP
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
+ Coverage 82.12% 82.30% +0.18%
==========================================
Files 35 35
Lines 1466 1481 +15
Branches 374 375 +1
==========================================
+ Hits 1204 1219 +15
Misses 219 219
Partials 43 43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`test:integration:ci` collects coverage for Codecov's `integration` flag, so it inherited the thresholds from vite.config.ts. Those are the unit suite's floor; the integration suite exercises ssh.ts against a real SSH server and touches little else, so it reports 66% and the run failed with all of its tests passing. CI has been red on main since 0.1.39 was released — the gate from #52 was measuring the wrong suite. Also adds the regression test for the parent-directory bug, against real rsync in the container. Verified to have teeth: with the fix removed it fails with the same "change_dir ... failed: No such file or directory" the deployment hit, and passes with it. 14 integration tests. Co-authored-by: Claude <claude@anthropic.com> Claude-Session: https://claude.ai/code/session_016xdQPh3UcnZfjM5HS36ABP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs found by a real first deploy of www.alloayiti.fr, neither of them covered by the tests.
rsync never creates the destination's parent
rsync makes the destination directory itself, but not its parent. So a single file whose parent is missing fails, and whether a deploy worked depended on the order of
--sync: a project listingweb/index.phpbefore theweb/wpthat would have createdweb/never got past the first file. Scalian only escaped it because its path order happened to createweb/first.The parent is now created by
--rsync-path, which runs in the remote shell and therefore works with any rsync version. Not--mkpath: that needs rsync 3.2.3 at both ends, and a runner older than that would fail on the option itself.A failed first deploy lost its create-script for good
That failure exposed a worse one. The create-script was keyed on the project directory being absent — but the failed deploy had already cloned, so every later deploy treated it as an existing project and skipped the create-script. The environment stayed unseeded permanently, with no recovery but to destroy it.
On the server it left exactly that:
.envwas written by the create-script, so no retry would ever produce it.It is now keyed on a marker written only after the script succeeds, so a create-script that fails runs again next time. Three cases, all tested:
.trafic-createdpresent.trafic-clonedpresent,.trafic-createdabsentThat last row is deliberate: re-running a seed against a database that has been live for weeks is worse than skipping a step that was probably already done.
.trafic-clonedis what separates it from a genuine retry.Tests
482 pass. Five new tests for the create-script decision (including the two cases above, which the old logic got wrong) and four for
parentOfand the--rsync-pathargument. CLI coverage 97.16% statements / 93.37% branches, above the gate added in #52.