aboutsummaryrefslogtreecommitdiff
path: root/tests/test-duet-transfer.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-06 11:23:29 -0500
committerCraig Jennings <c@cjennings.net>2026-06-06 11:23:29 -0500
commit7757f6909bfcc20211e8ae1f4ad364082ca924f5 (patch)
treebc9f5bb14bcf1b07f954515dd8e7bfda27045f2d /tests/test-duet-transfer.el
parent3d8778ba12cbbe2b8f6d5512d4b4a8f13a9c55ac (diff)
downloadduet-7757f6909bfcc20211e8ae1f4ad364082ca924f5.tar.gz
duet-7757f6909bfcc20211e8ae1f4ad364082ca924f5.zip
fix: make the in-process execution mode explicit in specs and contract checks
Two coupled holes surfaced in the Phase 0-3 review. duet--transfer-spec copied only :argv, :default-directory, and :process-environment out of a backend's command result, dropping the :tramp marker, so a TRAMP-routed spec arrived as :argv nil with nothing telling the executor to copy in process. And duet--check-command leaned on listp, where nil is a list in Elisp, so a command builder returning nil or a bare :argv nil passed the minimum tier. Both turn on the same idea, so they share a fix. duet--command-spec-executable-p defines a runnable spec: a non-empty plist with either a non-empty :argv of strings (a CLI backend) or a declared in-process mode such as :tramp. The contract checker rejects anything else, and transfer-spec now carries :tramp through, so the TRAMP fallback has a positive execution signal rather than an ambiguous nil argv. The legitimate TRAMP backend keeps passing because it declares its mode. A broken backend that forgets argv no longer slips through.
Diffstat (limited to 'tests/test-duet-transfer.el')
-rw-r--r--tests/test-duet-transfer.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test-duet-transfer.el b/tests/test-duet-transfer.el
index a5d0429..ebe5a2c 100644
--- a/tests/test-duet-transfer.el
+++ b/tests/test-duet-transfer.el
@@ -120,6 +120,14 @@
(should (eq 'rsync (plist-get spec :backend)))
(should (eq :local-remote (plist-get spec :route))))))
+(ert-deftest test-duet-transfer-spec-preserves-tramp-marker ()
+ "A spec routed through TRAMP carries the in-process marker, not just nil argv."
+ (test-duet-transfer--with-builtins
+ (let ((spec (duet--transfer-spec '("/tmp/a/file.txt") "/ftp:host:/b" nil)))
+ (should (eq 'tramp (plist-get spec :backend)))
+ (should (eq t (plist-get spec :tramp)))
+ (should (null (plist-get spec :argv))))))
+
;;; Conflict planning — pure, prompt-free
(ert-deftest test-duet-plan-conflicts-no-collisions-all-copy ()