All apps: a second launch hands its files to the running copy

R4.12 (user report). The copy holding the instance lock opens a local
door guarded by a random token in its data folder; a second copy sends
its file paths there, lets it take the foreground, and exits 0 instead
of showing "already running". Files join the ely_ui::on_open queue every
app already uses; the main window comes to the front. Also records the
R4.10 round 1 verdict.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-14 19:02:38 -04:00
1 parent d5ceaf9aac
commit 5bf2056281
10 files changed
+436 -41

No files matched your search

+8 -7
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# A second ElyDoc is refused; the first keeps its data.
# A second ElyDoc hands its file over and ends.
set -euo pipefail
root=$(cd "$(dirname "$0")/../.." && pwd)
@@ -18,7 +18,7 @@ trap cleanup EXIT
fail() { echo "FAIL: $*" >&2; exit 1; }
cargo build -q -p ely-lok --bins -p ely-doc --manifest-path "$root/Cargo.toml"
run() { HOME="$work/home" ELY_LOG=info ELY_LOCALE=en ELY_NO_DIALOG=1 ELY_SMOKE=hold exec "$root/target/debug/ely-doc"; }
run() { HOME="$work/home" ELY_LOG=info ELY_LOCALE=en ELY_NO_DIALOG=1 ELY_SMOKE=hold exec "$root/target/debug/ely-doc" "$@"; }
run >"$work/first" 2>&1 &
pid=$!
for _ in $(seq 90); do grep -q "lok: first tile drawn" "$work/first" && break; sleep 1; done
@@ -26,10 +26,11 @@ grep -q "lok: first tile drawn" "$work/first" || fail "the first copy did not st
data="$work/home/Library/Application Support/ElyOffice/ely-doc"
[ -d "$data/work" ] || fail "no work folder"
touch "$data/work/kept"
status=0
(run) >"$work/second" 2>&1 || status=$?
[ "$status" != 0 ] || fail "the second copy started"
grep -q "already running (process $pid)" "$work/second" || fail "the refusal: $(tail -3 "$work/second")"
cp "$root/tests/fixtures/office/t.docx" "$work/handed.docx"
(run "$work/handed.docx") >"$work/second" 2>&1 || fail "the second copy failed: $(tail -3 "$work/second")"
for _ in $(seq 30); do grep -q "opened handed.docx as tab" "$work/first" && break; sleep 1; done
grep -q "another copy handed over 1 files" "$work/first" || fail "no hand-over: $(tail -5 "$work/first")"
grep -q "opened handed.docx as tab" "$work/first" || fail "the first copy did not open it: $(tail -5 "$work/first")"
[ -e "$data/work/kept" ] || fail "the second copy wiped the first's work folder"
kill -0 "$pid" || fail "the first copy died"
echo "ok: a second ElyDoc is refused and the first keeps its data"
echo "ok: a second ElyDoc hands its file to the first, which keeps its data"