SingleInstanceLock (OS FileLock on <dataDir>/incido.lock) claims the library
before the container starts; a second launch prints INSTANCE and exits 0 —
which also converts the wedged-child trap into a clean message. Tray
(ApplicationScope extension; Item/Separator menu) attaches only for
non-scripted, non-headless, SystemTray-capable sessions; close=quit kept.
First-run dialog explains the per-machine library + backup bridge, gated on
onboarded_v1 in the window store. Two new §3 traps recorded (Window
iconBitmap overload ambiguity; Tray receiver/params) + new harness legs in §1.
Verify: second launch same dir (INSTANCE ... exits, 0); interactive run
(TRAY attached, live KDE SNI); :desktopApp:run --args="--data-dir
/tmp/incido-m52-ob --onboarding-smoke --exit-after 8" (shown=true,
flag-persisted=true PASS) then --onboarding-verify (shown=false gate
respected); --keys-smoke KEYS ALL-OK; --self-test id=1;
:core:data-jvm:smoke M1a PASS; assembleDebug SUCCESSFUL.
Also two new §3 traps paid for during the gate re-run: daemon-surviving
desktop JVMs after a client kill (use pkill -9 before re-running against
the same data dir), and never parallelizing two --data-dir runs (leg B
against leg A's half-written library produces bogus FAILs).
Closes milestone M3 (DESKTOP_PHASE_PLAN §5).
Code (one addition): --key-export / --key-import CLI legs in Main.kt —
the SecurityActions menu's exact codec calls, headless. This makes the
pending physical-phone leg a one-liner once a Waydroid container is
live (recipe recorded in the feasibility doc).
Docs: DESKTOP_FEASIBILITY.md gains the M3.1–M3.4 status section with
the actual run output (leg A/B, KEYENV logs, 0600 ls lines); plan §1
lists the two crypto legs among the must-stay-green commands; §5 marked
DONE; first-actions now point a fresh session at M4 task 1.
Exit criteria, per the plan's wording:
- encrypted desktop library passes EncryptionVerifier's trial-decrypt
sweep: MET (leg A verified=1 failed=0, wrong key -> AEAD failure
count, leg B relaunch all-ok).
- phone-exported recovery key decrypts on desktop: MET at format level
(shared codec source, 84B INCKEY1 envelope, AEADBadTagException on
wrong passphrase, byte-identical key into a fresh 0600 file); the
physical phone export is FLAGGED pending (Waydroid container FROZEN,
start is sudo-gated) with the exact re-run recipe — not assumed done.
Verified: ./gradlew assembleDebug, :core:data-jvm:smoke,
:spike:data-jvm:run, :desktopApp:run --self-test, and both crypto legs
— all green in one final pass (one self-test teardown hang under the
compositor, rc=124, clean on immediate rerun — recorded, environmental).
Adds tools/DESKTOP_PHASE_PLAN.md: everything a fresh session needs with no
prior context — current module shape, the exact commands that must stay
green, pinned versions, the invariants (tracked ObjectBox model file, the
objectbox-android / objectbox-java classpath rule, kapt and Compose
Desktop plugin quirks), the traps already paid for, and the M2/M3/M4/M5
milestones with exit criteria.
Every claim is checked against the working tree rather than remembered:
the coupling inventory (per-file android.* import counts), the 8
DataStore keys, AesGcmFieldCipher's single getOrCreateKey() call, the
portability of BackupCodec/EncryptedBackupCodec, and the pinned versions
(Kotlin 2.0.21, AGP 8.7.2, Compose Multiplatform 1.7.3, ObjectBox 4.0.3).
Open questions are marked as such rather than guessed — the JVM EXIF
decoder and OS-keyring libraries are unverified, and the AGP/KMP
friction around the composeApp conversion is called out as the least-known
part of M4, with a fallback shape and a time-boxed decision rule.